Repository navigation
[lexical-website] Documentation Update: correct DOMExportOutput, DOMConversion priority, and the HeadingNode examples - #9223
Merged
Conversation
…onversion priority, and the HeadingNode examples
## Description
Three corrections in `serialization/serialization.md`:
1. **`DOMExportOutput` is reproduced with Flow syntax and the wrong types** —
`element` is shown as optional and `HTMLElement`-only, and `after` uses
Flow's `?T`. In source `element` is required and both it and `after` accept
`HTMLElement | DocumentFragment | Text | null`.
2. **`DOMConversion.priority` is shown as required** — it is optional.
3. **The `exportJSON` / `importJSON` / `updateFromJSON` bodies are introduced
as "an example ... for the `HeadingNode`"** — the shipped `HeadingNode`
implements none of them. It declares only overload signatures and
serializes through `$config`'s `json: headingNodeSchema`. The snippets
themselves are still valid, supported code, so they stay; they are
reworded as illustration and a note points at the declarative-schema
section the node actually uses.
## Test plan
Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the check is that the reproduced types and the
attribution match source.
### Before
```
$ sed -n '45,48p' packages/lexical-website/docs/serialization/serialization.md
export type DOMExportOutput = {
after?: (generatedElement: ?HTMLElement) => ?HTMLElement,
element?: HTMLElement | null,
};
$ sed -n '138,141p' packages/lexical-website/docs/serialization/serialization.md
type DOMConversion = {
conversion: DOMConversionFn;
priority: 0 | 1 | 2 | 3 | 4;
};
$ grep -n "example of .exportJSON.\|example of .importJSON." packages/lexical-website/docs/serialization/serialization.md
409:Here's an example of `exportJSON` for the `HeadingNode`:
444:Here's an example of `importJSON` for the `HeadingNode`:
$ grep -n "^ exportJSON(\|^ static importJSON(\|^ updateFromJSON(" packages/lexical-rich-text/src/index.ts
352: exportJSON(compact?: false): SerializedHeadingNode;
353: exportJSON(compact: boolean): SerializedPartial<SerializedHeadingNode>;
354: updateFromJSON(serializedNode: LexicalParseJSON<SerializedHeadingNode>): this;
```
Those three lines are declaration-merging overload signatures in an
`interface`, not implementations — `HeadingNode`'s class body has none.
### After
```
$ sed -n '45,51p' packages/lexical-website/docs/serialization/serialization.md
export interface DOMExportOutput {
after?: (
generatedElement: HTMLElement | DocumentFragment | Text | null | undefined,
) => HTMLElement | DocumentFragment | Text | null | undefined;
element: HTMLElement | DocumentFragment | Text | null;
}
$ sed -n '141,144p' packages/lexical-website/docs/serialization/serialization.md
type DOMConversion = {
conversion: DOMConversionFn;
priority?: 0 | 1 | 2 | 3 | 4;
};
$ grep -n "no longer writes" packages/lexical-website/docs/serialization/serialization.md
412:(the shipped `HeadingNode` no longer writes this by hand — see the note below):
464:The shipped `HeadingNode` no longer writes any of these three methods by
```
Sources: `packages/lexical/src/LexicalNode.ts:885-900` (`DOMExportOutput`) and
`:854-857` (`DOMConversion`); `packages/lexical-rich-text/src/index.ts:341-347`
(`headingNodeSchema`) and `:400` (`json: headingNodeSchema` in `$config`).
potatowagon
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7 and
zurfyx
as code owners
September 24, 2026 16:46
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
approved these changes
Sep 24, 2026
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Three corrections in
serialization/serialization.md:DOMExportOutputis reproduced with Flow syntax and the wrong types —elementis shown as optional andHTMLElement-only, andafterusesFlow's
?T. In sourceelementis required and both it andafteracceptHTMLElement | DocumentFragment | Text | null.DOMConversion.priorityis shown as required — it is optional.exportJSON/importJSON/updateFromJSONbodies are introducedas "an example ... for the
HeadingNode" — the shippedHeadingNodeimplements none of them. It declares only overload signatures and
serializes through
$config'sjson: headingNodeSchema. The snippetsthemselves are still valid, supported code, so they stay; they are
reworded as illustration and a note points at the declarative-schema
section the node actually uses.
Test plan
Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the check is that the reproduced types and theattribution match source.
Before
Those three lines are declaration-merging overload signatures in an
interface, not implementations —HeadingNode's class body has none.After
Sources:
packages/lexical/src/LexicalNode.ts:885-900(DOMExportOutput) and:854-857(DOMConversion);packages/lexical-rich-text/src/index.ts:341-347(
headingNodeSchema) and:400(json: headingNodeSchemain$config).