5

这个问题类似于CKEditor 4 中有哪些工具栏按钮可用?这个老另一个的加强。我在这里补充一些我面临的看法和个人困难。

CKEditor 文档很好,但对于Javascript 程序员(第一次使用 CKEditor 部署者)来说是粉状和“不完整”的,因为“停在中间”......示例:

  • 如果我需要removeButtons,我还需要有效名称列表

  • 如果我需要自定义——通过源代码、更改数组元素——我不仅需要这里的线索和示例,还需要有效名称、语法规则、上下文异常的完整列表,也许还有“官方插件名称”列表.

问题:有一个命令(一个简单的alert(debug))或所有可能名称的记录列表吗?(或所有受控和注册的插件名称、组名称等)


... CKEditor4 被提升为(最好的!)“即插即用”编辑器,但是,对于程序员来说,这是错误的,没有适当的“管理受控名称”支持。

注意:都config.js需要对有效名称的引用,并且没有文档显示我在config.js数组中所做的更改的所有有效名称的列表。这就是程序员所需要的,但是今天(2013 年 8 月)我们需要花费大部分时间使用 Google 来查找有效名称,或者使用浏览器的“元素检查器”来获取有关它的线索。没有名字,在config array没有任何编程任务是简单的。

梦想:对于网页设计师ckeditor.com/download提供了一个很好的“自定义 ckeditor”(!!)。但是对于开发人员来说,没有工具或插图显示“按钮图标和相关名称”,或组名称等......也就是说,“从功能到名称的组织图”(反之亦然)。当然,对于每个地图,我们还需要“上下文异常”,例如不能与内联编辑器一起使用的“源”



更多实际示例,在@Noseratio 和@davidkonrad 评论后编辑)。问题是“每个上下文的有效名称是什么?”

如果我有类似的config东西,

editor.config.toolbarGroups = [
    { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
             ...
    { name: 'styles' },
    { name: 'colors' },
];

我需要更改{ name: 'styles' }为自定义的,例如我需要以下功能:

  { name: 'styles', items : [ 'Styles', 'Format', 'FontSize' ] }

所以,我需要知道所有这些名称,以及何时(上下文)使用这些名称的属性“名称”、“项目”、“组”。如果我在toolbarGroups 属性中使用“items”,或者如果我使用“Fontsize”而不是“FontSize”,则会出现错误。此外,与addButtonCommand其他人一样,我需要知道任何有效参数。定义是错误的,

  addButtonCommand( 'FontSize', lang.underline, 'underline',
                     config.coreStyles_underline );

但是在不知道每个上下文的“所有有效名称列表”的情况下很难工作。


更多实际例子,@MahanGM 评论后编辑)

如果我使用这个 v4 指南和说明相当于这个 v3),我在使用 CKEditor4 和内联编辑器时会遇到“名称问题”:

  • “默认CKEditor工具栏设置”是“完整工具栏”?

  • 如果我去掉“拼写检查器”(旧的 v3 名称“拼写检查器”),为什么不工作?为什么还需要“Scayt”起飞?

  • 内联编辑器可以使用哪些名称?何时使用以及何时使用数组中的项目editor.config.toolbar

  • ......等等......(阅读我的问题:所有问题都是在 上下文中正确选择有效名称)......程序员需要一个“完整的正式规范”,而不仅仅是线索和信息片段。

4

2 回答 2

1

(这不是一个答案,而是一个建议,你可以复制/粘贴来发布你的)

(您也可以在这里进行协作编辑)

“逐项”配置##

您的编辑器将完全按照“工具箱定义”中的方式工作:一个简单的 JavaScript 数组,

config.toolbar = [ G1, G2, ..., GN ];

通过其内容和定义它们的精确位置来控制“工具箱中的每个工具栏”。工具栏定义G i可以是数组或字符串:

  • 当 G i 是一个字符串时,它是条线分隔符, '/';
  • 当 G i是一个数组时,它是一个按钮名称(别名“item”)的序列(别名“group”)。

所以,工具箱定义数组的一般形式是

