Skip to content

[lexical-website] Documentation Update: fix seven incorrect API references in the DOM import guide - #9222

Merged
etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-dom-import-fixes
Sep 24, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-dom-import-fixes

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

Seven corrections in serialization/dom-import.md, all against the code the
page documents:

  1. $createQuoteNode imported from @lexical/html — that package exports
    no such symbol; it lives in @lexical/rich-text.
  2. The ClipboardImportExtension example names its third handler parameter
    editor
    and passes it to $insertGeneratedNodes. The third parameter is
    $next: () => boolean. The page's own prose two paragraphs earlier states
    the correct signature, and the real handler in ClipboardImportExtension
    uses $getEditor() — so the example now does too.
  3. sel.attr('target', 'true') commented "attribute present" — a string
    argument is an exact-value match (it matches target="true" and nothing
    else). Presence is the boolean true overload.
  4. sel.styleAny('fontSize', …) — the property is read through CSSOM
    getPropertyValue, which needs the dashed name. 'fontSize' returns '',
    so the selector can never match.
  5. ImportOverlays described as {dispatch: CompiledDispatch}[] — it
    holds readonly CompiledOverlayRules[].
  6. "see the INLINE_TAG_RE / BLOCK_TAG_RE exports" — both are
    module-private constants, not exported from lexical.
  7. "rejected blocks hoist out" — InlineSchema declares no onReject, so
    rejected runs are dropped ('drop' is the default). The same page's table
    already says "Dropped".

Test plan

Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the check is that each reference matches source.

Before

$ grep -n "createQuoteNode\|attr('target'\|styleAny('fontSize'\|CompiledDispatch\|INLINE_TAG_RE" packages/lexical-website/docs/serialization/dom-import.md
262:sel.tag('a').attr('target', 'true')             // attribute present
264:sel.tag('span').styleAny('fontSize', /^(\d+)pt/) // inline-style match
551:- **`ImportOverlays`** — session slot (`{dispatch: CompiledDispatch}[]`)
584:see the `INLINE_TAG_RE` / `BLOCK_TAG_RE` exports if you want to
1142:        conversion: (_el) => ({node: $createQuoteNode()}),
1154:  $createQuoteNode,
1163:    const node = $createQuoteNode();

$ grep -rn "createQuoteNode" packages/lexical-html/src | wc -l
0
$ grep -n "INLINE_TAG_RE\|BLOCK_TAG_RE" packages/lexical/src/index.ts | wc -l
0

