Well, after 2 business days trying to get this to work, I realized what the problem is with this particular problem.
For starters, there is no equivalent of onEvent (...) in tinymce 4. However, the plugin does not need access to each event.
If you are going to connect any tinymce plugin that uses the onEvent () method, you will need to determine the events that the plugin is trying to process, and explicitly set an event handler for each of the events that need to be processed:
ed.on('mousedown', function(e) { return changeEditor.handleEvent(e); }); ed.on('keyup', function(e) { return changeEditor.handleEvent(e); }); ed.on('keydown', function(e) { return changeEditor.handleEvent(e); }); ed.on('keypress', function(e) { return changeEditor.handleEvent(e); });
In my case, I needed to not only delegate mousedown, mouseup, keyup, keydown, and keypress events to the plugin, I also had to prevent them from being dismissed prematurely by the / textarea editor:
ed.on('keydown', function(e) { // prevent the delete key and backspace keys from firing twice if(e.keyCode == 46 || e.keyCode==8) e.preventDefault(); });
So keep this in mind if you run into a similar problem.
Oh, and I added the plug of this ICE plugin to my github: https://github.com/catsgotmytongue/ice/
source share