CKEditor classes being stripped

2019-03-01 05:14发布

问题:

I have a custom plugin that adds a link with a class attached. When I view this using the Source button it shows the class and looks as it should. However, when I go back to WYSYWIG view and then view the source again the class has been stripped out.

Any idea how to stop this happening?

Thanks in advance for your help.

回答1:

Check this blog post.

In CKEditor 4.1 RC we've introduced ACF - Advanced Content Filter. You need to integrate your plugin with it, because otherwise special content created by it is stripped.



回答2:

For CKEditor4 and for simple config.js modification, disabling the "default filters": see this new question/answer.


(copy)

At config.js you can add something like,

  CKEDITOR.config.allowedContent=true;

see "Advanced Content Filter" (ACF) and how to enable/disable it.