gpt4 book ai didi

ckeditor - 以编程方式控制保存按钮的启用/禁用状态

转载 作者:行者123 更新时间:2023-12-04 13:20:13 26 4
gpt4 key购买 nike

如何使用外部JS启用/禁用CKEditor的保存按钮?我不想完全删除它,只需在灰色和彩色图标之间更改外观,以使其更加用户友好。

我的保存按钮是这样生成的:

CKEDITOR.plugins.registered['save'] =
{
init : function( editor )
{
var command = editor.addCommand( 'save', {
modes : { wysiwyg:1, source:1 },
exec : function( editor ) {
if(My.Own.CheckDirty())
My.Own.Save();
else
alert("No changes.");
}
});
editor.ui.addButton( 'Save',{label : '',command : 'save'});
}
}

最佳答案

干得好:

对于3.6.x:

CKEDITOR.instances.yourEditorInstance.getCommand( 'save' ).disable();
CKEDITOR.instances.yourEditorInstance.getCommand( 'save' ).enable();

对于4.x:
CKEDITOR.instances.yourEditorInstance.commands.save.disable();
CKEDITOR.instances.yourEditorInstance.commands.save.enable();

关于ckeditor - 以编程方式控制保存按钮的启用/禁用状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13026122/

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