gpt4 book ai didi

javascript - 使用 CKEDITOR.config.on 定义事件处理程序的优先级

转载 作者:行者123 更新时间:2023-11-29 19:30:52 25 4
gpt4 key购买 nike

我们需要做一些特殊的处理来处理CKEditor的'toHtml'事件。我们需要对原始字符串格式的数据进行此处理,因此我们必须设置低优先级(如 1)。我们可以通过以下方式做到这一点:

CKEDITOR.instances.editorName.on( 'toHtml', toHtmlHandler, null, null, 1 );

但根据页面的不同,我们有大量可能的实例,因此我们尝试使用这种方法只执行一次:

configuration.on = {
toHtml: toHtmlHandler
}

问题是我们不知道如何以这种形式设置优先级,这可能吗?

谢谢

最佳答案

不,无法通过这种方式设置优先级。将监听器附加到另一个监听器中(在 toHtml 之前):

function toHtmlHandler( evt ) {
console.log( 'toHtml event', evt );
}

CKEDITOR.replace( 'editor1', {
on: {
pluginsLoaded: function () {
this.on( 'toHtml', toHtmlHandler, null, null, 1 );
}
}
} );

关于javascript - 使用 CKEDITOR.config.on 定义事件处理程序的优先级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27569963/

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