javascript - 如何关闭 CKEditor 4.6 的插件?

标签 javascript ckeditor ckeditor4.x

对于 CKEditor 4.4,在 config.js 中,将有一个部分用于选择要使用的插件以及它们应如何分组。

类似这样的事情:

    config.toolbar = [
        { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
        { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
        { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
        '/',
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
        { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
        { name: 'links', items: [ 'Link', 'Unlink', 'Anchor', 'magicformcustom' ] },
        { name: 'insert', items: [ 'Table', 'HorizontalRule', 'SpecialChar'] },
        { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
    ];

    // Toolbar groups configuration.
    config.toolbarGroups = [
        { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
        { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'styles' },
        '/',
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
        { name: 'links' },
        { name: 'insert' },
        { name: 'colors' }
    ];

但是,当我在 CKEditor 4.6 的 config.js 中搜索这些内容时,它们消失了。由于我需要在网站的不同部分使用不同的插件,因此我不想使用在线自定义构建器。我应该在哪里添加/删除插件?

最佳答案

当您实例化 CKEditor 时,您可以在网页中添加/删除插件,如下所示:

CKEDITOR.replace('editor1', {
    extraPlugins: 'iframedialog,uploadimage,divarea,youtube',
    removePlugins: 'pastetext,pastefromword'
});

您可以在网页内选择工具栏中显示的项目,如下所示:

CKEDITOR.replace('editor1', {
    toolbar: [
        { name: 'document', items: [ 'Source', 'Save' ] },
        { name: 'clipboard', items: [ 'Undo', 'Redo' ] },
        { name: 'editing', items: [ 'SelectAll' ] },
        { name: 'basicstyles', items: [ 'Bold', 'Italic', '-', 'RemoveFormat' ] },
        { name: 'paragraph', items: [ 'NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight' ] },
        { name: 'insert', items: [ 'Image', 'Table', 'Smiley' ] },
        { name: 'styles', items: [ 'Font', 'FontSize' ] },
        { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
        { name: 'tools', items: [ 'Maximize' ] }
    ]
});

您可以在此处查看插件的名称:https://github.com/ckeditor/ckeditor-dev/tree/master/plugins

此外,在Toolbar Configurator中,您可以检查基本和高级配置器类型,其中列出了组和项目并将它们复制到您的配置文件中。

关于javascript - 如何关闭 CKEditor 4.6 的插件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40903577/

相关文章:

javascript - 如何将输出放入文本区域? (JavaScript)

javascript - 如果使用 Selenium-webdriver 和 Java 在 div 中定义了 SELECT 列表,如何单击选项

javascript - 更新 moment.js 持续时间

javascript - CKEDITOR.config.allowedContent true 不工作

javascript - 如何在 CKEDITOR 的数据库中保存图像源时使用绝对 URL

javascript - CKEditor 图标路径不是 URLEncoded

javascript - 单击不导航时,超链接在 ckeditor 中不起作用

javascript - 在 JavaScript 数组中找到唯一唯一值的最佳方法是什么

vue.js - VUE 中的 CKEditor5 自定义构建

javascript - CKEditor 媒体嵌入