Search code examples
javascripttinymcewysiwyg

disable some buttons TinyMCE


Can I somehow by running a javacript command disable some buttons..

Not on the TinyMCE.init, as I need to disable some of the buttons when a special event is happening.

I have tried cm.setDisabled(1); but that makes all buttons disabled.

Any ideas if there is a call for that? Or should I try make a javascript function which i can call whenever to disable/re-enable a button again?


Solution

  • Try to follow this fiddle..

    Here Bold and Save buttons get disabled on clicking Disable button
    and enabled on clicking Enable button.
    
    Buttons are at the bottom of the page
    

    For disabling a specific button you need id of that button which is your divId_buttonName like

    tinyMCE.activeEditor.controlManager.get('disable_save').setDisabled(true) ;
    

    In order to enable it again

    tinyMCE.activeEditor.controlManager.get('disable_save').setDisabled(false) ;
    

    Hope it helps!