API Reference
Events
onChange, onBlur, onFocus, onReady — and their per-framework names.
Events
| Angular | React | Vue | Vanilla | Payload |
|---|---|---|---|---|
ngModelChange or form control value | onChange | update:modelValue (via v-model) | onChange | HTML string (CustomEvent.detail in React) |
| (form touched) | onBlur | @editor-blur | onBlur | — |
| — | onFocus | @editor-focus | onFocus | — |
(editorReady) | onReady | @editor-ready | onReady | Tiptap Editor instance |
Storing content verbatim
The editor tracks its current HTML internally. Whatever onChange / editor-change gives you,
store it exactly as received — never trim, reformat, or sanitize it in the change handler.
Sanitize at save time instead:
// Wrong — any transformation here breaks content identity and can loop
onEditorChange(html: string): void {
this.content = html.trim();
}
// Correct — store verbatim, sanitize only when you actually submit
onEditorChange(html: string): void {
this.content = html;
}
saveToServer(): void {
const safeHtml = DOMPurify.sanitize(this.content);
this._api.save(safeHtml).subscribe();
}See Preventing the infinite update loop for why this matters.
