How to Display Listbox in TinyMCE Window onselect

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.

Related posts

1 comment

Comments are closed.