Retrieve events bound to a tinymce editor

How do you retrieve user-defined events bound to a tinymce editor? I'm able to retrieve events bound to an element using code such as:

var events = $._data($(this)[0], 'events');

But if I've added events to the tinymce editor itself, how would I retrieve those? For example, this does not work:

var events = $._data(tinyMCE.get($(this).attr('id'))[0], 'events');

To provide some background, I have several tinymce editors on a page. The user is able to drag and drop the divs that contain each editor. When a div is moved the tinymce editor becomes non-responsive. The workaround was to remove the tinymce editor and reinitialize it. However doing so causes it to lose any events that were bound to it. Therefore I want to copy the events attached to the editor and re-add them after reinitializing the editor.

1 answer

  • answered 2017-12-06 20:15 Michael Fromin

    You can actually add the events in the configuration object you use to instantiate the editor. Here is an example:

    If you do it this way when you re-instantiate the editor it will have these events automatically.