Configure the root editor
editor on an individual field when it needs a different feature set.
Editor options
lexicalEditor accepts one optional object. Call it with no argument or {} to use the recommended feature set and the built-in Lexical configuration.
Extend the editor with features
Features add nodes, converters, toolbar controls, and other editor behavior.features accepts an array or a function. The function receives the recommended defaults and the features configured on the root editor.
Feature function arguments
See Official features for the complete built-in set.
If you omit
defaultFeatures, the editor starts with no features. This is useful when you want a deliberately small editor rather than the recommended feature set.
TypeScript
Each serialized node type starts withSerialized, such as SerializedUploadNode. Use TypedEditorState when you want an exact union of allowed nodes:
DefaultTypedEditorState includes all nodes from the default feature set and accepts additional node types as its generic argument.
SerializedEditorState from @frogbotai/richtext-lexical/lexical when code accepts any serialized editor state.
Use types exported by @frogbotai/richtext-lexical rather than importing equivalent types from Lexical’s internal packages. FrogBot controls and tests the public wrapper types.
Admin customization
The editor’sadmin property supports these options:
Detect an empty state
After an editor has been changed, deleting all visible content may leave an empty paragraph in its JSON value. UsehasText when you need to distinguish content from an empty editor state: