停止CKEditor删除div

xon*_*ous 8 javascript php ckeditor

我在我网站的后端安装了CKEditor.从代码视图切换到wysiwyg视图时,我遇到了以下问题.我插入的代码如下:

<div class="span4">
    <p>Some text here</p>
</div>
Run Code Online (Sandbox Code Playgroud)

当我切换回查看模式时,CKEditor会自动删除段落周围的div.

有人可以帮我解决这个问题吗?我不介意留在代码视图中,但我喜欢在视图模式下工作来编写更长的文本.

提前致谢.

Spo*_*ons 9

就像AlfonsoMl所说,这与高级内容过滤器有关

有关此外观的所有支持,请访问:http://docs.ckeditor.com/#!/ guide/dev_advanced_content_filter

或者在配置中添加以下行以禁用内容过滤器.(最好配置它)

CKEDITOR.config.allowedContent = true;
Run Code Online (Sandbox Code Playgroud)

  • 你没看过我的帖子.请参阅说"最好配置它"的部分.......我对ACF知之甚少的事实是我将URL发布到解释的确切原因. (3认同)

ole*_*leq 8

使用config.extraAllowedContent而不是禁用ACF功能:

editor.config.extraAllowedContent = 'div(span4)';
Run Code Online (Sandbox Code Playgroud)

要么

editor.config.extraAllowedContent = 'div(*)';
Run Code Online (Sandbox Code Playgroud)