简体   繁体   中英

I want to catch click event of Ok button in tinyMCE image tools

I want to catch the click event of OK button in tinyMCE image tools button, how do I can achieve this, attaching screenshot for your reference.

在此处输入图片说明

When someone clicks on Ok button, I want a user defined function to trigger. Please help me on this.

its already a couple of days old but...

This solution is a bit dirty imo but as long as you can't/won't edit the plugin itself you can get the button with:

// top.tinymce.activeEditor.windowManager.windows[0].statusbar is the footer instance
var tinyMceFooterId = top.tinymce.activeEditor.windowManager.windows[0].statusbar._id;
var tinyMceFooter = document.getElementById(tinyMceFooterId);
var tinyMceSubmitButton = tinyMceFooter.querySelector('.mce-primary button');

Keep in mind, that this will just work if there is a button inside the footer with the class "mce-primary" (the ok button) and it is the first one – otherwise you have to edit the selector.

Not sure if there's a better way except extending/customizing the image plugin itself -> at least it works ;)

Cheers :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM