问题
I need to get to know when the dialog has already been opened. But I didn't find any decent way for this. The only thing I found in the documentation is editor.on()
but it doesn't work with the mceImagecommand and nothing is said about mceImage
in the docs. And it supposed to fire before the dialog is shown. All that comes to my mind is to attach the 'click'
event on the "Image"
button and wait for the dialog through the timer but it wouldn't be a very decent solution. Any better ideas?
回答1:
TinyMCE does not currently fire an event when opening the image dialog. If you wanted to make it do so you can modify the image plugin to include the command when the menu option or toolbar button is triggered. For example you can do this for the menu option:
editor.addMenuItem('image', {
icon: 'image',
text: 'Image',
onclick: Dialog(editor).open,
context: 'insert',
cmd: 'mceImage',
prependToContext: true
});
Note the cmd
option added to that list. Its not there in the editor code as delivered but you can add it yourself and get that command to be triggered. You can do the same for toolbar buttons by adding the cmd
option as well.
来源:https://stackoverflow.com/questions/51927800/is-there-open-insert-edit-image-dialog-event-in-tinymce