Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status
colourYellow
title릴리즈 Release 2.3.0 이상

문서가 열린 후(임포트 이후) 발생합니다.

...

or Above

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

Adding Event

Using API

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

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

...

Function

Code Block
languagejs
var editorId = 'synapEditor';
var editorConfig = {};
var html = '';

function SynapEditorAfterOpenDocument(e) {
}

new SynapEditor(editorId, editorConfig, html);

...

When the Editor is initialized

Code Block
languagejs
var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
var eventListeners = {
    afterOpenDocument: function (e) {
    }
};

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

함수로 전달되는 객체 형태

...

Object Delivered through Functions

In the form of parameter e delivered through functions

Code Block
languagejs
titlee
{
	editor: SynapEditor,
	eventType:  'afterOpenDocument',
	cancelable: true,
	returnValue: null,
	fileType: 'WORD', // 파일File 타입type ('HTML', 'WORD', 'CELL', ...)
	path: '/upload/path/filename.docx', // 임포트Import 경로path
	...... // Data transferred from the server (importPath, serializedData, .....)
}
// release 2.15.0 or above
{
	editor: SynapEditor,
	eventType:  'afterOpenDocument',
	cancelable: true,
	returnValue: null,
	fileType: 'WORD',
	path: '/upload/ 서버로부터 전달받은 Data path/filename.docx',
    error: undefined,  // [2.15.0] Error information when import fails
	...... // Data transferred from the server (importPath, serializedData, .....)
}


Import failed

Status
colourYellow
titleRelease 2.15.0 or Above

Starting with the 2.15.0 release, the afterOpenDocument event is also raised when an import fails.

When upload fails, an Error object is passed to the error property of the object passed to the afterOpenDocument event.

Example of checking error message when import fails

Code Block
languagejs
editor.setEventListener('afterOpenDocument', function (e) {
    if (e.error) {
        console.log(e.error);
    }
});