How to put a dedicated Insert and Excecute Macro Button on the CKEDITOR tool bar?

First some experiences:

The document

describes how to put an additional button to editor tool bar.

It is not so complex, but there some pitfalls:

edit the object “CKEditor.ConfigClass” in CKEditor.Config
where the used commandId key must be found in the two css-declarations
of the XWiki.StyleSheetExtension object like

    > span.cke_button_icon.cke_button__xwiki-macro-html-dirty_icon {
... }

   > span.cke_button_icon.cke_button__xwiki-macro-html-dirty_icon {

You need lower cases!
There are some doubled underline characters!
Don’t forget to activate the parameter Load JavasScript Skin Extension in the Object.

The CKEditor uses the font-family: ‘Glyphicons Halflings’.
To keep the editor’s design consistent, one should continue to use this font

A little help - the following code generates some tables of available characters:

(% style="font-family:'Glyphicons Halflings';font-size:250%" %)
          "e0","e1","e2"]                                              // private use of unicode
outerhex.each{ t -> 
R+="<table class='table-bordered' style='width:auto'><tr><td style='text-align:right;background-color:grey'>x=</td>"
  hex.each{k-> R+="<td style='background-color:lightgray;text-align:center'><b >"+k+"</td>"}
  hex.each{i -> 
     R+="<tr><td style='background-color:lightgray'><b>"+t+i+"x</b></td>"
     hex.each{ j->  R+= "<td style='text-align:center'>&#x"+t+i+j+";</td>"
  R += "</table><br/>"
R + "{{/html}}"

Back to the question:

The new button will open a modal window to modify the macro parameter.

But how to define a button that will execute the macro with the given defined parameter at once?

The standard “table of content” does.

Thanks for help


Where can I find the CKEditor.Config file?


or change the link that it ends with
or to start the object editor

It’s not doable from configuration, ATM, but you can do it from a custom plugin (or some JavaScript code that executes right before the editor is loaded). The Macro plugin provides an editor command to insert macros directly. Try this from the JavaScript console:

CKEDITOR.instances.content.execCommand('xwiki-macro-insert', {
  name: 'info',
  parameters: {
    title: 'Foo'
  content: 'bar'

So what you need to do is similar to but using the xwiki-macro-insert command instead of xwiki-macro.

It should be easy to add a flag to the data passed to config['xwiki-macro'].insertButtons configuration to choose between inserting directly or through the wizard (the current behavior). Please report an issue on