I’m trying to show a hidden listbox in the TinyMCE window. I want to show the listbox after the user selects an option. Currently I have it to show another popup window in the onselect function. Here is what I have so far.
tinymce.PluginManager.add('newbutton', function( editor, url ) {
editor.addButton( 'newbutton', {
title: 'Button',
text: 'Here is the button',
onclick: function() {
editor.windowManager.open({
title: 'Choose From Listbox 1',
body: [
{
type: 'listbox',
name: 'vals',
label: 'Choose Vals',
values: listvals,
onselect: function(e){
//I want to show another listbox on the same body
editor.windowManager.open({
title: 'Choose',
body: [
{
type: 'listbox',
name: 'List',
label: 'Choose Style:',
values: fonts,
onselect: function(e){
style = this.value();
}
}
]
})
}
}
],
onsubmit: function(e){
}
})
}
});
});
I would like the same functionality but instead of popping open another window I would like to just show a second listbox on that same window.
Guess to accomplish that, you’d need to nest the listbox into the editor’s toolbar and bind it’s change event to a function (unless wanting to attach it somewhere else, the toolbar is most likely where it should belong). for example: Guide to Creating Your Own WordPress Editor Buttons