以编程方式控制保存按钮的启用/禁用状态 [英] Controlling save button enabled/disabled state programmatically
本文介绍了以编程方式控制保存按钮的启用/禁用状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用外部JS启用/禁用CKEditor的保存按钮?我不想完全删除它,只需更改灰色和彩色图标之间的外观,这样更方便用户。
How would I enable/disable the save button of CKEditor using external JS? I don't want to remove it completely, just change the appearance between gray and colored icon so that it's more user friendly.
我的保存按钮生成如下: / p>
My save button is generated like so:
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();
这篇关于以编程方式控制保存按钮的启用/禁用状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文