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剥离<和>(大于/小于)


基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01