67299

Is there open “Insert/Edit image” dialog event in Tinymce?

Question:

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() <a href="https://stackoverflow.com/questions/51927444/tinymce-command-mceimage-cannot-be-caught" rel="nofollow">but it doesn't work with the mceImagecommand</a> 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?

Answer1:

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.

Recommend

  • How to mount dynamically single file component in Vue.js
  • LatLong falls within a given polygon in D3 + Leaflet
  • NSTimer and updating UI
  • Access 2007 forms with parameterized RecordSource
  • Remove every nth element from swift array
  • GDB skips over my code!
  • Opening links in a new tab and only the new tab
  • Trouble Attaching Call Back to Unobtrusive Validation Show Error
  • Paramiko SSHException Channel Closed
  • Parallel sieve of Eratosthenes - Java Multithreading
  • UIBarButtonItem's action is not called when in a view with a UIGestureRecognizer
  • C++/CLI Thread synchronization including managed and unmanaged code
  • XBee Linux Serial Port on Rasberry Pi
  • Opening two instances of InAppBrowser (_system and _blank) prevents events from triggering
  • Receive mouse move even cursor is outside control
  • Faster Way To Simultaneously Iterate Over Rolling Window Of Two Or More Numpy Arrays?
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • Multiple producers single consumer locking schema
  • Android application: how to use the camera and grab the image bytes?
  • How to view images from protected folder with php?
  • How does document.ready work with angular element directives?
  • Using a canvas object in a thread to do simple animations - Java
  • Code in Job's Script Block after Start-Process Does not Execute
  • How can I enlarge video fullscreen without the affected interface project in as3?
  • Alternative to overridePendingTransition() - Android
  • d3 v4 drag and drop with TypeScript
  • JQuery Internet Explorer and ajaxstop
  • Python urlparse: small issue
  • How to clear text inside text field when radio button is select
  • Android fill_parent issue
  • FileReader+canvas image loading problem
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • jquery mobile loadPage not working
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Data Validation Drop Down Box Arrow Disappearing
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How do you join a server to an Active Directory (domain)?
  • Linking SubReports Without LinkChild/LinkMaster
  • python draw pie shapes with colour filled