Where the list of all toolbar button names and group names available in CKEditor 4?

此生再无相见时 提交于 2019-11-30 15:36:09

(this is not an answer but a suggestion for it, you can copy/paste to post yours)

(you can also colabore editing here)

"Item by Item" Configuration

Your editor will work exactly as in your "toolbox definition": a simple JavaScript array,

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

controlling "every single toolbar in the toolbox" by its contents and by defining their precise position. The toolbar definitions, Gi, can be arrays or strings:

  • When Gi is a string, it is the bar-line separator, '/';
  • When Gi is an array, it is a sequence (alias "group") of button names (alias "item").

So, the general form of the toolbox definition array is

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

where ITEMi,j is a valid button name. In ABNF it is,

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

Scenarios (that define "namespaces") of configuration at August 2013, with CKEditor v4:

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

  2. Other that have less plugins or less code.

  3. Other that have more (oficially registered namespace) plugins.

Software context where the BUTNAMEs are valid:

  • the associeated plugin (see below the table of "Full list of valid BUTNAMEs") is installed (see scenarios 1, 2 or 3);

  • the BUTNAME is not at config.removeButtons list, neither the associated plugin removed at config.removePlugins;

  • ... the BUTNAME is defined for that CKEditor version (ex. use 'spellchecker' for v4 and 'SpellChecker' for v3).

All registered plugin names

See config.plugins in the scenario-1, this is the list of all valid names for plugins (alphabetic order):

 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?

They are also "plugin" or are "extraplugin"? See scenario-3:

 texttransform, etc.

PS: with scenario-1. at the plugins/ directory we have only,

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

Full list of valid BUTNAMEs

Specification of all names and related contexts. The plugins are sufixed by "-1" or "-3" to remember the scenario's "namespace".

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
...                      | ...               | ...

(this answer will be complete if we can complete this table!)

This one from Toolbar Configuration helped me a lot:

// 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' ] }
];

and

// 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' }
];

when using in own init:

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

Hope it helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!