gpt4 book ai didi

ckeditor点击事件不起作用

转载 作者:行者123 更新时间:2023-12-01 11:40:08 25 4
gpt4 key购买 nike

我有一个 ckeditor 插件并且在 init: 我想捕获点击事件以便我可以做一些事情。

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
}
});

有任何想法吗???

编辑:
OK 无法让点击工作,我相信我们需要为此创建一个事件。不过感谢这篇文章: http://alfonsoml.blogspot.com.au/2011/03/onchange-event-for-ckeditor.html

我设法使用了“saveSnapshot”,每次单击时它似乎都会触发,因此现在可以使用了
editor.on('saveSnapshot', function(ev) {console.log('hello');}); // Works

最佳答案

我意识到这是旧的,但它没有原始问题的答案。

CKEDITOR.plugins.add('Columns',{
init : function(editor) {
editor.on('instanceReady', function (e) {
this.container.on('click', function (event) {
console.log('hello');
});
});
}
});

备注 :当 CKEditor 处于“经典 iframe 模式”时,这将不起作用。相反,您需要使用 this.document (请参阅: document property )以获取对 iframe 的引用。

关于ckeditor点击事件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10731564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com