Search code examples
ckeditorckeditor4.x

How do I disable CKEditor from adding "cke:" to the beginning of object tags?


I'm trying to create a simple plugin for CKEditor that pastes a snippet of code into the editor. I have tried adding exceptions to the content filter, and even disabling the content filter entirely using config.allowedContent = true; In my config.js file.

When the <object></object> tag is first pasted into the editor it works fine, but when the user either switches to "source" mode and back to WYSIWYG mode I find that the <object> tag is now turned into a <cke:object></cke:object> tag which causes it to disappear from WYSIWYG mode.

How can I disable this feature?

I admit I dont fully understand the source code, but I dug around and the culprit(s) seem to be the file:

/ckeditor/core/filter.js

between lines 1463 and 1533

and also in:

/ckeditor/core/htmldataprocessor.js

starting on line 788.

Note: I am using CKEditor 4.5.6

They both contain references to the cke: and regex to append/remove that cke:prefix.

I tried looking here on Stack Overflow, the documentation, and even submitted a ticket months ago but I haven't been able to find the answer.


Solution

  • This is because you do not have a feature which will handle this <object> tag. For example if you enable Flash plugin and insert a Flash object it will be transformed to a placeholder (check this code). Because of security there can not be <object> tag inside the editable area, it needs to be handled by a plugin and transformed into a placeholder or a widget.