CKEditor和转义元素 [英] CKEditor and escaping elements
问题描述
我使用 CKEditor 更新 CMS 内容在我的网站上。我也使用FontAwesome,其中包含一组花式图标,可以像这样显示
I've using CKEditor for updating CMS content on my website. I also using FontAwesome, which includes set of fancy icons, that can be displayed like this
<i class="icon-envelope"></i>
问题是CKEditor转义了这个我
标签在客户端,我看不到它在源模式。
The problem is that CKEditor escapes this i
tag on client side, and I can't see it in source mode.
我可以允许这个标签吗?我试过 CONFIG.removeFormatTags =''
,但它没有帮助。
How I can allow this tag? I have tried CONFIG.removeFormatTags = ''
, but it dies not help.
推荐答案
它被删除,因为它是空的。在其中放置一些不间断空间& nbsp;
或零宽度空间&#8203;
您的标签
It is removed because it is empty. Put some non-breaking space
or zero-width space ​
within it to preserve your tag.
您还可以从 CKEDITOR.dtd中删除
对象。然而,这可能会破坏其他空的 i
$ removeEmpty < i>
标签,而不需要$ code> class =icon-envelope。要解决这个问题,您需要使用数据处理器来过滤空的< i>的
没有 class =icon-envelope
。很简单我猜。
You can also remove i
from CKEDITOR.dtd.$removeEmpty
object. This may, however, break other empty <i>
tags without class="icon-envelope"
. To fix this you would need to play with a data processor to filter empty <i>'s
without class="icon-envelope"
. Pretty easy I guess.
这篇关于CKEditor和转义元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!