2011-09-12 14 views
2

我想添加一個監聽器的selectPage事件到我的CKEditor插件,但到目前爲止我無法讓它工作。該插件工作正常,但我的聽衆不工作。下面的警報永遠不會被調用。CKEditor如何添加一個selectPage監聽器

代碼:

var dialog = function(editor) { 

     editor.on('selectPage', function(e) { 
      alert("Page changed"); 
     }); 

     // rest of the plugin code 
    } 

有什麼我做錯了嗎?

回答

3

原來,您必須將其添加到對話框定義中,而不是在對話框對象或編輯器對象上。

return { 
    title : editor.lang.googlemaps.title, 
    minWidth : 500, 
    minHeight : 460, 
    onLoad : function() 
    { 
     theDialog = this; 

     // Act on tab switching 
     theDialog.on('selectPage', function (e) 
      { 
       if (CKEDITOR.env.ie7Compat) 
       fixIE7display();