最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Event when tinymce plugin dialog is closed - Stack Overflow

programmeradmin4浏览0评论

tinymce.PluginManager will open a dialog using windowManager.open(). The dialog can be closed manually by using windowManager.close(). This is described by .php/api4:class.tinymce.Plugin. The dialog can also be closed by clicking the "X" in the top right corner.

I would like to execute some script whenever the dialog is closed. Seems to me there are two options.

Option 1. Ideally, I can add a callback which would execute whenever ever the dialog is closed. I have searched the documentation, but cannot find out whether this is possible.

Option 2. When ever I manually close the dialog using windowManager.close(), I can add the desired script directly before doing so. It is when the user clicks the X has got me stumped.

Trigger the event which happens when I click the 'x' button on a TinyMCE modal dialog (like the advimage dialog) describes adding an event handler to the X button being clicked. Problem is the event cannot be associated until the dialog is open, and there doesn't seem to be an on open dialog event I can do it at.

How can I execute code whenever the TinyMCE plugin dialog is closed? Thank you

$(".mceClose").click(function() {
    alert('Handler for .click() called.');
});

tinymce.PluginManager will open a dialog using windowManager.open(). The dialog can be closed manually by using windowManager.close(). This is described by http://www.tinymce./wiki.php/api4:class.tinymce.Plugin. The dialog can also be closed by clicking the "X" in the top right corner.

I would like to execute some script whenever the dialog is closed. Seems to me there are two options.

Option 1. Ideally, I can add a callback which would execute whenever ever the dialog is closed. I have searched the documentation, but cannot find out whether this is possible.

Option 2. When ever I manually close the dialog using windowManager.close(), I can add the desired script directly before doing so. It is when the user clicks the X has got me stumped.

Trigger the event which happens when I click the 'x' button on a TinyMCE modal dialog (like the advimage dialog) describes adding an event handler to the X button being clicked. Problem is the event cannot be associated until the dialog is open, and there doesn't seem to be an on open dialog event I can do it at.

How can I execute code whenever the TinyMCE plugin dialog is closed? Thank you

$(".mceClose").click(function() {
    alert('Handler for .click() called.');
});
Share Improve this question edited May 23, 2017 at 12:10 CommunityBot 11 silver badge asked Oct 22, 2013 at 18:22 user1032531user1032531 26.3k75 gold badges245 silver badges416 bronze badges 2
  • This may help tinymce./wiki.php/API3%3aevent.tinymce.Editor.onRemove – Manish Commented Oct 22, 2013 at 18:31
  • @Manish. Thank you, but this is the editor, and not the plugin dialog. – user1032531 Commented Oct 22, 2013 at 18:47
Add a ment  | 

2 Answers 2

Reset to default 11

To be precise you should add onClose function as the following:

tinyMCE.activeEditor.windowManager.open({
    ...
    onClose: function() {

    }
});

It cost me a lot of time to find right solution. Hope it will help.

As described in API reference, close method fires onClose event. So you can try something like:

tinymce.activeEditor.windowManager.onClose.add(function() {...})
发布评论

评论列表(0)

  1. 暂无评论