config.toolbar = [
     ['ITEM11', 'ITEM12', ..., 'ITEM1N'], 'BAR_SEP',
     ['ITEM21', 'ITEM22', ..., 'ITEM2N'], ...
];

其中ITEM i,j是有效的按钮名称。在ABNF中,

 ITEM      =  BUTNAME / "-"
 BUTNAME   = 1*ALPHA      ; and usually a CamelCase name.

2013 年 8 月的配置方案(定义“命名空间”),使用 CKEditor v4:

  1. git clone git://github.com/ckeditor/ckeditor-releases.git

  2. 其他插件较少或代码较少的。

  3. 其他有更多(官方注册的命名空间)插件。

BUTNAMEs 有效的软件上下文:

  • 安装相关插件(见下表“有效 BUTNAME 的完整列表”)(见场景 1、2 或 3);

  • BUTNAME 不在config.removeButtons列表中,相关插件也没有在config.removePlugins;

  • ... BUTNAME 是为该 CKEditor 版本定义的(例如,对 v4 使用“拼写检查器”,对 v3 使用“拼写检查器”)。

所有注册的插件名称

请参阅scenario-1config.plugins ,这是插件的所有有效名称列表(字母顺序):

 a11yhelp,about,basicstyles,blockquote,button,clipboard,contextmenu,dialog,
 dialogui,elementspath,enterkey,entities,eqneditor,fakeobjects,filebrowser,
 find,floatingspace,floatpanel,horizontalrule,htmlwriter,image,indent,
 indentlist,link,list,magicline,maximize,menu,menubutton,panel,pastefromword,
 pastetext,popup,removeformat,resize,save,scayt,showblocks,sourcearea,
 specialchar,tab,table,tabletools,toolbar,undo,wsc,wysiwygarea
 ,... ? ... more?

它们也是“插件”还是“extraplugin”?见场景 3

 texttransform, etc.

PS:使用场景 1。在plugins/ 我们仅有的目录中,

a11yhelp   dialog           icons.png  magicline      specialchar  wsc
about      fakeobjects      image      pastefromword  table
clipboard  icons_hidpi.png  link       scayt          tabletools

###有效 BUTNAME 的完整列表###

所有名称和相关上下文的规范。插件以“-1”或“-3”为后缀,以记住场景的“命名空间”。

BUTNAME                  | PLUGIN            |  Invalid context
-------------------------|-------------------|------------------
Bold                     | default-1         | ?Always ok? no excetions?
Italic                   | default-1         | ...
...                      | ...               | ...
Source                   | default-1         | not works with inline editor
...                      | ...               | ...
TransformTextToUppercase | texttransform-3   | scenario-1
TransformTextCapitalize  | texttransform-3   | scenario-1
...                      | ...               | ...

(如果我们能完成这张表,这个答案就完成了!)

于 2013-08-26T15:08:47.057 回答
0

工具栏配置中的这个对我帮助很大:

// Toolbar configuration generated automatically by the editor based on config.toolbarGroups.
config.toolbar = [
    { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },
    { name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
    { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
    { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
    '/',
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
    { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl', 'Language' ] },
    { name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
    { name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
    '/',
    { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
    { name: 'colors', items: [ 'TextColor', 'BGColor' ] },
    { name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
    { name: 'others', items: [ '-' ] },
    { name: 'about', items: [ 'About' ] }
];

// Toolbar groups configuration.
config.toolbarGroups = [
    { name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
    { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
    { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
    { name: 'forms' },
    '/',
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
    { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
    { name: 'links' },
    { name: 'insert' },
    '/',
    { name: 'styles' },
    { name: 'colors' },
    { name: 'tools' },
    { name: 'others' },
    { name: 'about' }
];

在自己的初始化中使用时:

CKEDITOR.replace( 'topicMessageInput', {
        toolbar: [
                { name: 'document', groups: [ 'mode', 'document', 'doctools' ], items: [ 'Source', '-', 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },
                { na..

希望能帮助到你。

于 2015-06-01T23:27:08.937 回答