ckeditor上的临时禁用按钮

用户名

选择图像时如何启用或禁用CKEditor的段落按钮。我不想将其完全删除。当前正在使用ckeditor 4.4版

奥列克

使用editor.getCommand()+ CKEDITOR.commandAPIenabledisable):

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();
    }
} );

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章