Event Type

Event NameVersionDescription

initialized

This event occurs when the Editor is initialized.

beforeUploadImage

This event occurs before an image is uploaded.
afterUploadImage

This event occurs after an image is uploaded.
beforeUploadVideo

This event occurs before a video is uploaded.
afterUploadVideo

This event occurs after a video is uploaded.
beforeUploadFile

This event occurs before a file is uploaded.
afterUploadFile

This event occurs after a file is uploaded.
beforeOpenDocument

This event occurs before a document is opened (imported).
afterOpenDocument

This event occurs after a document is opened (imported).
beforeNewDocument

This event occurs before creating a new document.
afterNewDocument

This event occurs after creating a new document. 
onSelection

This event occurs when performing a selection operation such as moving the caret and expanding the selection.
beforePaste

This event occurs before pasting.
afterPaste

This event occurs after pasting.
afterEdit

This event occurs after all editing actions.


Adding Events

Using API

editor.setEventListener()

API used to add an event.

editor.setEventListener('Event Name', function(e) {
});


Adding at the Editor Initialization

var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
var eventListeners = {
    'Event Name': function (e) {
    }
};

new SynapEditor(editorId, editorConfig, html, eventListeners);


Using Functions

var editorId = 'synapEditor';
var editorConfig = {};
var html = '';

function SynapEditorEvent Name(e) {
    // The first letter of the event name shall be capitalized
    // ex: initialized => SynapEditorInitialized
    // ex: beforeUploadImage => SynapEditorBeforeUploadImage
}

new SynapEditor(editorId, editorConfig, html);

Removing Events

Using API

editor.removeEventListener()

API used to remove an event..

editor.removeEventListener('Event Name');


Object Delivered by Functions

{
	editor: {Editor Object}, // Editor
	eventType: 'initialized', // Event Name
	cancelable: false, // Whether the event is cancelable
	returnValue: null, // Return Value
	....  

}


Cancelling Events

When cancelable is set to true, you may cancel the event by setting returnValue to false.

var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
var eventListeners = {
    'beforeUploadImage': function (e) {
		e.returnValue = false; // Upload will be no longer proceed.
    }
};

new SynapEditor(editorId, editorConfig, html, eventListeners);