javascript - tinymce 4 init button -
question tinymce 4-th version. when add button
editor.addbutton('cut_tag', { type: 'button', text: '<cut>', name: 'cut_tag', id: 'cut_tag', icon: false, tooltip: 'Вставить cut', onclick: function(e){ editor.insertcontent('[cut]'); this.disabled(true); editor.cut_tag_button = this; // hack - store object in var object var later } });
and want execute code when initializing button, tried 'oninit', 'oncreate', 'setup', etc. no effect. please advice, thank you.
you need move onclick event outside add button object.
editor.addbutton(...); editor.on('click', function(e) { alert('insert logic here'); });
the syntax has changed little. tinymce migration guide might explain more.
Comments
Post a Comment