I have a created a custom ckeditor plugin using this tutorial and this is working fine. I just want to show plugin button as selected/enabled/clicked when I click it the first time like Bold plugin button behaves. I have checked it applies
cke_button cke_button_on
classes when I click on the bold button. But I haved googled but did not get the way to do the same.
How can I achieve the same? Please ignore if you feel it is too basic to ask, but I have tried a lot but did not get any way.
I just need to change the state of the command. So
var commandState = editor.getCommand("COMMAND_NAME").state;
if(commandState == CKEDITOR.TRISTATE_OFF) {
commandState = CKEDITOR.TRISTATE_ON;
} else {
commandState = CKEDITOR.TRISTATE_OFF;
}
editor.getCommand("COMMAND_NAME").setState(commandState);
And thats all.