如何防止CKEditor剥离<和>(大于/小于)
每次我在 CKEditor 窗口中输入 <
或 >
时,保存,然后返回,CKEditor 会用括号内输入的内容替换它们以及随附的结束标签.例如:如果我输入 <configuration details>
,CKEditor 将假定它是一个 HTML 标签并将 <configuration details></configuration details>
放在 html 源代码中,因此从文本中完全删除它.啊!
Every time I enter <
or >
in a CKEditor window, save, and then come back to it, CKEditor replaces them with whatever was typed within the brackets and the accompanying end tag. For example:
if I type <configuration details>
, CKEditor will assume it is an HTML tag and put <configuration details></configuration details>
in the html source, thus stripping it out altogether from the text. Argh!
有什么想法吗?
推荐答案
是的,这真的很痛苦.
到目前为止,我发现的唯一解决方法是使用
The only workaround I've found so far is to use
CKEDITOR.instances.myInst.setData(myData);
这实际上可以正确处理转义与未转义的 html,因此您的 <和>将正确显示为小于号和大于号,而不是被解释为标记.
This actually handles escaped vs. unescaped html correctly, so your < and > will come out correctly, as less-than and greater-than signs, instead of being interpreted as markup.
我还没有找到一种方法来让它与内联数据一起工作.setData() 解决方法非常笨拙.
I haven't found a way to get this to work with inlined data yet. The setData() workaround is pretty clunky.
相关文章