12. Event Handlers

edit-on Pro 5 introduces a new, simplified method to set event handlers. You can now set event handlers using simply the name of the event and the name function which should be called when this event is fired. Example:

function onDataPosted() {
    alert("Successfully posted data.");
}
eop.setEventHandler("ONDATAPOSTED","onDataPosted");
eop.pumpEvents();

In this example, the function onDataPosted is called every time data is posted successfully.

The available events are:

ONACCEPTINSERTIONFINISHED
ONREJECTINSERTIONFINISHED
ONACCEPTDELETIONFINISHED
ONREJECTDELETIONFINISHED
ONACCEPTFORMATFINISHED
ONREJECTFORMATFINISHED
ONACCEPTALLFINISHED
ONREJECTALLFINISHED
ONDIFFFINISHED
ONCANCELDIFFFINISHED
ONTRACKCHANGES
ONACCEPTSELECTEDCHANGESFINISHED
ONREJECTSELECTEDCHANGESFINISHED
ONDATAPOSTEDERROR
ONEDITORFOCUSED
ONEDITORLOADED
ONDATALOADED
ONDATAPOSTED
ONEDITORFOCUSED
ONCHANGE
ONSELECTIONCHANGE
ONHTMLDATAINSERTED
ONSETTEMPLATE

ONACCEPTINSERTIONFINISHED: This event is thrown every time an insertion is accepted in comparison mode.

ONREJECTINSERTIONFINISHED: This event is thrown every time an insertion is rejected in comparison mode.

ONACCEPTDELETIONFINISHED: This event is thrown every time a deletion is accepted in comparison mode.

ONREJECTDELETIONFINISHED: This event is thrown every time a deletion is rejected in comparison mode.

ONACCEPTFORMATFINISHED: This event is thrown every time a formatting change is accepted in comparison mode.

ONREJECTFORMATFINISHED: This event is thrown every time a formatting change is rejected in comparison mode.

ONACCEPTALLFINISHED: This event is thrown when all changes are accepted in comparison mode.

ONREJECTALLFINISHED: This event is thrown when all changes are rejected in comparison mode.

ONDIFFFINISHED: This event is thrown when the comparison mode is successfully ended.

ONCANCELDIFFFINISHED: This event is thrown when cancelling the comparison mode.

ONTRACKCHANGES: This event is thrown when entering track changes mode.

ONACCEPTSELECTEDCHANGESFINISHED: This event is thrown when the changes within the current selection are accepted.

ONREJECTSELECTEDCHANGESFINISHED: This event is thrown when the changes within the current selection are rejected.

ONDATAPOSTEDERROR: This event is thrown when an error occurs while posting data using the direct HTTP Post API.

ONEDITORLOADED: This event is thrown when the editor was loaded.

ONDATALOADED: This event is thrown when data is loaded into the editor.

ONDATAPOSTED: This event is thrown when data was successfully posted using the direct HTTP Post API.

ONEDITORFOCUSED: This event is thrown when the editor receives the focus.

ONSELECTIONCHANGE: This event is thrown when the selection in the editor changes.

ONCHANGE: This event is thrown when the editor's content is modified.

ONHTMLDATAINSERTED: This event is thrown when content is inserted into the editor via the insetHTMLData or insertHTMLDataFromURL methods.

ONSETTEMPLATE: This event is thrown when a template is loaded by the editor. The template can either be specified in the configuration file or via the API methods setTemplate or setTemplateURL.