Page tree
Skip to end of metadata
Go to start of metadata

RELEASE 2.2.0 OR ABOVE

This event occurs before an image is uploaded. This event can be cancelled.

Adding Event: Using API

var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
var editor = new SynapEditor(editorId, editorConfig, html);


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

Adding Event: Function

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

function SynapEditorBeforeUploadImage(e) {
}

new SynapEditor(editorId, editorConfig, html);

Adding Event: When the Editor is initialized

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

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

Object Delivered through Functions

In the form of parameter e delivered through functions

e
// release 2.2.0
{
	editor: SynapEditor,
	eventType:  'beforeUploadImage',
	cancelable: true,
	returnValue: null,
	fileName: 'filename.png', // Name of the file to upload
	isBackground: false // Whether the image is a background image
}

// release 2.2.1 or above
{
	editor: SynapEditor,
	eventType:  'beforeUploadImage',
	cancelable: true,
	returnValue: null,
	fileType: 'image', // [2.2.1] File type
	fileName: 'filename.png',
	isBackground: false,
	uploadCount: 0 // [2.2.1] Number of files being uploaded (the number of files to be uploaded whose upload is not completed yet)
}

// release 2.14.6 or above
{
	editor: SynapEditor,
	eventType:  'beforeUploadImage',
	cancelable: true,
	returnValue: null,
	fileType: 'image', 
	fileName: 'filename.png',
    fileSize: 100, // [2.14.6] File size (Unit: Byte)
	isBackground: false,
	uploadCount: 0
}
  • No labels