CKeditor-同一页面中的不同预设

CKeditor-同一页面中的不同预设,ckeditor,textarea,preset,Ckeditor,Textarea,Preset,我正在我的网页中使用CKeditor。我想在同一页中设置不同的预设。例如,我想在一个文本区域使用标准CKeditor,在另一个文本区域使用Basic 有人知道我怎么做吗 多谢各位 您需要下载包含您希望在最高级配置中使用的所有插件的CKEditor版本,然后在初始化编辑器时对其进行“修剪”,您希望对其进行更严格的限制 例如,如果您想要一个带有标准预设的编辑器和一个带有基本预设的编辑器,您应该下载带有标准预设的编辑器,因为它将具有基本预设所需的所有插件。然后初始化一个编辑器,无需任何其他配置: CK

我正在我的网页中使用CKeditor。我想在同一页中设置不同的预设。例如,我想在一个文本区域使用标准CKeditor,在另一个文本区域使用Basic

有人知道我怎么做吗


多谢各位

您需要下载包含您希望在最高级配置中使用的所有插件的CKEditor版本,然后在初始化编辑器时对其进行“修剪”,您希望对其进行更严格的限制

例如,如果您想要一个带有标准预设的编辑器和一个带有基本预设的编辑器,您应该下载带有标准预设的编辑器,因为它将具有基本预设所需的所有插件。然后初始化一个编辑器,无需任何其他配置:

CKEDITOR.replace( 'editor-std' );
第二个选项由basic editor使用:

CKEDITOR.replace( 'editor-basic', {
    // Plugins used by basic preset.
    plugins: 'about,basicstyles,clipboard,floatingspace,list,indentlist,enterkey,entities,link,toolbar,undo,wysiwygarea',

    // The toolbar groups arrangement, optimized for a single toolbar row.
    toolbarGroups: [
        { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
        { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'forms' },
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
        { name: 'links' },
        { name: 'insert' },
        { name: 'styles' },
        { name: 'colors' },
        { name: 'tools' },
        { name: 'others' },
        { name: 'about' }
    ],

    // The default plugins included in the basic setup define some buttons that
    // are not needed in a basic editor. They are removed here.
    config.removeButtons: 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript',

    // Dialog windows are also simplified.
    config.removeDialogTabs: 'link:advanced'
} );
您还可以将此配置保存在类似于
config.js
的文件中,您可以在CKEditor主目录中找到该文件,并以如下方式使用它:

CKEDITOR.replace( 'editor-basic', { customConfig: 'config-basic.js' } );
从何处获取预设配置? 没有可供使用的配置,但您可以在存储库中找到所有必要的设置。您会发现,我使用了
basic ckeditor config.js
文件,并使用
basic build config.js
中的插件对其进行了扩展