内联CKEditor工具栏没有针对h2元素的对齐按钮 [英] Inline CKEditor toolbar has no alignment buttons for h2 elements
问题描述
(也在其演示页上 http://ckeditor.com/demo#inline )
为什么会这样?即使我采用他们的内联示例( http:/ /nightly.ckeditor.com/13-02-08-08-51/standard/samples/inlineall.html )并删除标题栏的单独工具栏的js代码,但我仍然没有获得对齐选项
Why is this the case? Even if I take their inline sample (http://nightly.ckeditor.com/13-02-08-08-51/standard/samples/inlineall.html) and remove the js code for separate toolbars for heading blocks, I still don't get the alignment option.
我想为用户提供对齐标题的选项。我想念什么?
I'd like to give users the option to align headings. What am I missing?
我也没有得到BulletedList之类的其他阻止选项,但这没什么问题。
I'm also not getting other "block" options like BulletedList, but that's less of an issue.
更新:要重复该问题,您需要将contenteditable = true应用于标题元素。因此,一种解决方法是将标题与contenteditable = true一起包装在div中。但这对我的情况无济于事。
UPDATE: To repeat the issue you need to have contenteditable="true" applied to a heading element. So, one fix is to wrap the heading in a div with the contenteditable="true". But this doesn't help my case.
推荐答案
自CKEditor 4起,您需要Justify插件。
You need the Justify plugin since CKEditor 4.
- 在此处下载Justify插件
- 将其粘贴到ckeditor / plugins /
- 将插件添加到您的ckeditor中。
这是JavaScript代码:
Here is the javascript code :
$(function() {
CKEDITOR.config.extraPlugins = 'justify';
});
您无事可做,Justify插件将自动添加到段落
工具栏组
You don't have anything more to do, Justify plugin will be automatically added to the paragraph
toolbarGroup
编辑
通过 alignment
,我以为您在谈论 right | center | left
对齐。
By alignment
, I thought you were talking about right|center|left
align.
在这里,对于h标签,我们有这些组:
Here, for h tags, we've got those groups :
if ( element.is( 'h1', 'h2', 'h3' ) || element.getAttribute( 'id' ) == 'taglist' ) {
editor.on( 'configLoaded', function() {
editor.config.removePlugins = 'colorbutton,find,flash,font,' +
'forms,iframe,image,newpage,removeformat,scayt,' +
'smiley,specialchar,stylescombo,templates,wsc';
editor.config.toolbarGroups = [
{ name: 'editing', groups: [ 'basicstyles', 'links' ] },
{ name: 'undo' },
{ name: 'clipboard', groups: [ 'selection', 'clipboard' ] },
{ name: 'about' }
];
});
}
['basicstyles','links','撤消,选择,剪贴板,关于]
,没有 align
组,只需添加即可。
['basicstyles', 'links', 'undo', 'selection', 'clipboard', 'about']
, there's no align
group, simply add it.
安装新的CKEditor之后,您不必进行任何修改,该组已经处于内联基本配置中
You don't event have to modify anything after a new CKEditor install, this group is already in the inline basic configuration
这篇关于内联CKEditor工具栏没有针对h2元素的对齐按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!