Is it possible to change tinyMCE custom Toolbar ListBox values after tinymce init -
following example add custom dropdown tinymce, possible change again after init tinymce? example, after init tinymce, update list again button different list. https://codepen.io/tinymce/pen/jywjvr
tinymce.init({ selector: 'textarea', height: 500, toolbar: 'mybutton', menubar: false, content_css: [ '//fonts.googleapis.com/css?family=lato:300,300i,400,400i', '//www.tinymce.com/css/codepen.min.css'], setup: function (editor) { editor.addbutton('mybutton', { type: 'listbox', text: 'my listbox', icon: false, onselect: function (e) { editor.insertcontent(this.value()); }, values: [ { text: 'menu item 1', value: ' <strong>some bold text!</strong>' }, { text: 'menu item 2', value: ' <em>some italic text!</em>' }, { text: 'menu item 3', value: ' some plain text ...' } ], onpostrender: function () { // select second item default this.value(' <em>some italic text!</em>'); } }); } });
i didn't find choice can update custom dropdown. not way way can make work. did remove tinymce , re-add again.
tinymce.remove(); tinymce.init({ selector: 'textarea', setup: function (editor) { var self = this; editor.addbutton('mybutton', { type: 'listbox', text: 'mylist', icon: false, onselect: function (e) { editor.insertcontent(this.value()); }, values: newlist, onpostrender: function () { // select second item default this.value(' <em>some italic text!</em>'); } }); } });
Comments
Post a Comment