CKEditor 4 - 如何将字体系列和字体大小控件添加到工具栏

Roy*_*ang 10 ckeditor

我在config.js中有一个config.toolbarGroups设置,但我不知道用于组添加字体系列/字体大小控件的名称.(似乎缺乏这方面的文件).我发现一些建议我应该使用CKBuilder来创建一个已经包含它的软件包,但我不能重新部署整个ckeditor只是为了添加几个按钮.

编辑:我的CKEditor是版本4

有什么建议吗?

谢谢!

Har*_*old 13

config.extraPlugins = 'font';
Run Code Online (Sandbox Code Playgroud)

你必须添加插件...


小智 5

有两种(互斥)配置工具栏的方法。查看以下内容:

http://ckeditor.com/latest/samples/plugins/toolbar/toolbar.html

我尝试先使用config.toolbarGroups,但最终使用了config.toolbar。这是我最终使用的内容:

config.toolbar = [
                { name: 'save', items: [ 'savebtn','Undo','Redo' ] },
                { name: 'clipboard', items: [ 'Cut','Copy','Paste','PasteText','PasteFromWord'] },
                { name: 'document', items: [ 'Find','Replace'] },
                '/',
                { name: 'lists', items: [ 'NumberedList','BulletedList','Outdent','Indent'] },
                { name: 'insert', items: [ 'Image','Table','Smiley','SpecialChar'] },
                { name: 'link', items: ['Link','Unlink'] },
                '/',
                { name: 'basicstyles', items: [ 'Font','FontSize','Bold','Italic','Underline','Strike','Subscript','Superscript'] },
                //'/',
                { name: 'align', items: [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'] }
        ];
Run Code Online (Sandbox Code Playgroud)

请注意,我使用的是由kasper Taeymans慷慨贡献的保存插件,可以在以下位置找到该插件:

如何在CKeditor 4.2.1中添加带有加载gif的ajax保存按钮。[正在工作的示例插件]

我还发现以下文档确实有用,即使它与版本3有关:

http://docs.cksource.com/CKEditor_3.x/Developers_Guide/工具栏

我使用了本文中的信息来生成我的配置(我正在使用4.2.1版),特别是项目的名称(例如,剪切,复制,粘贴),因为这是我所缺少的链接。