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

标签 ckeditor

我在 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/

相关文章:

jquery - 将使用CKEditor在表单中输入的数据保存到MySQL数据库

css - @font-face 添加到 ckeditors contentsCSS 可以选择内联在结果 html 中吗?

drop-down-menu - 如何在窗口中正确显示 CKEditor 4.0 工具栏下拉菜单和其他弹出窗口?

ckeditor - 更改CKEditor工具栏按钮的默认图标

asp.net - 用于 asp.net 的文件管理器 CKEditor

javascript - 调整 CKEditor 的大小

javascript - 如何限制ckeditor中的编辑区域?

javascript - CKEditor 插件 - 如何使用 editor.applyStyle 在跨度内包含跨度

javascript - bbcode ckeditor 对齐插件

jquery - 使用 jQuery 从 CKEditor 的 iframe 中获取内容