How would I enable/disable the save button of CKEditor using external JS? I don't want to remove it completely, just change the appearance between gray and colored icon so that it's more user friendly.
My save button is generated like so:
CKEDITOR.plugins.registered['save'] =
{
init : function( editor )
{
var command = editor.addCommand( 'save', {
modes : { wysiwyg:1, source:1 },
exec : function( editor ) {
if(My.Own.CheckDirty())
My.Own.Save();
else
alert("No changes.");
}
});
editor.ui.addButton( 'Save',{label : '',command : 'save'});
}
}
Here you go:
For 3.6.x:
CKEDITOR.instances.yourEditorInstance.getCommand( 'save' ).disable();
CKEDITOR.instances.yourEditorInstance.getCommand( 'save' ).enable();
For 4.x:
CKEDITOR.instances.yourEditorInstance.commands.save.disable();
CKEDITOR.instances.yourEditorInstance.commands.save.enable();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With