[英]Disable a Dialog Button in CKEditor
I try to write a plugin for the CKEditor (Version 4.x), with a Dialog UI element. 我尝试使用Dialog UI元素为CKEditor(版本4.x)编写插件。
the definition of the dialog looks like: 对话框的定义如下:
CKEDITOR.dialog.add('abbrDialog', function(editor) {
return {
title: editor.lang.abbr.title,
label: editor.lang.abbr.title,
minWidth: 400,
minHeight: 200,
contents: [{
id: 'abbreviation-dialog',
label: editor.lang.abbr.label,
elements: [
{
id: 'abbreviation-found-label',
type: 'html',
label: editor.lang.abbr.found,
html: '<span id="foundLabelId">'+ editor.lang.abbr.found + '<\/span>'
},
{
id: 'abbreviation-current-item',
type: 'html',
label: editor.lang.abbr.currentLabel,
html: '<span id="currentLabelId">'+ editor.lang.abbr.currentLabel + '<\/span>'
},
{
id: 'abbreviation-replace-button',
type: 'checkbox',
label: editor.lang.abbr.replaceButton,
onClick : function() {
replaceAbbreviation(editor.lang.abbr.currentLabel, editor.lang.abbr.noMore);
}
},
{
id: 'abbreviation-next-button',
type: 'button',
label: editor.lang.abbr.nextButton,
onClick : function() {
nextAbbreviation(editor.lang.abbr.currentLabel, editor.lang.abbr.noMore);
}
},
{
id: 'abbreviation-all-button',
type: 'button',
label: editor.lang.abbr.allButton,
onClick : function() {
replaceAllAbbreviations(editor.lang.abbr.currentLabel, editor.lang.abbr.noMore);
//alert('Replace all!!');
}
}]
}],
buttons: [CKEDITOR.dialog.okButton],
onShow: function() {
initDialog(editor.lang.abbr.found, editor.lang.abbr.currentLabel);
},
onOk: function() {
// nothing to do
}
In one function i try to disable a button. 在一个功能中,我尝试禁用按钮。 This looks like:
看起来像:
CKEDITOR.dialog.getCurrent().getContentElement("abbreviation-dialog", "abbreviation-replace-button").disable();
Unfortunately this button gets not disable (but the additional CSS-class cke_disabled
is added). 不幸的是,这个按钮没有被禁用(但是添加了附加的CSS类
cke_disabled
)。
Also strange: if i turn that abbreviation-replace-button
into a checkbox, this checkbox gets disabled (with no further code modifications). 也很奇怪:如果我将
abbreviation-replace-button
变成一个复选框,则此复选框将被禁用(无需进一步的代码修改)。
My Questions: 我的问题:
I think you need to call a special method to disable buttons, ie `disableButton('btn') 我认为您需要调用一种特殊的方法来禁用按钮,即`disableButton('btn')
you can disable ok
or cancel
button by following way 您可以通过以下方式禁用“
ok
或“ cancel
按钮
CKEDITOR.dialog.getCurrent().disableButton('ok')
CKEDITOR.dialog.getCurrent().disableButton('cancel')
in your case you can try 您可以尝试
CKEDITOR.dialog.getCurrent().disableButton('abbreviation-next-button')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.