The on
method can be called to install event handlers for various ESD/SPD Web
editor events. When an event handler is installed, the function you provide as the handler will be called
when the specified event occurs.
.on(/*String*/ eventName, /*Function*/ handler)
The name of an editor event. See the events topic for more information.
A function that will be called each time the event occurs in the editor. The signature of this handler function depends on the event name. See events for more information.
Note that most events have only one handler active at a time. These events always have a default handler. Defining a handler for these events will always replace the current handler.
remove
that can be called to remove the custom event handler.
For events with only one active handler, calling this method will restore the event's default handler.
var commandEnableHandler = editor.on('commandEnable', function (/*String*/ commandId, /*Boolean*/ enabled) { // summary: // Invoked when the enabled state of a command changes // commandId: String or Array of Strings // CommandId(s) which have changed their enabled state // enabled: Boolean // The enabled state of the command // returns: nothing ... } ); ... // Remove the command enable handler. commandEnableHandler.remove();