editor

이벤트

change, paste, upload 등 에디터가 보내는 이벤트.

이벤트값언제
changeHTML내용이 바뀐 뒤 (150ms 묶음, 한글 조합 중엔 보내지 않음)
input-입력할 때마다
focus / blur-포커스
ready-처음 그려진 뒤
selectionchange-커서·선택이 바뀔 때
paste{ html, raw, source }붙여넣기 정리 후, 넣기 전. source 는 'word' | 'excel' | 'hwp' | 'gdocs' | 'web' | 'text'. 핸들러가 문자열을 돌려주면 그 HTML을 넣음
upload:start · upload:progress · upload:success · upload:error{ file, … }이미지 업로드 단계
fullscreen / sourceboolean전체화면·소스 보기 전환
maxlength{ length, max }글자 수 제한을 넘었을 때
destroy-없어지기 직전
editor.on('change', (html) => saveDraft(html));

// 붙여넣기 출처별로 손보기
editor.on('paste', ({ html, source }) => {
  if (source === 'hwp') return html.replace(/font-family:[^;"]+;?/g, '');
});