David Rudlin
asked on
How to add submenu to Tinymce v5.8 Splitbutton dropdown list
Using Tinymce v5.8 in a asp.net web application. I have added a splitbutton component to the toolbar and successfully added items to the splitbutton's dropdown list. Is there now a way to add a submenu to the list?
I have tried the attached code but the submenu does not appear. I guess that the "type: 'submenu' may be causing the issue but can find no documentation on this or could be that submenus simply are not a feature of this component. Any help or suggestions would be gratefully received.
I have tried the attached code but the submenu does not appear. I guess that the "type: 'submenu' may be causing the issue but can find no documentation on this or could be that submenus simply are not a feature of this component. Any help or suggestions would be gratefully received.
editor.ui.registry.addSplitButton('myButton', {
text: 'My Button',
icon: 'info',
tooltip: 'This is an example split-button',
onAction: function () {
//editor.insertContent('<p>You clicked the main button</p>');
},
onItemAction: function (api, value) {
editor.insertContent(value);
},
fetch: function (callback) {
var items = [
{ type: 'choiceitem', text: 'One', value: 'one ' },
{ type: 'choiceitem', text: 'Two', value: 'two ' },
{
type: 'submenu', text: 'Submenu', items: [
{ type: 'choiceitem', text: 'Three', value: 'three' }
]
}
];
callback(items);
}
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Alfredo. This helped. Some of the syntax and methods needed updating in line with version 5 and there was considerable work required in getting data to populate the menu items and also the nested menu items.
ASKER
Open in new window