onSelection

2.6.0 버전부터 지원합니다.

캐럿 이동이나 선택 영역 확장과 같은 선택 동작이 일어날 때 발생합니다.

이벤트 등록: API 사용

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

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

이벤트 등록: 함수 방식

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

function SynapEditorOnSelection(e) {
}

new SynapEditor(editorId, editorConfig, html);

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

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

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

함수에 전달된 객체의 Shape

함수에 전달되는 매개변수 e의 형태는 다음과 같습니다.

e = {
    editor: SynapEditor,
    eventType: 'onSelection',
    isFinish: true,         // after 2.15.0, Whether the selection is over
    cancelable: false,
    returnValue: null,
    selection: Selection
}