2017-01-26 10 views
0

CKEditor(バージョン4.x)用のプラグインをDialog UI要素で作成しようとしました。CKEditorのダイアログボタンを無効にする

ダイアログの定義は次のようになります。私はボタンを無効にしよう1つの関数に

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 
    } 

。これは、次のようになります。

CKEDITOR.dialog.getCurrent().getContentElement("abbreviation-dialog", "abbreviation-replace-button").disable(); 

は、残念ながら、このボタンは無効にしないで取得します(ただし、追加のCSSクラスcke_disabledが追加されます)。

また、奇妙なことに、abbreviation-replace-buttonをチェックボックスにすると、このチェックボックスは無効になります(これ以上のコード変更は必要ありません)。

私の質問は:

  • がどのように私は、プラグインのダイアログ上のボタンを無効にすることができますか?
  • なぜチェックボックスは無効になっていますが、ボタンは無効になっていますか?
  • 私のミスはどこですか?
  • 私はあなたがボタンを無効にするには、特別なメソッドを呼び出すために必要だと思う

答えて

0

、 すなわち `disableButton( 'BTN')

あなたは中

CKEDITOR.dialog.getCurrent().disableButton('ok') 
CKEDITOR.dialog.getCurrent().disableButton('cancel') 

方法に従うことによってokまたはcancelボタンを無効にすることができますあなたの場合は試すことができます

CKEDITOR.dialog.getCurrent().disableButton('abbreviation-next-button') 
関連する問題