简体   繁体   English

我想在tinyMCE图像工具中捕获“确定”按钮的单击事件

[英]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. 我想捕捉tinyMCE图像工具按钮中的确定按钮的单击事件,如何实现这一点,请附上屏幕截图以供参考。

在此处输入图片说明

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: 这个解决方案有点脏imo,但是只要您不能/不会编辑插件本身,就可以使用以下按钮:

// 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. 请记住,如果页脚中有一个类别为“ mce-primary”的按钮(“确定”按钮)并且它是第一个按钮,则这将是第一个–否则,您必须编辑选择器。

Not sure if there's a better way except extending/customizing the image plugin itself -> at least it works ;) 不知道是否有更好的方法,除了扩展/自定义图像插件本身->至少它有效;)

Cheers :) 干杯:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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