如何防止CKEditor剥离<和>(大于/小于) [英] How to prevent CKEditor from stripping < and > (greater-than/less-than)

查看:20
本文介绍了如何防止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.

这篇关于如何防止CKEditor剥离&lt;和&gt;(大于/小于)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