Events and state
Observe canonical changes with the creation option onChange. It receives source, previousSource and origin. Persist source rather than parsing the view DOM.
onReady, onFocus and onBlur expose lifecycle notifications; onError handles errors. Read saving state separately through save.onStateChange. Dirty state is not the same as request failure.
Remove your own DOM listeners during host teardown. Editor destruction does not clean up arbitrary application code.
Checked code
ts
export const configuration = {
locale: 'zh-CN',
ariaLabel: 'Article content',
minHeight: 280,
readonly: false,
placeholder: 'Start writing…',
toolbarLayout: { collapsible: true, overflow: 'wrap', sticky: true },
onChange: ({ source }) => {
console.info('Canonical HTML:', source);
},
} satisfies CreateClassicEditorOptions;Checked against the published types; see imports and types for imports.