从jquery获取内容CLEditor
答
使用CLEditor的.change
事件会更有意义吗?从documentation:
变化 - 每当编辑 的内容改变时触发此事件。由于更改检测 是使用键盘和鼠标事件 完成的,因此用户键入该事件时会频繁出现 。
答
我使用的是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"); }
});
是的......但如何让更改事件的内容数据? – scippie 2012-02-19 14:08:38