Javascript 如何关闭CKEditor 4.6的插件?

Javascript 如何关闭CKEditor 4.6的插件?,javascript,ckeditor,ckeditor4.x,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: '

对于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.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' ] }
    ]
});

然而,当我在CKEditor 4.6的config.js中搜索这些时,它们就不见了。由于我需要在我的网站的不同部分有不同的插件,我不想使用在线自定义生成器。我应该在哪里添加/删除插件?

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

    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.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' ] }
    ]
});
您可以在网页内选择工具栏中显示的项目,如下所示:

    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.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' ] }
    ]
});

您可以在此处看到插件的名称:


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

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

    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.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' ] }
    ]
});
您可以在网页内选择工具栏中显示的项目,如下所示:

    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.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' ] }
    ]
});

您可以在此处看到插件的名称:


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

有许多方法可用于设置CKEditor配置,您可以在文档中阅读有关它们的更多信息。这里的主要问题是您正在更改默认CKEditor配置文件(
config.js
)的内容,每次升级都会覆盖您所做的更改。要避免这种情况,请使用或。

设置CKEditor配置的方法有很多,您可以在文档中阅读有关它们的更多信息。这里的主要问题是您正在更改默认CKEditor配置文件(
config.js
)的内容,每次升级都会覆盖您所做的更改。要避免这种情况,请使用或。

这样可以解决问题,但想知道在配置文件中是否有这样做的方法?以前我有一些针对不同情况的配置文件。更重要的是,由于它们最初是在config.js中设置的,现在它们已经不存在了,有没有办法获取插件的名称?您可以在这里看到插件的名称:另外,在,您可以检查列出组和项目的基本和高级配置器类型,并将它们复制到您的配置文件中。太好了。如果您将这些添加到您的答案中,将标记为正确。这解决了问题,但想知道在配置文件中是否有这样做的方法?以前我有一些针对不同情况的配置文件。更重要的是,由于它们最初是在config.js中设置的,现在它们已经不存在了,有没有办法获取插件的名称?您可以在这里看到插件的名称:另外,在,您可以检查列出组和项目的基本和高级配置器类型,并将它们复制到您的配置文件中。太好了。如果您将这些添加到您的答案中,将标记为正确。问题是,该设置不会被覆盖,而是会消失。我不介意重新配置,但当我把上面的行放在那个位置时,它就不起作用了。问题是,设置没有被覆盖,而是消失了。我不介意重新配置,但当我把上面的线放在那个位置时,它就是不工作。