Lexical Workbench
Overview
Use the local Lexical docs and source tree in docs/lexical to answer questions, plan changes, and implement fixes for Lexical editor behavior, plugins, nodes, or extensions.
Workflow
- •Identify the task type (core editor, selection/commands, node/serialization, plugin/React, extensions, transforms/theming).
- •Open the relevant docs under
docs/lexical/packages/lexical-website/docs(seereferences/lexical-docs-map.md). - •Locate the implementation in
docs/lexical/packages/*and confirm the API or pattern before changing code. - •Apply changes in the target project, keeping Lexical update/read rules and selection constraints in mind.
Core Practices
- •Use
$helpers only insideeditor.update,editor.read, or implicit update contexts (transforms/command handlers). - •Prefer
editor.getEditorState().read()when you need reconciled state; avoid mixing update/read contexts. - •When building UI plugins, track scroll/selection changes and place UI relative to the correct scroll container.
- •For custom nodes, implement required static/instance methods and register nodes in editor config.
- •For extensions, follow the extension design docs and locate existing extension patterns in
lexical-reactandlexical-extensionpackages.
Resources
- •Read
references/lexical-docs-map.mdfor a map of relevant docs and source locations. - •Read
docs/lexical/AGENTS.mdwhen you need Lexical build/test commands or repo architecture details.