Opened 9 years ago

Last modified 7 years ago

#13852 confirmed New Feature

There is no way to disable the font and fontsize button on the toolbar

Reported by: Ramendra Owned by:
Priority: Normal Milestone:
Component: General Version: 4.0
Keywords: Cc: ramendra.kotharkar@…

Description

Steps to reproduce

  1. Open CKEditor with standard toolbar
  2. Try going to commands for current instance and call command.disable() for each item in commands
  3. It will disable almost all but few buttons on toolbar

I have tried solution provided by garry.yao on the following link: http://ckeditor.com/forums/CKEditor-3.x/How-make-CKEditor-readonly

Expected result

I want way to disable font and fontsize button

Actual result

No option available through commands collection

Other details (browser, OS, CKEditor version, installed plugins)

Attachments (1)

table.png (106.9 KB) - added by Jakub Ś 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by Jakub Ś

Attachment: table.png added

comment:1 Changed 8 years ago by Jakub Ś

Status: newconfirmed
Version: 4.5.44.0

Ok, to disable toolbar button, you can use api e.g.

editor.on('instanceReady', function(evt){
	this.getCommand( 'justifyleft' ).disable();
	this.getCommand( 'newpage' ).disable();
});

There is however no way to disable dropdowns. They don't use commands. There could be either some api or dedicated method to do that (but then a dedicated method for toolbar would have to be introduced).

comment:2 Changed 7 years ago by Jakub Ś

Dropdowns are not related to commands so they can only be disabled through ui. The problem with CKEditor default dropdowns is they are all context sensitive so as soon as you hit any dropdown matching style, the dropdown will get enabled again.

editor.on( 'instanceReady', function( evt ){
    editor.ui.instances.FontSize.setState(CKEDITOR.TRISTATE_DISABLED);
});

The above workaround will only work on custom dropdowns which do not check current selection in editor contents.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy