troubleshooting Question

How to add submenu to Tinymce v5.8 Splitbutton dropdown list

Avatar of Al230762
Al230762Flag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingJavaScript
3 Comments1 Solution15 ViewsLast Modified:
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.
  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);
                     }
                 });

Open in new window

ASKER CERTIFIED SOLUTION
Alfredo Luis Torres Serrano
Senior Net Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>

Mike

Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004