What is the simplest way to toggle the state of a toolbar button (like it works with the default bold-button)? I can\'t \"get\" to that class i Tinymce that changes the butt
In case anyone else finds this article for this issue - I found a bit of a simpler way to do it, using the onclick in 4.0.16:
/* In the timymce > plugins, name your pluginfolder "my_crazy_plugin" and
plugin file as "plugin.min.js" */
/* Your plugin file: plugin.min.js */
tinymce.PluginManager.add('my_crazy_plugin', function(editor) {
/* Actions to do on button click */
function my_action() {
this.active( !this.active() );
var state = this.active();
if (state){
alert(state); /* Do your true-stuff here */
}
else {
alert(state); /* Do your false-stuff here */
}
}
editor.addButton('mybutton', {
image: 'tinymce/plugins/my_crazy_plugin/img/some16x16icon.png',
title: 'That Bubble Help text',
onclick: my_action
});
});
/* Your file with the tinymce init section: */
tinymce.init({
plugins: [
"my_crazy_plugin"
],
toolbar: "mybutton"
});