简体   繁体   English

防止CKEditor删除跨度元素

[英]Prevent CKEditor from removing span elements

If I paste 如果我贴

<p class="foo">Some text: <span class="bar"></span> More text.</p>

into the editor as source then the span element will be removed when switching back to text edit mode. 进入编辑器作为源,然后在切换回文本编辑模式时,将删除span元素。 Is there a way to prevent this from happening? 有办法防止这种情况发生吗?

The answer is in this forum post . 答案在此论坛帖子中

Before creating my CKEditor (I personally am using the jQuery adapter, but this config option should work either way) I set CKEDITOR.dtd.$removeEmpty.span = 0 . 在创建我的CKEditor之前(我个人使用的是jQuery适配器,但是此配置选项应该以任何一种方式起作用),我设置了CKEDITOR.dtd.$removeEmpty.span = 0

Also see this doc page . 另请参阅此文档页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM