我有一个ckeditor插件并在init中:我想捕获click事件,所以我可以做点什么.
CKEDITOR.plugins.add('Columns',{
init : function(editor) {
editor.on('doubleclick', function(ev) {console.log('hello');}); // Works
editor.on('focus', function(ev) {console.log('hello');}); // Works
editor.on('click', function(ev) {console.log('hello');}); // Does not work
editor.on('mousedown', function(ev) {console.log('hello');}); // Does not work
}
});
Run Code Online (Sandbox Code Playgroud)
有任何想法吗???
编辑: 确定无法点击工作,我相信我们需要为此创建一个事件.但是感谢这篇文章:http://alfonsoml.blogspot.com.au/2011/03/onchange-event-for-ckeditor.html
我设法使用'saveSnapshot',每次点击时都会触发,因此现在可以使用了
editor.on('saveSnapshot', function(ev) {console.log('hello');}); // Works
Run Code Online (Sandbox Code Playgroud)
我意识到这很旧,但它没有原始问题的答案。
CKEDITOR.plugins.add('Columns',{
init : function(editor) {
editor.on('instanceReady', function (e) {
this.container.on('click', function (event) {
console.log('hello');
});
});
}
});
Run Code Online (Sandbox Code Playgroud)
注意:当 CKEditor 处于“经典 iframe 模式”时,这将不起作用。相反,您需要使用this.document(请参阅:文档属性)来获取对 iframe 的引用。
| 归档时间: |
|
| 查看次数: |
3868 次 |
| 最近记录: |