I am sorry if this has been asked or it is somewhere on the internet but I just couldn't find anything helpful I have a TinyMCE plugin which when clicked shows up a container with a text box and a listbox in whcih i want to select my text's style. How can i attach the selected css to my text I am using the wordpress post/page editor and just adding my plugins with buttons

(function() {
    tinymce.PluginManager.add('subscribe_button1', function( editor, url ) {
        editor.addButton( 'subscribe_button1', {
            title: 'My test button',
            type: 'menubutton',
            icon: 'text',
            menu: [{
                text: 'Menu item I',
                value: 'Text from menu item I',
                onclick: function(){
                title: 'Container',
                height: 500,
                body: [{
                    type: 'container',
                    label : 'flow',
                    layout : 'flow',
                    items: [
                        {type: 'label', text: 'A container'},
                        {type: 'textbox', name: 'textbox', label: 'with a textbox'},
                        {type: 'label', text: 'and two labels'},
                        {type: 'listbox', 
                        name: 'style', 
                        label: 'style', 

                        'values': [
                            {text: 'style1', value: 'style1'},
                            {text: 'style2', value: 'style2'},
                            {text: 'style3', value: 'style3'}
                        // Style formats 
                        style_formats: [
                            { title: 'style1', inline: 'span', styles: { 'color': '#E01B6A','font-size':'12px','background-color':'#D6D4D5'} },
                            { title: 'style2', inline: 'span', styles: { 'color': '#6F7575','font-size':'14px','background-color':'#ABF5EC'} },
                            { title: 'style3', inline: 'span', styles: { 'color': '#000000','font-size':'16px','background-color':'#8357F2', 'font-weight':'bold'} }

                onsubmit: function(e) {editor.insertContent('<span style="e.data.style">qeqe</span>')}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.