如何理解CKEditor4的“正当化".选项? [英] How to understand CKEditor4's "justify" option?

查看:88
本文介绍了如何理解CKEditor4的“正当化".选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过以下链接集成了最新版本的CKEditor 4标准版(在撰写本文时为v4.15):

I integrate the latest version of the CKEditor 4 Standard Version (v4.15 at the time of writing) via this link:

https://cdn.jsdelivr.net/npm/ckeditor4/ckeditor.js

根据定义,CKEditor 4标准版不包括"Justify"标签.插件,负责根据预设对文本进行对齐(左,右,居中,对齐)-至少在我的理解下:

By definition, the CKEditor 4 Standard Version does NOT include the "Justify" plugin, which is responsible for aligning text (left, right, center, justify) - at least to my understanding – according to the presets:

https://ckeditor.com/cke4/builder

实际上,如果我使用对齐规则配置设置,则CKEditor将无法识别它们:

And indeed, if I configure my setup with align rules, CKEditor won't recognise them:

CKEDITOR.toolbar = [
  [ 'Undo', 'Redo' ],
  [ 'Link', 'Unlink', 'Anchor' ],
  [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight' ], // <= not recognised
  [ 'Bold', 'Italic', 'Underline', 'Strike' ],
  [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ],
  '/',
  [ 'SpecialChar' ],
  [ 'Source', '-', 'RemoveFormat' ],
  [ 'About' ]
]

但是,一旦我启用证明"在额外插件"中配置选项:

However, as soon as I enable "justify" in the "extraPlugins" config option:

CKEDITOR.extraPlugins = "divarea,justify"

上面提到的align选项可以识别并且可以很好地工作(尽管,正如已经提到的,CKEDITOR 4 Standard Version Preset并没有实现该插件).

the align options mentioned above ARE recognised and work perfectly fine (even though, as already mentioned, the CKEDITOR 4 Standard Version Preset does not implement that very plugin).

我知道有一个"stylecombo"插件,但默认情况下该插件已被激活,并且似乎无法单独识别对齐功能.

I know that there is a "stylecombo" plugin, but that one is activated by default and seems not to be able to recognise the align features by itself.

我认为,合理化"插件不起作用,抛出错误并忽略所有对齐配置.但是事实并非如此……

In my opinion, the "justify" plugin should not work, throw an error and ignore any alignment configurations. But that's not the case...

另一方面,当我尝试添加上标"时,和下标"

On the other hand, when I try to include "Superscript" and "Subscript"

[ 'Bold', 'Italic', 'Underline', 'Strike', 'Superscript', 'Subscript' ],

应由"basicstyles"支持插件,无法识别.在这里,我假设这些按钮将显示在编辑器中.

which should be supported by the "basicstyles" plugin, they are NOT recognised. Here I was assuming that these button would be displayed in the editor.

请问有人可以帮助我找出我的误解吗?谢谢!

Can anybody help me find out, what I am misunderstanding here, please? Thank you!

推荐答案

JSDeliver直接提供NPM软件包,因此在这种情况下,您基本上可以获得 NPM ckeditor4 软件包.在这里,您几乎可以正确使用 standard 预设,但是对于NPM ckeditor4 软件包,它提供了 standard-all 预设.区别在于自述文件描述:

JSDeliver provides NPM packages directly, so in this case you basically get NPM ckeditor4 package. And here, you are almost right on the standard preset, however in case of NPM ckeditor4 package it provides standard-all preset. And the difference is as README describes:

CKEditor 4 npm软件包包含所有标准配置,因此它包括所有官方CKEditor插件,以及标准程序包默认处于活动状态.

因此,这意味着 Justify 插件已包含在软件包中,但默认情况下不处于活动状态.要激活它,您只需使用 extraPlugins 配置选项.

So this means Justify plugin is included in the package but not active by default. And to activate it you just need to use extraPlugins configuration option as you mentioned.

主要是为了方便起见,因此激活更多插件就像更改编辑器配置一样简单,而无需添加其他软件包.

This is mostly done for convenience so activating more plugins is as simple as changing editor configuration without a need to add additional packages.

这篇关于如何理解CKEditor4的“正当化".选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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