@lexical/react/LexicalComposer
Type Aliases
InitialConfigType
InitialConfigType =
Readonly<{editable?:boolean;editorState?:InitialEditorStateType;html?:HTMLConfig;namespace:string;nodes?:ReadonlyArray<Klass<LexicalNode> |LexicalNodeReplacement>;onError: (error,editor) =>void;theme?:EditorThemeClasses; }>
Defined in: packages/lexical-react/src/LexicalComposer.tsx:66
InitialEditorStateType
InitialEditorStateType =
null|string|EditorState| ((editor) =>void)
Defined in: packages/lexical-react/src/LexicalComposer.tsx:60
The initial editor state accepted by LexicalComposer via
initialConfig.editorState. Each variant is handled differently:
null— skip default initialization entirely. The root is left with no children for an external owner (typically the collaboration plugin and its Yjs document) to populate.string— a JSON string produced by serializing anEditorState. Parsed with LexicalEditor.parseEditorState and applied via LexicalEditor.setEditorState.EditorState— applied directly via LexicalEditor.setEditorState.(editor) => void— an updater run insideeditor.update(...). Invoked only when the root is still empty, so it will not overwrite content bootstrapped by another mechanism, and is silently skipped if the root already has children.
Note that string and EditorState inputs go through setEditorState,
which throws when the parsed state satisfies EditorState.isEmpty() (root
with no children and no selection). The empty serialization produced by
initializing with null and never modifying the editor falls into this
category, so it cannot be re-applied via setEditorState after a round-trip.
Functions
LexicalComposer()
LexicalComposer(
__namedParameters):Element
Defined in: packages/lexical-react/src/LexicalComposer.tsx:90
Parameters
__namedParameters
Props
Returns
Element