You can find the following example in the migration guide :
// Old event editor.onInit(editor, args) { // Custom logic }); // New event editor.on('init', function(args) { // Custom logic });
So one problem is getting the correct event name and the correct editor instance :) The onExecCommand () event becomes "ExecCommand" in version 4.
Therefore, adding a handler when executing the command should be like this (make sure that the editors are already initialized when executing the code below):
for (ed_id in tinymce.editors) { tinymce.editors[ed_id].on('ExecCommand', function(args) { alert(1); }); }
For some reason, this event fires twice when the command is executed. I think you will overcome this problem.
Although this method does not use jQuery bindings, it works for me and may also solve your problem.
source share