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


- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Flexslider 箭头未正确显示 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01