2011-01-24 71 views

回答

2

使用CLEditor的.change事件會更有意義嗎?從documentation

變化 - 每當編輯 的內容改變時觸發此事件。由於更改檢測 是使用鍵盤和鼠標事件 完成的,因此用戶鍵入該事件時會頻繁出現 。

+0

是的......但如何讓更改事件的內容數據? – scippie 2012-02-19 14:08:38

1

我使用的是1.3.0版本的cleditor的, 下面的代碼是非官方的, 我可能是糟糕的代碼,因爲我是小白空中接力和許多其他原因, 但直到下一個版本它爲我的伎倆: 這裏是我做過什麼:

在文件jquery.cleditor.js:

添加trickyMethod選項: 行100:

更換這

imagesPath: function() { return imagesPath(); }, 

本:

imagesPath: function() { return imagesPath(); }, 
trickyMethod: function(){}  

充分利用trickyMethod被要求keyup事件: 行:此

$doc.click(hidePopups) 
    .bind("keyup mouseup", function() { 
    refreshButtons(editor); 
    }); 

:878

替換此

$doc.click(hidePopups) 
    .bind("keyup mouseup", function() { 
    refreshButtons(editor); 
    editor.options.trickyMethod(editor); 
    }); 

現在你可以在應用程序代碼,並與trickyMethod選項調用cleditor:

$("#input").cleditor({ 
     width: 600, 
     height: 600, 
     trickyMethod: function(){ alert("sdf"); } 
    });