Page tree

Versions Compared

Key

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

Status
colourYellow
title릴리즈 2.3.0 이상

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

이벤트 등록

...

API 사용

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

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

...

함수방식

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

function SynapEditorAfterOpenDocument(e) {
}

new SynapEditor(editorId, editorConfig, html);

...

에디터 초기화시 등록

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

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

함수로 전달되는 객체 형태

함수로 전달되는 파라미터 e의 형식

Code Block
languagejs
titlee
{
	editor: SynapEditor,
	eventType:  'afterOpenDocument',
	cancelable: true,
	returnValue: null,
	fileType: 'WORD', // 파일 타입 ('HTML', 'WORD', 'CELL', ...)
	path: '/upload/path/filename.docx', // 임포트 경로
	...... // 서버로부터 전달받은 Data (importPath, serializedData, .....)
}
// release 2.15.0 이상
{
	editor: SynapEditor,
	eventType:  'afterOpenDocument',
	cancelable: true,
	returnValue: null,
	fileType: 'WORD',
	path: '/upload/path/filename.docx',
    error: undefined, // [2.15.0] 임포트 실패시 에러 정보
	...... // 서버로부터 전달받은 Data (importPath, serializedData, .....)
}


임포트 실패

Status
colourYellow
title릴리즈 2.15.0 이상

2.15.0 릴리즈부터는 임포트가 실패했을 때에도 afterOpenDocument 이벤트가 발생합니다.

업로드가 실패했을 때 afterOpenDocument 이벤트에 전달되는 객체의 error 프로퍼티에 Error 객체가 전달됩니다.

임포트가 실패했을 때 에러메세지 확인 예시

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