tmcneer
tmcneer

Reputation: 65

Configuring/Removing individual buttons in CKEditor's 'Source' group

I've read many posts regarding the lack of documentation for button lists in CKEditor 4, and I've found posts where individuals even posted a list of button Items based on their testing.

However, what my client has asked is to remove specific buttons within the Source group - the Comment, Uncomment and HTML Tag Autocomplete buttons.

Does anyone know the correct button names for these buttons that will work with removeButtons()?

I've tested the obvious - Comment,Uncomment,Autocomplete - but they have no effect.

Thanks.

Upvotes: 0

Views: 370

Answers (2)

c0y0teX
c0y0teX

Reputation: 1512

I know it is late for the OP, but for anyone interested, the default configuration for the CodeMirror plug-in toolbar is (Sourcedialog included):

{ name: 'document', items: [ 'Source', 'Sourcedialog', 'autoFormat', 'CommentSelectedRange', 'UncommentSelectedRange', 'AutoComplete' ] }

To remove specific buttons with the removeButtons() function you can add each button name to the array, so for the case in question:

removeButtons: 'CommentSelectedRange,UncommentSelectedRange,AutoComplete'

Notice the names of the buttons are case-sensitive.

Upvotes: 1

jnoreiga
jnoreiga

Reputation: 2175

For whomever stumbles upon this later on.

The buttons are added by the codemirror plugin. Codemirror has configuration to not include these buttons.

CKEDITOR.config.codemirror = {
// Whether or not to show the search Code button on the toolbar
   showSearchButton: false,

   // Whether or not to show Trailing Spaces
   showTrailingSpace: true,

    // Whether or not to show the format button on the toolbar
    showFormatButton: false,

    // Whether or not to show the comment button on the toolbar
    showCommentButton: false,

    // Whether or not to show the uncomment button on the toolbar
    showUncommentButton: false,

    // Whether or not to show the showAutoCompleteButton button on the toolbar
    showAutoCompleteButton: false
};

Upvotes: 0

Related Questions