我在 config.js 中有一个 config.toolbarGroups 设置,但我不知道组使用什么名称来添加字体系列/字体大小控件。 (似乎缺乏这方面的文档)。我发现了一些建议,我应该使用 CKBuilder 创建一个已经包含它的包,但是我不能仅仅为了添加几个按钮而重新部署整个 ckeditor。
编辑:我的 CKEditor 是第 4 版
有什么建议吗?
谢谢!
最佳答案
有两种(互斥的)配置工具栏的方法。查看以下内容:
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'] }
];
请注意,我正在使用由 kasper Taeymans 慷慨提供的保存插件,可在以下位置找到:
How to add an ajax save button with loading gif to CKeditor 4.2.1. [Working Sample Plugin]
我还发现以下文档非常有用,即使它与版本 3 相关:
http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Toolbar
我使用本文中的信息来生成我的配置(我使用的是 4.2.1 版),特别是项目的名称(例如剪切、复制、粘贴),因为在我的情况下这是缺失的链接。
关于CKEditor 4 - 如何向工具栏添加字体系列和字体大小控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16184236/