$ sed -n '969,971p' packages/lexical-website/docs/serialization/dom-import.md
      (data, selection, editor) => {
        const nodes = parseMyAppFormat(data);
        $insertGeneratedNodes(editor, nodes, selection);

After

$ sed -n '262,264p' packages/lexical-website/docs/serialization/dom-import.md
sel.tag('a').attr('target', true)               // attribute present
sel.tag('span').styleAny('font-size', /^(\d+)pt/) // inline-style match

$ sed -n '969,971p' packages/lexical-website/docs/serialization/dom-import.md
      (data, selection) => {
        const nodes = parseMyAppFormat(data);
        $insertGeneratedNodes($getEditor(), nodes, selection);

$ grep -n "createQuoteNode} from" packages/lexical-website/docs/serialization/dom-import.md
1159:import {$createQuoteNode} from '@lexical/rich-text';

Sources: packages/lexical-rich-text/src/index.ts:321 ($createQuoteNode);
packages/lexical-clipboard/src/ClipboardImportExtension.ts:67-72
(ImportMimeTypeFunction) and :550 (the real handler's $getEditor());
packages/lexical-html/src/import/sel.ts:164-168 (value === true is the
presence test) and :214 (node.style.getPropertyValue(prop));
packages/lexical-html/src/import/ImportContext.ts:265-270
(readonly CompiledOverlayRules[]);
packages/lexical/src/LexicalUtils.ts:2684,2703 (both const, absent from
packages/lexical/src/index.ts);
packages/lexical-html/src/import/schemas.ts:240-243 (InlineSchema has no
onReject) with the 'drop' default at import/types.ts:320.

…ences in the DOM import guide

## Description

Seven corrections in `serialization/dom-import.md`, all against the code the
page documents:

1. **`$createQuoteNode` imported from `@lexical/html`** — that package exports
   no such symbol; it lives in `@lexical/rich-text`.
2. **The `ClipboardImportExtension` example names its third handler parameter
   `editor`** and passes it to `$insertGeneratedNodes`. The third parameter is
   `$next: () => boolean`. The page's own prose two paragraphs earlier states
   the correct signature, and the real handler in `ClipboardImportExtension`
   uses `$getEditor()` — so the example now does too.
3. **`sel.attr('target', 'true')` commented "attribute present"** — a string
   argument is an exact-value match (it matches `target="true"` and nothing
   else). Presence is the boolean `true` overload.
4. **`sel.styleAny('fontSize', …)`** — the property is read through CSSOM
   `getPropertyValue`, which needs the dashed name. `'fontSize'` returns `''`,
   so the selector can never match.
5. **`ImportOverlays` described as `{dispatch: CompiledDispatch}[]`** — it
   holds `readonly CompiledOverlayRules[]`.
6. **"see the `INLINE_TAG_RE` / `BLOCK_TAG_RE` exports"** — both are
   module-private constants, not exported from `lexical`.
7. **"rejected blocks hoist out"** — `InlineSchema` declares no `onReject`, so
   rejected runs are dropped (`'drop'` is the default). The same page's table
   already says "Dropped".

## Test plan

Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the check is that each reference matches source.

### Before

```
$ grep -n "createQuoteNode\|attr('target'\|styleAny('fontSize'\|CompiledDispatch\|INLINE_TAG_RE" packages/lexical-website/docs/serialization/dom-import.md
262:sel.tag('a').attr('target', 'true')             // attribute present
264:sel.tag('span').styleAny('fontSize', /^(\d+)pt/) // inline-style match
551:- **`ImportOverlays`** — session slot (`{dispatch: CompiledDispatch}[]`)
584:see the `INLINE_TAG_RE` / `BLOCK_TAG_RE` exports if you want to
1142:        conversion: (_el) => ({node: $createQuoteNode()}),
1154:  $createQuoteNode,
1163:    const node = $createQuoteNode();

$ grep -rn "createQuoteNode" packages/lexical-html/src | wc -l
0
$ grep -n "INLINE_TAG_RE\|BLOCK_TAG_RE" packages/lexical/src/index.ts | wc -l
0

$ sed -n '969,971p' packages/lexical-website/docs/serialization/dom-import.md
      (data, selection, editor) => {
        const nodes = parseMyAppFormat(data);
        $insertGeneratedNodes(editor, nodes, selection);
```

### After

```
$ sed -n '262,264p' packages/lexical-website/docs/serialization/dom-import.md
sel.tag('a').attr('target', true)               // attribute present
sel.tag('span').styleAny('font-size', /^(\d+)pt/) // inline-style match

$ sed -n '969,971p' packages/lexical-website/docs/serialization/dom-import.md
      (data, selection) => {
        const nodes = parseMyAppFormat(data);
        $insertGeneratedNodes($getEditor(), nodes, selection);

$ grep -n "createQuoteNode} from" packages/lexical-website/docs/serialization/dom-import.md
1159:import {$createQuoteNode} from '@lexical/rich-text';
```

Sources: `packages/lexical-rich-text/src/index.ts:321` (`$createQuoteNode`);
`packages/lexical-clipboard/src/ClipboardImportExtension.ts:67-72`
(`ImportMimeTypeFunction`) and `:550` (the real handler's `$getEditor()`);
`packages/lexical-html/src/import/sel.ts:164-168` (`value === true` is the
presence test) and `:214` (`node.style.getPropertyValue(prop)`);
`packages/lexical-html/src/import/ImportContext.ts:265-270`
(`readonly CompiledOverlayRules[]`);
`packages/lexical/src/LexicalUtils.ts:2684,2703` (both `const`, absent from
`packages/lexical/src/index.ts`);
`packages/lexical-html/src/import/schemas.ts:240-243` (`InlineSchema` has no
`onReject`) with the `'drop'` default at `import/types.ts:320`.
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Sep 24, 2026 4:47pm UTC
lexical-playground Ready Ready Preview Sep 24, 2026 4:47pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 24, 2026
@etrepum
etrepum added this pull request to the merge queue Sep 24, 2026
Merged via the queue into meta:main with commit a7fd42e Sep 24, 2026
42 checks passed
@etrepum etrepum mentioned this pull request Sep 28, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — e4fa7a50 Deployed Sep 24, 2026 by vercel[bot]
Preview – lexical-playground — e4fa7a50 Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants