Function: useEditor()
ts
function useEditor(options): Editor;Create an editor for the lifetime of the component.
- The editor is created once.
contentandlabelare read on creation only; useeditor.setContent()to replace the document later. editableis applied whenever it changes.onChange,onFocusandonBluralways call the latest callback.- The editor is destroyed when the component unmounts.
Parameters
| Parameter | Type |
|---|---|
options | UseEditorOptions |
Returns
Example
tsx
const editor = useEditor({ extensions, content: initial, label: 'Article text' })
return <EditorContent editor={editor} />