2010-06-20 60 views

回答

9

我仍然無法找到任何文件,而是圍繞一個CKEditor的實例的內部戳後,我能找到我要找的事件:

instance.on('mode', function() {
     // Code to execute when the user switches editing modes
}

很容易的。事件在編輯器初始化時觸發一次,並且在任何時候激活source命令(通過instance.execCommand(...)或用戶單擊Source工具欄按鈕)。

+1

謝謝!我會補充一點,你可以通過檢查回調參數來找到你所在的模式:e.sender.mode ='source'或'wysiwyg'。 – shimizu 2017-07-18 22:16:16

0

我有一箇舊版本,並解決了這個與

CKEDITOR.instances['terms_and_conditions'].on('mode', function() { 
    console.log(this.mode); // outputs: source, wysiwyg 
}); 
相關問題