ckeditor - ckeditor 上的临时禁用按钮

标签 ckeditor

如何在选择图像时启用或禁用 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/

相关文章:

javascript - ckeditor textarea 自定义与 jquery 拖放

javascript - 名称中带有空格的字体未在 CKEditor 中正确应用

javascript - 无法将 docprops 插件添加到 ckeditor 工具栏

CKeditor : stylesSet not working when i set a custom allowedContent

python - CKeditor 图片上传不起作用

javascript - Cckeditor:按需显示和隐藏内联工具栏

ckeditor - 哪个是具有文件上传功能的最好的免费所见即所得编辑器

javascript - 在 ckEditor(所见即所得)中如何设置默认的点击按钮

c# - 如何在CKeditor中添加音频标签

drupal-7 - Drupal 中的 CKEditor 将 "nofollow"和目标 ="_blank"添加到每个链接