Question

I want to create a Listbox with a submenu but I don't know how to make a submenu. The documentation on TinyMCE is crappy so that is why I ask it here.

This is my code:

editor.addButton('OwnStyling', {
    type: 'listbox',
    text: 'Stylesheet',
    icon: false,
    onselect: function(e) {
        editor.insertContent(this.value());
    },
    values: [
            {text: 'Menu item 1', value: 'Some text 1'},
            {text: 'Menu item 2', value: 'Some text 2'},
            {text: 'Menu item 3', value: 'Some text 3'}
    ],
    onPostRender: function() {
        // Select the second item by default
    }
});

At the place of the values I want to make a subitem with his own values. Anyone knows how to do that?

Thank already!!

Était-ce utile?

La solution

Try something like

{text:'Menu item', menu:[{text:'submenu1',value:'some value'},{text:'submenu2',value:'some value'}]}

For me it works on contextmenu but didn't try it on listbox!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top