Javascript 带有config.extraPlugins的CKEditor自定义工具栏

Javascript 带有config.extraPlugins的CKEditor自定义工具栏,javascript,editor,ckeditor,Javascript,Editor,Ckeditor,我目前使用的是CKEeditor 4,我使用的是config.js中设置的自定义工具栏,但我还想添加justify插件。Justify插件与标准编辑器配合使用,但当我指定自定义工具栏时,我无法将其包括在内 我可以看到的区别是默认工具栏使用工具栏组,在这种情况下,我在“段落”组中添加了“对齐” 自定义工具栏使用名称/项目(我无法让它与组一起工作),我尝试使用“对齐”、“对齐”、“对齐”、“对齐”、“对齐”等。。。没有显示对齐按钮 下面是config.js的特定部分 config.toolbarGr

我目前使用的是CKEeditor 4,我使用的是config.js中设置的自定义工具栏,但我还想添加justify插件。Justify插件与标准编辑器配合使用,但当我指定自定义工具栏时,我无法将其包括在内

我可以看到的区别是默认工具栏使用工具栏组,在这种情况下,我在“段落”组中添加了“对齐”

自定义工具栏使用名称/项目(我无法让它与组一起工作),我尝试使用“对齐”、“对齐”、“对齐”、“对齐”、“对齐”等。。。没有显示对齐按钮

下面是config.js的特定部分

config.toolbarGroups = [
    { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
    { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
    { name: 'links' },
    { name: 'insert' },
    { name: 'forms' },
    { name: 'tools' },
    { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
    { name: 'others' },
    '/',
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
    { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align' ] },
    { name: 'styles' },
    { name: 'colors' },
    { name: 'about' }
];


config.toolbar = 'ToolsNoImage';
config.toolbar_ToolsNoImage =
[
    { name: 'document', items : [ 'mode', 'document', 'doctools' ] },
    { name: 'clipboard', items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
    { name: 'editing', items : [ 'Find','Replace','-','SelectAll','-','Scayt' ] },
    { name: 'links', items : [ 'Link','Unlink','Anchor' ] },
    { name: 'insert', items : [ 'Table','HorizontalRule','SpecialChar','PageBreak'] },
    { name: 'tools', items : [ 'Maximize' ] },
    { name: 'tools', items : [ 'Source', '-', 'Preview' ] },
    '/',
    { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] },
    { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','Align' ] },
    { name: 'styles', items : [ 'Styles','Format' ] },
    { name: 'tools', items : [ 'About' ] }

];


config.toolbarCanCollapse = true;
config.toolbarStartupExpanded = true;
config.extraPlugins = 'justify';
config.extraPlugins_ToolsNoImage = 'justify';

我觉得事情很简单。。案例问题等等。

其实很简单:D您使用了错误的按钮名称。该组名为
'align'
,但按钮
'JustifyLeft','justifCenter','justifRight','justifBlock'
不是
'align'
(您在配置中使用了此名称)

此外,这不会产生任何影响:

config.extraPlugins_ToolsNoImage = 'justify';
这是不必要的:

config.extraPlugins = 'justify';
但最重要的是按钮名称:)


顺便说一句,每个CKEditor包中都有一个
plugins/toolbar/samples/toolbar.html
sample-它可以帮助您找到正确的名称。

它非常简单,确实:D您使用了错误的按钮名称。该组名为
'align'
,但按钮
'JustifyLeft','justifCenter','justifRight','justifBlock'
不是
'align'
(您在配置中使用了此名称)

此外,这不会产生任何影响:

config.extraPlugins_ToolsNoImage = 'justify';
这是不必要的:

config.extraPlugins = 'justify';
但最重要的是按钮名称:)


顺便说一句,在每个CKEditor包中都有一个
插件/toolbar/samples/toolbar.html
示例-它可以帮助您找到正确的名称。

只需使用以下内容自定义CKEditor工具栏以对齐和对齐

config.toolbar = [
        {name: "paragraph", 
         items: ["NumberedList", "BulletedList","Outdent","Indent","Blockquote","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]
        }
    ];
有关工具栏中的进一步自定义,您可以参考此页面,只需编辑config.js:


只需使用以下命令,即可自定义用于对齐和对齐的编辑器工具栏

config.toolbar = [
        {name: "paragraph", 
         items: ["NumberedList", "BulletedList","Outdent","Indent","Blockquote","JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"]
        }
    ];
有关工具栏中的进一步自定义,您可以参考此页面,只需编辑config.js:


这适用于像我一样努力启用对齐/对齐选项的任何人。 如hanji所建议,要启用,需要执行以下操作:


config.extraPlugins:'justify'

这适用于像我一样努力启用对齐/对齐选项的任何人。 如hanji所建议,要启用,需要执行以下操作:

config.extraPlugins:'justify'