...
이벤트 이름 | 버전 | 설명 | ||||
---|---|---|---|---|---|---|
initialized |
| 에디터가 초기화되었을 때 발생합니다 | ||||
beforeUploadImage |
| 이미지를 업로드 하기 전에 발생합니다 | ||||
afterUploadImage |
| 이미지를 업로드 한 후 발생합니다 | ||||
beforeUploadVideo |
| 비디오를 업로드 하기 전에 발생합니다 | ||||
afterUploadVideo |
| 비디오를 업로드 한 후 발생합니다 | ||||
beforeUploadFile |
| 파일을 업로드 하기 전에 발생합니다 | ||||
afterUploadFile |
| 파일을 업로드 한 후 발생합니다 |
이벤트 등록
API 사용
editor.setEventListener()
이벤트를 등록 할 때 사용하는 API입니다.
1 |
|
에디터 초기화시 등록
1 | var editorId = 'synapEditor'; var editorConfig = {}; var html = ''; var eventListeners = { '이벤트이름': function (e) { } }; new SynapEditor(editorId, editorConfig, html, eventListeners); |
...
함수방식 사용
editor.setEventListener()
이벤트를 등록 할 때 사용하는 API입니다.
1
2
editor.setEventListener(
'이벤트이름'
,
function
(event) {
}
1 | var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
function SynapEditor이벤트이름(e) { // 이벤트 이름은 첫자가 대문자 // ex: initialized => SynapEditorInitialized // ex: beforeUploadImage => SynapEditorBeforeUploadImage } new SynapEditor(editorId, editorConfig, html); |
이벤트 해제
editor.removeEventListener()
...
1 |
|
...
이벤트 설명
1. initialized
Status | ||
---|---|---|
|
함수방식
Code Block | ||
---|---|---|
| ||
var editorId = 'synapEditor'; var editorConfig = {}; var html = ''; function SynapEditorInitialized(e) { // editor 초기화 완료시 실행 (async) var editor = e.editor; } function SynapEditorInitializedSync(e) { // editor 초기화 완료시 실행 (sync) var editor = e.editor; } new SynapEditor(editorId, editorConfig, html); |
콜백방식
Code Block | ||
---|---|---|
| ||
var editorId = 'synapEditor'; var editorConfig = {}; var html = ''; var eventListeners = { initialized: function (e) { // editor 초기화 완료시 실행 (async) var editor = e.editor; }, initializedSync: function (e) { // editor 초기화 완료시 실행 (sync) var editor = e.editor; } }; new SynapEditor(editorId, editorConfig, html, eventListeners); |
함수로 전달되는 객체 형태
위 코드에서 사용되는 파라미터 e의 형식
Code Block | ||||
---|---|---|---|---|
| ||||
{ editor: {에디터 객체}, eventType: 'initialized', cancelable: false, returnValue: null } |
...