Skip to content

[lexical-website] Documentation Update: fix five incorrect snippets and claims in the React plugins guide - #9254

Merged
etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-react-plugins-fixes
Sep 28, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-react-plugins-fixes

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

Five corrections in react/plugins.md, all against the components it
documents:

  1. The intro PlainTextPlugin snippet omits the required ErrorBoundary
    prop
    and passes placeholder to the plugin. ErrorBoundary is
    non-optional, and placeholder on the plugin is marked "TODO Remove. This
    property is now part of ContentEditable". Every other PlainTextPlugin
    snippet on the page already does it the right way; this brings the first
    one into line and imports LexicalErrorBoundary.
  2. The CollaborationPlugin example renders the plugin bare.
    useCollaborationContext asserts the context is present, and
    devInvariant throws outside production, so the snippet as written throws
    in development. The plugin's own jsdoc says "Must be used within a
    LexicalCollaboration provider".
  3. headingTag is documented as "either 'h1', 'h2', or 'h3'".
    HeadingTagType is 'h1'–'h6', and TableOfContentsPlugin collects
    every $isHeadingNode child with no tag filter.
  4. The LexicalAutoLinkPlugin section has no registration note, unlike
    the Link, HorizontalRule, Hashtag, AutoEmbed and CharacterLimit sections.
    The plugin hard-fails with an invariant when AutoLinkNode is missing.
  5. EmbedConfig is imported as a value. It is a type-only export, so the
    runtime import has no such binding.

Test plan

Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the checks are the props' types and the exports.

Before

$ sed -n '33,36p' packages/lexical-website/docs/react/plugins.md
  <PlainTextPlugin
    contentEditable={<ContentEditable />}
    placeholder={<div>Enter some text...</div>}
  />

$ grep -n "ErrorBoundary: ErrorBoundaryType\|TODO Remove" packages/lexical-react/src/LexicalPlainTextPlugin.tsx
33:   * TODO Remove. This property is now part of ContentEditable
42:  ErrorBoundary: ErrorBoundaryType;

$ grep -n "LexicalCollaboration" packages/lexical-website/docs/react/plugins.md
$ sed -n '98,101p' packages/lexical-react/src/LexicalCollaborationContextUtils.ts
  devInvariant(
    collabContext != null,
    'useCollaborationContext: no context provider found',
  );

$ grep -n "headingTag\`: A string" packages/lexical-website/docs/react/plugins.md
427:`headingTag`: A string that reads either 'h1', 'h2', or 'h3'.

$ grep -n "export type HeadingTagType" packages/lexical-rich-text/src/index.ts
338:export type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';

