Opened 10 years ago

Last modified 7 years ago

#11562 confirmed Bug

allowedContent = true results in JS error when inserting elements — at Initial Version

Reported by: Tyler Owned by:
Priority: Normal Milestone:
Component: Core : Editable Version: 4.0
Keywords: Cc:

Description

When config.allowedContent = true; is set, the editor throws a JS error when inserting content (such as an image) into any unknown element. A simple test case is this:

<nobr>a</nobr>

Steps to reproduce: With the above content entered into the editor, set the cursor focus to be inside the unknown tag, then insert an image.

Inside core/editable.js, the function extractNodesData throws an error trying to look-up the allowed names for this element.

This is invalid HTML, so it is a user error, but the config.allowedContent = true; prevents it from being filtered out (as it should). We've seen it pop-up when users are copy and pasting content from other sources. So at a minimum, I think the editor should handle this case in some way.

My suggestion is when allowedContent is set to true, the editor should treat all unknown tags as a semantically meaning-less tag, perhaps inheriting the allowedNames from DIV elements.

I would be willing to submit a fix with the above suggestion, or implement another suggested fix if needed.

Thanks

Chrome error message:

Uncaught TypeError: Cannot read property 'img' of undefined ckeditor.js:319
c ckeditor.js:319
(anonymous function) ckeditor.js:326
CKEDITOR.editable.CKEDITOR.tools.createClass.proto.insertHtml ckeditor.js:300
(anonymous function) ckeditor.js:306
h ckeditor.js:10
CKEDITOR.event.CKEDITOR.event.fire ckeditor.js:11
CKEDITOR.editor.CKEDITOR.editor.fire ckeditor.js:13
CKEDITOR.tools.extend.insertHtml ckeditor.js:225
$.extend.editor.paste

Change History (1)

Changed 10 years ago by Piotrek Koszuliński

Attachment: 11562.html added
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy