How can I disable a custom button in my editor toolbar which is within a Div element, not in a textarea? I want this button to still be there when I disable it and make it greyed out. All the examples I have found do not work and are not for the same thing I currently have which is an editor that is within a div element. So to clarify my situation, I create a div element, then append my CKEditor version 4.4.4 to it. everything works fine however my custom buttons are enabled right away and I want to disable them by default and then enable them later.
Most examples I find explain how to remove the button from the toolbar and that of course is not what I am looking for. Please reply if you know how to do this without removing the button from the toolbar.
I have tried "TRISTATE", didnt work or maybe I am not placing it within the correct file. Also tried disable() which did not work or maybe I am not using that the correct way. It would be helpful if the documentation had examples, the source code button on the right of each thing shown in the documentation only shows the source code of the function and not source code of some example using it.
Thu, 09/18/2014 - 21:51
#1
I think you're looking for "startDisabled"
I think I understand what you're trying to do- it sounds like you want your custom buttons disabled by default until you enable them later.
The command definition has a property called "startDisabled":
http://docs.ckeditor.com/#!/api/CKEDITOR.commandDefinition-property-startDisabled
It defaults to false, but it sounds like you want to set it to true. So when you define the command for your custom button, just include
startDisabled: true,
Thank you, I did try that
Thank you, I did try that previously and it just disabled my editor, when looking at it in the documentation a second time I noticed there was no semicolon after that code, which I was putting in there. So now I tried it without the ";" and it worked. Thanks for addressing that for me.