gpt4 book ai didi

ckeditor - ckeditor 上的临时禁用按钮

转载 作者:行者123 更新时间:2023-12-02 06:28:53 27 4
gpt4 key购买 nike

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

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com