CKEditor 剥离 <i>标签 [英] CKEditor strips <i> Tag

查看:19
本文介绍了CKEditor 剥离 <i>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试寻找避免使用 CKEditor 的解决方案,但旧的 FCKeditor 也会删除任何<i> 标记从先前插入的内容到数据库.

I'm trying to find a solution to avoid CKEditor, but also the older FCKeditor strips out any <i> tag from previously inserted content to the db.

案例:

我将 html 内容插入到数据库中,一些内容包含 <i> 元素.我用 CKEditor 来做这个.一切正常,内容显示在网页上.但是当我想编辑之前插入的内容时,<i> 元素丢失了.

I insert html content to the db, some content contain the <i> elements. I do this with the CKEditor. Everything works perfect and the content shows up on the webpage. But when i want to edit the previously inserted content, the <i> elements are missing.

在我的具体情况下,我使用:

<i class="fa-icon-fullscreen fa-icon-xxlarge main-color"></i>

当然,如果我禁用编辑器,文本区域中的内容会正常显示.

Of course if i disable the editor, the content shows up just fine in the textarea.

推荐答案

我用 <i> 标签找到了解决这个特定问题的方法

I found the solution for this specific problem i ran into with the <i> tag

我从 drupal 论坛

修复或调整(你可以命名)是在 ckeditors config.js 中设置以下内容:

The fix or tweak (you name it) for it is to set the following into the ckeditors config.js:

// ALLOW <i></i>
config.protectedSource.push(/<i[^>]*></i>/g);

感谢 Spasticdonkey 将我指向链接.

Thanks to Spasticdonkey for pointing me to the link.

这篇关于CKEditor 剥离 &lt;i&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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