New items added to the rich text editor only loads if initial load state is in visual mode

I’m extending the RTE by adding some new macros as menu sub items here:

I used this tutorial as basis to code my js file: Extending the rich text editor in JIRA

The current behavior:

If I load it with the tab initially in Visual Mode, the macros are added. Switching tabs after have no problem. However, if I load it with the tab initially in Text Mode, the macros are NOT added. Switching tabs have no effect.

I have added a listener like so:

editorRegistry.on('register', function(entry) {
 // code adding the macro as sub-menu items

Debugging it shows that the editor registry triggers the register event accordingly:

  • Visual Mode - triggers the register event AFTER it enters the above-mentioned code, thus successfully adding the items
  • Text Mode - triggers the register event BEFORE it enters the above-mentioned code

Can someone assist me on how to have the Text Mode scenario have the same behavior as Visual Mode?

Thank you.

1 Like