Events
change, paste, upload and the rest.
| Event | Value | When |
|---|---|---|
change | HTML | After content changes (batched 150 ms, never mid-composition) |
input | - | On every input |
focus / blur | - | Focus |
ready | - | After the first render |
selectionchange | - | Caret or selection moved |
paste | { html, raw, source } | After cleanup, before insertion. source is 'word' | 'excel' | 'hwp' | 'gdocs' | 'web' | 'text'. Return a string to insert that instead |
upload:start · upload:progress · upload:success · upload:error | { file, … } | Image upload steps |
fullscreen / source | boolean | Fullscreen or source view toggled |
maxlength | { length, max } | The character limit was passed |
destroy | - | Right before removal |
editor.on('change', (html) => saveDraft(html));
// adjust pastes by source
editor.on('paste', ({ html, source }) => {
if (source === 'word') return html.replace(/font-family:[^;"]+;?/g, '');
});