JavaScript API Editor Events

JavaScript API Events will call functions (called event handlers) when events occur within the editor while it is running in the browser. For example you could register an event handler that will be called when the user switches to design view. 

You can add event handlers from the PHP API when constructing an editor using the addJSEditorEvent method, or using the JavaScript API once the editor is loaded in the browser using the addEditorEvent method.

You can trigger an event using the triggerEditorEvent JavaScript API method. 

Event functions are passed the editor object as the first parameter and a second optional parameter containing information about the event.

Example: 

Loading an event using the PHP API: 

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

Loading an event using the JavaScript API:

WPro.editors['myEditor'].addEditorEvent('enterSource', function(editor) { alert("You have just switched to source view!"); } );

Editor Events 

Event Name

Second Parameter 

Description 

init 

undefined 

Called before the editor has loaded just after most of its parameters have been processed. 

load 

undefined

Called when the editor is loaded and ready to accept input. 

enterDesign 

undefined

Called when the design view is loaded 

enterSource 

undefined

Called when the source view is loaded 

enterPreview 

undefined

Called when the preview view is loaded 

enterFullWindow 

undefined 

When the editor enters full window mode 

exitFullWindow 

undefined 

When the editor exits full window mode 

submit 

undefined

Called when the form containing the editor is submitted. 

keyUp 

event object 

Fires when the user releases a key press 

keyDown 

event object

Fires when the user presses a key 

mouseUp 

event object

Fires when the user releases the mouse 

mouseDown 

event object

Fires when the user presses their mouse button. 

click 

event object 

Mouse click 

dblClick 

event object 

Double mouse click 


This online documentation specifically covers version 3.0 and above, developers using earlier versions should refer to their PDF or MS-Word manual that was included in the product download.

WysiwygPro.com