addJSEditorEvent

Availability: >= 3.0

Type: Object Method

Description: Allows you to set up JavaScript API Editor Events when constructing the editor.

Syntax:

$editor->addJSEditorEventstring $eventnamestring $function );

This method provides a convenient hook into the JavaScript API.

An Editor Event is a JavaScript function that is called when an event occurs within the editor. 

Parameters:

$eventname
The name of the editor event that should trigger this function.

$function
The JavaScript function to be called when the event is triggered. This could be the name of an existing JavaScript function or the function code itself.

Example:

The following creates a function that alerts the user when the editor has finished loading and is ready to be used:

$editor->addJSEditorEvent('load''function(EDITOR) { alert("The editor is now loaded."); }');