如何在选择图像时启用或禁用 CKEditor 的段落按钮。我不想完全删除它。 我目前使用 ckeditor 版本 4.4
最佳答案
使用editor.getCommand()
+ CKEDITOR.command
API (启用
和禁用
):
editor.getCommand( 'justifyleft' ).disable();
editor.getCommand( 'justifyleft' ).enable();
例如:
CKEDITOR.instances.editor1.on( 'selectionChange', function( evt ) {
var jLeftCommand = this.getCommand( 'justifyleft' ),
jRightCommand = this.getCommand( 'justifyright' );
if ( evt.data.path.lastElement.is( 'img' ) ) {
jLeftCommand.disable();
jRightCommand.disable();
} else {
jLeftCommand.enable();
jRightCommand.enable();
}
} );
关于ckeditor - ckeditor 上的临时禁用按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23516061/