CKEditor 4:如何强制“框架”模式

时间:2017-12-04 14:54:52

标签: ckeditor ckeditor4.x

自动CKEditor使用“内联”模式,而我想使用“框架”模式。

在我的情况下会发生这种情况,即使阅读文档似乎不正常,我也可能做错了。

我有一个简单的textarea,我也尝试添加contenteditable属性,但没有成功。

<textarea name="text" class="form-control wysiwyg editor" id="text" rows="10" contenteditable="false"></textarea>

这是我初始化编辑器的代码:

$(function () {
    $('.editor.wysiwyg').each(function () {
       CKEDITOR.disableAutoInline = true;
        CKEDITOR.replace(this.id, {
            disableNativeSpellChecker: false,
            fontSize_sizes: '10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;30/30px;',
            height: 375,
            image2_alignClasses: [ 'float-left', 'text-center', 'float-right' ],
            insertpre_class: false,
            removeButtons: 'Font',
            removeDialogTabs: false,
            tabSpaces: 4,
            toolbarCanCollapse: true,
            toolbarGroups: [
                { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
                { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
                { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
                { name: 'links' },
                { name: 'insert' },
                { name: 'forms' },
                { name: 'tools' },
                { name: 'others' },
                '/',
                { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
                { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
                { name: 'styles' },
                { name: 'colors' },
                { name: 'about' }
            ],
        });
    });
});

我已阅读文档的thisthis page,但我没有找到任何有用的内容。

我正在使用jQuery适配器。

我该怎么办?谢谢。

1 个答案:

答案 0 :(得分:0)

解决。

问题是由divarea插件引起的。相反,我们需要使用IFrame Editing Area插件。

事实上,在插件页面中解释说:

  

这是经典的基于iframe的编辑器的核心功能,只有在替代插件(例如Div编辑区)回填或者仅使用内联编辑器时才能禁用它。

太糟糕了,文档中没有解释这一点(如何向谁负责文档报告?)。

所以我确保使用正确的插件,然后使用removePlugins配置选项禁用divarea插件。