2017-09-29 10 views
0

問題があります。 エディタを「読み取り専用」にすると、ボタンの一部(コピー、プレビュー、全画面)が有効のままになります。CKEDITOR READONLY他のボタンを有効にする

  • ノーマル enter image description here

  • 私は、テキストを選択したときに、私は他のボタンを有効にするにはどうすればよいのいくつかのテキスト enter image description here

を選択しますか? (例えば「BGColor」ボタンを有効にしてください)

答えて

0

このようなことができます
選択イベントを探します。

CKEDITOR.instances["textarea"].on('selectionChange', function(evt) { 
    // get desired command from ckeditor 
    var myCommand = this.getCommand('CKEDITOR_COMMAND_NAME'); 
    var mySelection = null; 
    // check if something is selected 
    var mySelection = this.getSelection().getNative() || this.window.$.getSelection() || this.document.$.selection; 
    if (!mySelection) { 
    // if not stay disable 
     myCommand.disable(); 
    } else { 
    //if yes enable command 
    myCommand.enable(); 
    } 

}); 
関連する問題