Skip to content

[lexical-website] Documentation Update: title the history page after its public API, not useHistory - #9190

Merged
etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-history-public-api
Sep 22, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
potatowagon:docs-history-public-api

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

The history concepts page is titled # useHistory and opens with "Lexical's
useHistory adds support for Undo and Redo". useHistory is an internal hook:
it lives in packages/lexical-react/src/shared/, has a single caller
(LexicalHistoryPlugin), and @lexical/react ships no export path for it — so
a reader who follows the page cannot import what it names. The page also
supplies the sidebar label, which currently reads "useHistory".

The public surfaces are registerHistory and HistoryExtension from
@lexical/history, and HistoryPlugin from
@lexical/react/LexicalHistoryPlugin. This retitles the page to "History" and
names those three. The undo-coalescing background that makes up the rest of the
page is unchanged.

Test plan

Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the check is that the page names APIs a reader can
actually import.

Before

$ grep -rn "useHistory" packages/lexical-website/docs/
packages/lexical-website/docs/concepts/history.md:1:# useHistory
packages/lexical-website/docs/concepts/history.md:3:Lexical's useHistory adds support for Undo and Redo. Part of undo and redo requires supporting coalescing [...]

$ grep -rn "useHistory" packages/lexical-react/src/LexicalHistoryPlugin.ts packages/lexical-react/src/shared/useHistory.ts
packages/lexical-react/src/LexicalHistoryPlugin.ts:13:import {useHistory} from './shared/useHistory';
packages/lexical-react/src/LexicalHistoryPlugin.ts:39:  useHistory(editor, externalHistoryState, delay);
packages/lexical-react/src/shared/useHistory.ts:18:export function useHistory(

$ python3 -c "import json;d=json.load(open('packages/lexical-react/package.json'));print([k for k in d['exports'] if 'istory' in k])"
['./LexicalHistoryPlugin', './LexicalHistoryPlugin.js']

useHistory is reachable only from inside the package.

After

$ grep -rn "useHistory" packages/lexical-website/docs/
$ head -7 packages/lexical-website/docs/concepts/history.md
# History

Lexical adds support for Undo and Redo through the `@lexical/history` package —
`registerHistory`, the `HistoryExtension` extension, or the `HistoryPlugin`
React component from `@lexical/react/LexicalHistoryPlugin`. Part of undo and redo requires supporting coalescing [...]

$ grep -n "export function registerHistory\|export const HistoryExtension" packages/lexical-history/src/index.ts
544:export function registerHistory(
761:export const HistoryExtension = defineExtension({

$ grep -n "export function HistoryPlugin" packages/lexical-react/src/LexicalHistoryPlugin.ts
30:export function HistoryPlugin({

All three named surfaces are exported. The sidebar entry (concepts/history in
packages/lexical-website/sidebars.js:55) now renders as "History".

…its public API, not useHistory

## Description

The history concepts page is titled `# useHistory` and opens with "Lexical's
useHistory adds support for Undo and Redo". `useHistory` is an internal hook:
it lives in `packages/lexical-react/src/shared/`, has a single caller
(`LexicalHistoryPlugin`), and `@lexical/react` ships no export path for it — so
a reader who follows the page cannot import what it names. The page also
supplies the sidebar label, which currently reads "useHistory".

The public surfaces are `registerHistory` and `HistoryExtension` from
`@lexical/history`, and `HistoryPlugin` from
`@lexical/react/LexicalHistoryPlugin`. This retitles the page to "History" and
names those three. The undo-coalescing background that makes up the rest of the
page is unchanged.

## Test plan

Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the check is that the page names APIs a reader can
actually import.

### Before

```
$ grep -rn "useHistory" packages/lexical-website/docs/
packages/lexical-website/docs/concepts/history.md:1:# useHistory
packages/lexical-website/docs/concepts/history.md:3:Lexical's useHistory adds support for Undo and Redo. Part of undo and redo requires supporting coalescing [...]

$ grep -rn "useHistory" packages/lexical-react/src/LexicalHistoryPlugin.ts packages/lexical-react/src/shared/useHistory.ts
packages/lexical-react/src/LexicalHistoryPlugin.ts:13:import {useHistory} from './shared/useHistory';
packages/lexical-react/src/LexicalHistoryPlugin.ts:39:  useHistory(editor, externalHistoryState, delay);
packages/lexical-react/src/shared/useHistory.ts:18:export function useHistory(

$ python3 -c "import json;d=json.load(open('packages/lexical-react/package.json'));print([k for k in d['exports'] if 'istory' in k])"
['./LexicalHistoryPlugin', './LexicalHistoryPlugin.js']
```

`useHistory` is reachable only from inside the package.

### After

```
$ grep -rn "useHistory" packages/lexical-website/docs/
$ head -7 packages/lexical-website/docs/concepts/history.md
# History

Lexical adds support for Undo and Redo through the `@lexical/history` package —
`registerHistory`, the `HistoryExtension` extension, or the `HistoryPlugin`
React component from `@lexical/react/LexicalHistoryPlugin`. Part of undo and redo requires supporting coalescing [...]

$ grep -n "export function registerHistory\|export const HistoryExtension" packages/lexical-history/src/index.ts
544:export function registerHistory(
761:export const HistoryExtension = defineExtension({

$ grep -n "export function HistoryPlugin" packages/lexical-react/src/LexicalHistoryPlugin.ts
30:export function HistoryPlugin({
```

All three named surfaces are exported. The sidebar entry (`concepts/history` in
`packages/lexical-website/sidebars.js:55`) now renders as "History".
@vercel

vercel Bot commented Sep 22, 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 22, 2026 11:35am UTC
lexical-playground Ready Ready Preview Sep 22, 2026 11:35am 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 22, 2026
@etrepum
etrepum added this pull request to the merge queue Sep 22, 2026
Merged via the queue into meta:main with commit 87289a6 Sep 22, 2026
42 checks passed
@etrepum etrepum mentioned this pull request Sep 28, 2026

This branch was successfully deployed

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