문서를 내보내기 전에 발생합니다.

이벤트 객체를 통해 내보내기 API, Request Header, Parameter를 변경할 수 있습니다.

이벤트 등록: API 사용

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


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

이벤트 등록: 함수방식

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

function SynapEditorBeforeExportFile(e) {
}

new SynapEditor(editorId, editorConfig, html);

이벤트 등록: 에디터 초기화시 등록

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

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

함수로 전달되는 객체 형태

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

// release 3.3.2603 이상
{
	editor: SynapEditor,
	eventType:  'beforeExportFile',
	cancelable: false,
	returnValue: null,
	fileName: 'exportFileName',  // defalut: 'untitled'
    pageOrientation: 'portrait', // 'portrait'(defalut) | 'landscape',
    exportFileFormat: 'hwpx'     // 'docx' | 'hwpx'(defalut) | 'hwp'
}


API

event.setApi(api)

이벤트 객체를 통해 업로드 API를 설정할 수 있습니다.

{
    beforeExportFile: function (e) {
		e.setApi('newExportURL');
    }
}

event.addHeader(key, value)

이벤트 객체를 통해 Request Header를 설정할 수 있습니다.

{
    beforeExportFile: function (e) {
		e.addHeader('X-Hello', 'World');
    }
}

event.addParameter(key, value)

이벤트 객체를 통해 Parameter를 설정할 수 있습니다.

{
    beforeExportFile: function (e) {
		e.addParameter('hello', 'world');
    }
}