我设法为模态窗口执行此操作(我需要打开/关闭的回调)也许您可以在其上构建以检测打开的窗口类型:
tinymce.init({
//... code and setup here
setup: function(editor) {
editor.on('init',function(e) {
setModalEvents(editor);
});
},
//... and more here perhaps
});
然后是函数本身:
// override modal methods to insert events
function setModalEvents(editor) {
editor.windowManager.oldOpen = editor.windowManager.open; // save for later
editor.windowManager.open = function(t,r) { // replace with our own function
alert("modal window opened, insert callback here");
var modal = this.oldOpen.apply(this, [t,r]); // call original
modal.on('close', function() { // set event for close
alert("modal window closed, insert callback here");
});
return modal; // Template plugin is dependent on this return value
};
}
您可以在 tinymce 核心中对其他内容进行类似的覆盖,所以这可能会有所帮助。