$ awk 'NR>=313 && NR<=350 && /Requires/' packages/lexical-website/docs/react/plugins.md
$ grep -n -A3 "invariant(" packages/lexical-react/src/LexicalAutoLinkPlugin.ts
35:      invariant(
36-        false,
37-        'LexicalAutoLinkPlugin: AutoLinkNode not registered on editor',

$ grep -n "EmbedConfig, AutoEmbedOption" packages/lexical-website/docs/react/plugins.md
356:import {LexicalAutoEmbedPlugin, EmbedConfig, AutoEmbedOption} from '@lexical/react/LexicalAutoEmbedPlugin';

$ grep -n "type EmbedConfig" packages/lexical-react/src/LexicalAutoEmbedPlugin.tsx
41:  type EmbedConfig,

After

$ sed -n '34,39p' packages/lexical-website/docs/react/plugins.md
  <PlainTextPlugin
    contentEditable={
      <ContentEditable placeholder={<div>Enter some text...</div>} />
    }
    ErrorBoundary={LexicalErrorBoundary}
  />

$ grep -n "LexicalCollaboration>" packages/lexical-website/docs/react/plugins.md
471:<LexicalCollaboration>
481:</LexicalCollaboration>

$ grep -n "headingTag\`:" packages/lexical-website/docs/react/plugins.md
433:`headingTag`: The heading's tag — `'h1'` through `'h6'`. Every heading in the document is listed; the plugin does not filter by level.

$ awk 'NR>=313 && NR<=325 && /Requires/' packages/lexical-website/docs/react/plugins.md
> Note: Requires `AutoLinkNode` from `@lexical/link` to be registered.

$ sed -n '361,362p' packages/lexical-website/docs/react/plugins.md
import {LexicalAutoEmbedPlugin, AutoEmbedOption} from '@lexical/react/LexicalAutoEmbedPlugin';
import type {EmbedConfig} from '@lexical/react/LexicalAutoEmbedPlugin';

LexicalCollaboration is exported from
@lexical/react/LexicalCollaborationContext
(packages/lexical-react/src/LexicalCollaborationContext.tsx:29), which is a
published subpath. The registration note is worded to match the five sibling
sections that already carry one.

…nd claims in the React plugins guide

## Description

Five corrections in `react/plugins.md`, all against the components it
documents:

1. **The intro `PlainTextPlugin` snippet omits the required `ErrorBoundary`
   prop** and passes `placeholder` to the plugin. `ErrorBoundary` is
   non-optional, and `placeholder` on the plugin is marked "TODO Remove. This
   property is now part of ContentEditable". Every other `PlainTextPlugin`
   snippet on the page already does it the right way; this brings the first
   one into line and imports `LexicalErrorBoundary`.
2. **The `CollaborationPlugin` example renders the plugin bare.**
   `useCollaborationContext` asserts the context is present, and
   `devInvariant` throws outside production, so the snippet as written throws
   in development. The plugin's own jsdoc says "Must be used within a
   `LexicalCollaboration` provider".
3. **`headingTag` is documented as "either 'h1', 'h2', or 'h3'".**
   `HeadingTagType` is `'h1'`–`'h6'`, and `TableOfContentsPlugin` collects
   every `$isHeadingNode` child with no tag filter.
4. **The `LexicalAutoLinkPlugin` section has no registration note**, unlike
   the Link, HorizontalRule, Hashtag, AutoEmbed and CharacterLimit sections.
   The plugin hard-fails with an invariant when `AutoLinkNode` is missing.
5. **`EmbedConfig` is imported as a value.** It is a type-only export, so the
   runtime import has no such binding.

## Test plan

Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the checks are the props' types and the exports.

### Before

```
$ sed -n '33,36p' packages/lexical-website/docs/react/plugins.md
  <PlainTextPlugin
    contentEditable={<ContentEditable />}
    placeholder={<div>Enter some text...</div>}
  />

$ grep -n "ErrorBoundary: ErrorBoundaryType\|TODO Remove" packages/lexical-react/src/LexicalPlainTextPlugin.tsx
33:   * TODO Remove. This property is now part of ContentEditable
42:  ErrorBoundary: ErrorBoundaryType;

$ grep -n "LexicalCollaboration" packages/lexical-website/docs/react/plugins.md
$ sed -n '98,101p' packages/lexical-react/src/LexicalCollaborationContextUtils.ts
  devInvariant(
    collabContext != null,
    'useCollaborationContext: no context provider found',
  );

$ grep -n "headingTag\`: A string" packages/lexical-website/docs/react/plugins.md
427:`headingTag`: A string that reads either 'h1', 'h2', or 'h3'.

$ grep -n "export type HeadingTagType" packages/lexical-rich-text/src/index.ts
338:export type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';

$ awk 'NR>=313 && NR<=350 && /Requires/' packages/lexical-website/docs/react/plugins.md
$ grep -n -A3 "invariant(" packages/lexical-react/src/LexicalAutoLinkPlugin.ts
35:      invariant(
36-        false,
37-        'LexicalAutoLinkPlugin: AutoLinkNode not registered on editor',

$ grep -n "EmbedConfig, AutoEmbedOption" packages/lexical-website/docs/react/plugins.md
356:import {LexicalAutoEmbedPlugin, EmbedConfig, AutoEmbedOption} from '@lexical/react/LexicalAutoEmbedPlugin';

$ grep -n "type EmbedConfig" packages/lexical-react/src/LexicalAutoEmbedPlugin.tsx
41:  type EmbedConfig,
```

### After

```
$ sed -n '34,39p' packages/lexical-website/docs/react/plugins.md
  <PlainTextPlugin
    contentEditable={
      <ContentEditable placeholder={<div>Enter some text...</div>} />
    }
    ErrorBoundary={LexicalErrorBoundary}
  />

$ grep -n "LexicalCollaboration>" packages/lexical-website/docs/react/plugins.md
471:<LexicalCollaboration>
481:</LexicalCollaboration>

$ grep -n "headingTag\`:" packages/lexical-website/docs/react/plugins.md
433:`headingTag`: The heading's tag — `'h1'` through `'h6'`. Every heading in the document is listed; the plugin does not filter by level.

$ awk 'NR>=313 && NR<=325 && /Requires/' packages/lexical-website/docs/react/plugins.md
> Note: Requires `AutoLinkNode` from `@lexical/link` to be registered.

$ sed -n '361,362p' packages/lexical-website/docs/react/plugins.md
import {LexicalAutoEmbedPlugin, AutoEmbedOption} from '@lexical/react/LexicalAutoEmbedPlugin';
import type {EmbedConfig} from '@lexical/react/LexicalAutoEmbedPlugin';
```

`LexicalCollaboration` is exported from
`@lexical/react/LexicalCollaborationContext`
(`packages/lexical-react/src/LexicalCollaborationContext.tsx:29`), which is a
published subpath. The registration note is worded to match the five sibling
sections that already carry one.
@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 28, 2026
@vercel

vercel Bot commented Sep 28, 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 28, 2026 7:59am UTC
lexical-playground Ready Ready Preview Sep 28, 2026 7:59am UTC

Request Review

@etrepum
etrepum added this pull request to the merge queue Sep 28, 2026
Merged via the queue into meta:main with commit 2fbf24d Sep 28, 2026
42 checks passed
@zurfyx zurfyx mentioned this pull request Oct 27, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — 3a752085 Deployed Sep 28, 2026 by vercel[bot]
Preview – lexical-playground — 3a752085 Deployed Sep 28, 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