为什么CKEditor将自己添加到不应该的div?

Lit*_*ski 5 javascript jquery ckeditor twitter-bootstrap-3

我有一个页面,我一起初始化了Bootstrap-WYSIWYG和CKEditor.

问题是CKEditor不断向Bootstrap-WYSIWYG div添加自己,即使我已经使用了特定的CKEditor初始化 class="ckeditor"

我的代码如下:

<textarea class="ckeditor" name="editor1"></textarea>
Run Code Online (Sandbox Code Playgroud)

该页面可以在http://cloudadmin-theme.elasticbeanstalk.com/rich_text_editors.html找到

尝试单击"带键盘快捷键的引导程序编辑器"选项卡,其中写着"继续...".这带来了CKEditor onfocus,这很奇怪!

我的智慧结束了.有人可以指导我.我究竟做错了什么?

epa*_*llo 19

默认情况下,CKEDITOR会自动挂钩具有该contenteditable="true"属性的元素.您想要关闭CKEDITOR的自动内联编辑,或者可以在全局配置中完成.

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

我更喜欢在代码中而不是在配置中执行此操作,因此如果其他人使用它,则不要搞砸它们.


基于您对启用CKEDITOR的评论这是从CKEDITOR 4文档中提取的

启用内联编辑

通过HTML5 contenteditable属性直接在HTML元素上启用内联编辑.

例如,假设您要使元素可编辑.为了实现这一目标,这样就足够了:

<div id="editable" contenteditable="true">
    <h1>Inline Editing in Action!</h1>
    <p>The div element that contains this text is now editable.
</div>
Run Code Online (Sandbox Code Playgroud)

通过调用CKEDITOR.inline方法,也可以使用显式代码进行编辑:

<div id="editable" contenteditable="true">
    <h1>Inline Editing in Action!</h1>
    <p>The div element that contains this text is now editable.
</div>
<script>
    // Turn off automatic editor creation first.
    CKEDITOR.disableAutoInline = true;
    CKEDITOR.inline( 'editable' );
</script>
Run Code Online (Sandbox Code Playgroud)