How to prevent CKEditor from stripping lt; and gt; (greater-than/less-than)(如何防止CKEditor剥离lt;和gt;(大于/小于))
问题描述
每次我在 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.
这篇关于如何防止CKEditor剥离<和>(大于/小于)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何防止CKEditor剥离<和>(大于/小于)


基础教程推荐
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01