Viral
Viral

Reputation: 61

How to disabled Save button from Toolbar in CkEditor 4.4.7

I am using ckeditor 4.7 and using its cdn to load ckeditor. I want to diable save button on ckeditor I have tried CKEDITOR.instances.test_editor.commands.save.disable(); but seems not to work.

Below is my code

<html>
    <head>     
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script>
            $("#ccfive_test_editor").ready(function () {
                $("#ccfive_test_editor").siblings().hide();
                $.getScript('//cdn.ckeditor.com/4.4.7/full/ckeditor.js', function () {
                    $.getScript('//cdn.ckeditor.com/4.4.7/standard/adapters/jquery.js', function () {
                        $("#ccfive_test_editor").ckeditor();
                        CKEDITOR.config.height = 400;
                        CKEDITOR.instances.ccfive_test_editor.commands.save.disable();  
                    });
                });
            });
        </script>
    </head>
    <body>       
        <form name="ckfrm" id="ckfrm">
            <textarea cols="10" id="ccfive_test_editor" name="ccfive_test_editor" rows="10"></textarea>
        </form>
    </body>
</html>

Upvotes: 2

Views: 1171

Answers (1)

Anna Tomanek
Anna Tomanek

Reputation: 2239

I am not sure what you mean by "disabling the button" - do you want to entirely remove the functionality that the Save plugin offers, do you want to be able to manually enable and disable the button when needed in your code?

CKEditor has two useful configuration values that let you remove unneeded functionality:

  • config.removePlugins - prevents CKEditor from loading the plugin.
  • config.removeButtons - prevents CKEditor from adding a particular button that a plugin offers to the toolbar (although the plugin itself is still loaded).

Upvotes: 1

Related Questions