Control exposed macros in the CKEditor Insert menu

Hello.

Using XWiki 14.10.19.

I’ve been looking for a way to define which macros are available when clicking on the Insert button.
image

The closest I have found was this page: https://extensions.xwiki.org/xwiki/bin/view/Extension/CKEditor%20Integration/Customization/#HPutDedicatedInsertMacroButtonsontheToolBar but this is to add them directly at the top-level, I’m just looking at customizing what the available options in this menu are, particularly because we’ve had more luck with the “display” macro, while the “include” macro is causing problems with images for the way we use it.

1 Like

+1

We have the Pro Macros now and want to highlight/recommend specific ones to our users. That and the ‘Other macros’ list is quite extensive (not a bad thing at all!) and I think most of our users will probably not know which ones to use.

While you wait for better, more complete replies, I was once pointed to this page for several information about the plugin: https://extensions.xwiki.org/xwiki/bin/view/Extension/CKEditor%20Integration/

HTH

I don’t know if it’s possible right now (cc @mflorea who should know) but it would indeed be an interesting feature to add if it’s not already possible.

Thanks

Hi,

The insert button drop-down is controlled by two configuration properties:

  • toolbarMenuItems: you first need to define a “toolbar menu item” for the macros you want to expose. Check the examples:

    infoBox: {
      command: 'xwiki-macro-insert',
      data: {
        name: 'info',
        content: 'Type your information message here.',
        parameters: {...}
      }
    },
    

    As you can see you can specify both the macro content and parameters (preset the values). For the command you have two options:

    • xwiki-macro-insert: insert the macro directly
    • xwiki-macro: open the macro wizard
  • toolbarMenus: you need to modify the “insert” menu

Both of these can be modified from the CKEditor administration section, but I think you need to set the entire value, i.e. you need to copy the current value and modify it (you can’t just add a new menu item).

Hope this helps,
Marius

1 Like

@mflorea I don’t know if it’s ok for you, but I’ve added this section in the doc: https://extensions.xwiki.org/xwiki/bin/view/Extension/CKEditor%20Integration/Customization/#HCustomizethewell-knownmacrolist

Feel free to improve it.

Thanks for your answer.

1 Like