I'm attempting to use the async flag provided by the CKE Command definition as seen in the example here.
I have the command, which opens a jQuery UI dialog, where some data is input from the user. This part works fine. When the dialog is closed (i.e. user clicks OK or Cancel) I try to do as the CKE example shows and manually call editor.fire("afterCommandExec"), which results in the following error:
Uncaught TypeError: Cannot read property 'command' of undefined
It's coming from here: http://docs.cksource.com/ckeditor_api/symbols/src/plugins_undo_plugin.js.html (line 69)
if ( undoManager.enabled && event.data.command.canUndo !== false )
undoManager.save();
I understand why the error is happening: no event data is being sent along with the call to fire(). However, their example has no event data sent either. I can manually fire the event with the command as data and it seems to work:
editor.fire("afterCommandExec", {
command: editor.getCommand('link')
});
However, that doesn't seem like the right way to do this. What am I doing wrong?