CKEditor4 destroy, not preserve original HTML content. How to disable filters?

泪湿孤枕 提交于 2019-12-20 06:19:36

问题


I am using the standard demos, like this. So, the main options (little changes) can be flagged at config.js.

Example when edit by source-code-HTML (button Source): elements (tags) with class attribute, lost the attribute (class has been stripped out).

So, how to disable the "default filter"?

The "filtering by default" behaviour is a problem: is not backwards compatible, and, mainly, not a expected behaviour, because destroy the original content, that you must only change with editor.

Similar questions:

  • CKeditor allowedContent behaving oddly

  • CKEditor classes being stripped


回答1:


At config.js you can add something like,

  CKEDITOR.config.allowedContent=true;

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




回答2:


We ran into this problem recently, 2017, version 5.5 developing a file load / save plugin and a speech recognition plugin for CKEditor (in progress). The above solutions helped, but also we had to use editor1.setData() to load the content into the editor.

Using select all and insertHTML() or insertText() methods was disrupting tags.



来源:https://stackoverflow.com/questions/18386864/ckeditor4-destroy-not-preserve-original-html-content-how-to-disable-filters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!