0

I'm trying to put alignment buttons (left, center, right, justify) behind a single button in the TinyMCE v6 toolbar. I know that I can use editor.ui.registry.addSplitButton() to define the button with a static icon with properties text: "", title: "Text alignment menu", icon: "...".

However, I would want the menu icon to reflect the current status. When text caret is moved in left aligned text, I'd want he menu icon to have the left-aligned text icon and when text caret is moved to centered text, the icon should have centered text icon. And the button action should toggle that alignment on and off and the split feature would allow changing the alignment further.

However, I cannot see anything to dynamically change the menu button in TinyMCE v6. How to change the split button icon in the toolbar when caret is moved?

(I'm looking for a generic answer where the menu opened with the button could also contain additional items to the default alignment options, too.)

Mikko Rantalainen
  • 14,132
  • 10
  • 74
  • 112

0 Answers0