CKEditor 4-如何向工具栏添加字体系列和字体大小控件 [英] CKEditor 4 - how to add font family and font size controls to the toolbar

查看:934
本文介绍了CKEditor 4-如何向工具栏添加字体系列和字体大小控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a config.toolbarGroups setting in config.js but I don't know what name to use for the groups to add font family/font size controls. (It seems the documentation is lacking in this regard). I've found some suggestion that I should use CKBuilder to create a package that already includes it, but I can't redeploy the entire ckeditor just to add a couple of buttons.

编辑:我的CKEditor是版本4

My CKEditor is version 4

有什么建议吗?

谢谢!

推荐答案

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

There are two (mutually exclusive) ways to configure the toolbar. Check out the following:

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

我尝试先使用config.toolbarGroups,但是最终改为使用config.toolbar。这是我最终使用的东西:

I tried to use config.toolbarGroups first, but ended up using config.toolbar instead. Here's what I ended up using:

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慷慨贡献的保存插件,可以在以下位置找到以下位置:

Note that I am using a save plugin that was generously contributed by kasper Taeymans, which can be found at the following location:

如何在将gif加载到CKeditor 4.2.1中时添加ajax保存按钮。 [工作示例插件]

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

I also found the following document to be really useful, even though it related to version 3:

http://docs.cksource.com/CKEditor_3。 x / Developers_Guide / Toolbar

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

I used the information in this article to produce my configuration (I'm using version 4.2.1), specifically the names of the items (e.g. Cut, Copy, Paste), as this was the missing link in my case.

这篇关于CKEditor 4-如何向工具栏添加字体系列和字体大小控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