Search code examples
javascriptpluginsckeditor

Disabling Specific Buttons in the CKEditor 4.0 LITE Plugin for Tracking Changes


I'm using CKEditor 4.0 with the LITE Plugin to provide an in-line editor in my web application.

There are multiple user ranks in the application. For users below a certain rank, I want to deactivate the ability to accept or reject any changes. However, I still want all users to be able to make edits and have their changes be tracked.

I've read the online documentation for CK Editor and for the LITE Plugin. Here's my latest attempt:

if(userRank !== 'contentmanager' || userRank !== 'fullcontributor' || userRank !== 'contributor'){

    console.log('userRank is: ',userRank);
    console.log('disabling buttons');

    CKEDITOR.config.removeButtons = 'lite-acceptall'; //doesn't work
    CKEDITOR.config.removeButtons = 'lite-acceptone'; //doesn't work
    CKEDITOR.config.removeButtons = 'lite-rejectall'; //doesn't work
    CKEDITOR.config.removeButtons = 'lite-rejectone'; //works????

}

Only the last button removal works. I also looked at this related post on button names to see if I'm naming the buttons properly:

Where the list of all toolbar button names and group names available in CKEditor 4?

What's causing the issue?


Solution

  • Just combine all of the commands into one statement.

    CKEDITOR.config.removeButtons = 'lite-acceptall,lite-acceptone,lite-rejectall,lite-rejectone';