Repository navigation
[lexical-website][examples] Documentation: Modernize the getting-started section - #9237
Merged
Merged
Conversation
…tarted guides
## Description
The getting started guides and their runnable examples still teach manual editor
registration and legacy React behavior plugins. Rewrite the vanilla, React,
theming, and custom-feature guides around one module-level root extension.
Migrate the vanilla, emoji, React rich-text, and React plain-text examples to
buildEditorFromExtensions or LexicalExtensionComposer. Compose editing, history,
autofocus, HTML paste, and debug views through extensions. Use extension signals
for toolbar state and move custom HTML handling into an import/export extension.
Teach $initialEditorState, editor disposal, update-listener cleanup, and saving
JSON. Convert the emoji node to $config and NodeState while retaining its flat
unifiedID JSON field and preserving formatting. Bundle emoji image URLs correctly
in development and production. Keep existing guide/example URLs and update the
gallery's link to EmojiExtension.ts.
## Test plan
### Before
Inspection of the original getting started pages:
```
git grep -l -E 'createEditor|LexicalComposer|registerRichText|registerEmoji' HEAD -- packages/lexical-website/docs/getting-started
HEAD:packages/lexical-website/docs/getting-started/creating-plugin.md
HEAD:packages/lexical-website/docs/getting-started/quick-start.md
HEAD:packages/lexical-website/docs/getting-started/react.md
HEAD:packages/lexical-website/docs/getting-started/theming.md
```
The original emoji asset pattern also produced this warning during the initial
production build:
```
new URL("@emoji-datasource-facebook/", import.meta.url) doesn't exist at build time, it will remain unchanged to be resolved at runtime. If this is intended, you can use the /* @vite-ignore */ comment to suppress this warning.
```
### After
- `pnpm run build`: exit 0.
- `pnpm exec tsc --noEmit`: exit 0, no diagnostics.
- `pnpm run build` in all four changed examples: exit 0 (TypeScript + Vite).
- ESLint on changed example sources and gallery configuration: exit 0.
- Prettier on changed guides and example files:
```
All matched files use Prettier code style!
```
- `pnpm -C packages/lexical-website exec docusaurus build`:
```
[SUCCESS] Generated static files in "build".
```
The site build still reports existing TypeDoc, dependency, and HTML-minifier
warnings; example builds report large-chunk warnings.
Temporary Playwright probes were run with Chromium against standalone Vite,
monorepo source mode, and production previews (`node browser-smoke.cjs`,
`SOURCE_CONFIG=1 node browser-smoke.cjs`, and
`PREVIEW=1 node browser-smoke.cjs`). Each reported:
```
PASS vanilla-js: single editor, typing, formatting, undo, initial JSON
PASS vanilla-js-plugin: single editor, typing, emoji transforms, formatting, PNG assets, JSON round-trip
PASS react-rich: single editor, typing, toolbar, undo/redo, styled HTML paste, JSON round-trip
PASS react-plain-text: single editor, typing, plain-text behavior
PASS no browser errors
```
Firefox and WebKit were not exercised.
…h node data extensions
## Description
The getting started guides and runnable examples teach manual registration and legacy React behavior plugins. Rewrite the vanilla, React, theming, and custom-feature guides around module-level root extensions, with initialization, cleanup, history, HTML paste, toolbar signals, and debug views composed through extensions.
Use explicit `editor.read('latest', ...)` for normal reads, with one `force-commit` example for an immediate programmatic result. Explain how extension themes merge recursively and how the root extension overrides individual entries.
Teach `$config` JSON schemas with an emoji node whose `unifiedID` is a property, preserving its flat JSON representation and inherited text formatting. Add a separate paragraph-review example that attaches ad-hoc NodeState to existing paragraphs and uses `DOMRenderExtension` and `DOMImportExtension` to render, export, and import the review flag.
Replace embedded StackBlitz IDEs with five runnable editors served by the documentation site in same-origin frames. Build the actual standalone example sources using workspace dependencies, keep React resolution consistent, and avoid autofocus stealing focus from the page. Each editor has an Open in StackBlitz button that opens a separate tab; Cloudflare fork previews link to their deployed commit. Preserve the existing guide and example URLs.
## Test plan
### Before
The hosted-editor check against the previous site build (`node packages/lexical-website/scripts/check-getting-started-examples.mjs`) failed because no local example was rendered:
```text
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
0 !== 1
```
### After
- Website TypeScript check and changed standalone example TypeScript/Vite builds: exit 0.
- ESLint on changed example sources, website components, config, and scripts: exit 0.
- Prettier on changed code:
```text
All matched files use Prettier code style!
```
`pnpm run build:doc-examples` also passed with the standalone examples' `node_modules` directories temporarily removed, verifying that the workspace install is sufficient:
```text
Built 5 documentation examples.
```
`IGNORE_PEER_DEPENDENCIES=react docusaurus build`, including a build with Cloudflare fork/commit metadata:
```text
[SUCCESS] Generated static files in "build".
```
Verified the rendered StackBlitz link includes `etrepum/lexical` and the supplied preview commit. The site build still reports existing TypeDoc and API-page HTML-minifier warnings; Vite reports config/deprecation and large-chunk warnings.
`PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs` against the built site, served without cross-origin isolation headers:
```text
PASS vanilla-js: hosted editor, typing, StackBlitz link
PASS react-plain-text: hosted editor, typing, StackBlitz link
PASS react-rich: hosted editor, typing, StackBlitz link
PASS emoji schema: clone, inherited formatting, JSON round trip
PASS vanilla-js-plugin: hosted editor, typing, StackBlitz link
PASS NodeState: toggle, clone, JSON, HTML export/import
PASS node-state-review: hosted editor, typing, StackBlitz link
PASS getting started examples: no runtime errors or StackBlitz requests
```
`PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-homepage-examples.mjs`:
```text
✅ Homepage examples OK (7 editors mounted, no runtime errors, no broken examples).
```
A standalone production-preview Chromium probe also verified emoji transformation, inherited formatting, PNG assets, and JSON round trips. Firefox and WebKit were not exercised.
## Description The example JSON views include default-valued fields that distract from their document content. Use editorState.toJSON(true) in the vanilla, emoji, and paragraph-review state views while preserving indentation, and explain the compact form in the guides and logging example. Use Lexical's booleanValue() schema as the reviewedState parser in the runnable example and both guide snippets, retaining false as the default for missing or invalid values. ## Test plan ### Before Inspection with `git grep -n -E 'toJSON\(\), null, 2|parse: value => value === true' HEAD -- examples/vanilla-js/src/main.ts examples/vanilla-js-plugin/src/main.ts examples/node-state-review/src/main.ts examples/node-state-review/src/ReviewExtension.ts`: ```text HEAD:examples/node-state-review/src/ReviewExtension.ts:28: parse: value => value === true, HEAD:examples/node-state-review/src/main.ts:73: json.value = JSON.stringify(editorState.toJSON(), null, 2); HEAD:examples/vanilla-js-plugin/src/main.ts:47: stateRef.value = JSON.stringify(editorState.toJSON(), null, 2); HEAD:examples/vanilla-js/src/main.ts:45: stateRef.value = JSON.stringify(editorState.toJSON(), null, 2); ``` ### After The three changed standalone examples' TypeScript checks and ESLint on their changed sources exit 0 without diagnostics. Prettier reports: ```text All matched files use Prettier code style! ``` `node scripts/build-doc-examples.mjs`: ```text Built 5 documentation examples. ``` `PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs` against the rebuilt embedded editors: ```text PASS vanilla-js: hosted editor, typing, StackBlitz link PASS react-plain-text: hosted editor, typing, StackBlitz link PASS react-rich: hosted editor, typing, StackBlitz link PASS emoji schema: clone, inherited formatting, JSON round trip PASS vanilla-js-plugin: hosted editor, typing, StackBlitz link PASS NodeState: toggle, clone, JSON, HTML export/import PASS node-state-review: hosted editor, typing, StackBlitz link PASS getting started examples: no runtime errors or StackBlitz requests ``` Firefox and WebKit were not exercised.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
## Description
The vanilla, emoji, and paragraph-review examples create their static interfaces with innerHTML in main.ts. Move those interfaces into index.html so the TypeScript modules only configure the editors, observe state, and wire event handlers. Keep the existing element IDs, accessible labels, and DOM structure, and update the emoji page title to match its extension example.
## Test plan
### Before
`git grep -n innerHTML HEAD -- examples/vanilla-js/src/main.ts examples/vanilla-js-plugin/src/main.ts examples/node-state-review/src/main.ts`:
```text
HEAD:examples/node-state-review/src/main.ts:30:document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
HEAD:examples/vanilla-js-plugin/src/main.ts:19:document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
HEAD:examples/vanilla-js/src/main.ts:18:document.querySelector<HTMLDivElement>('#app')!.innerHTML = `
```
### After
`node scripts/build-doc-examples.mjs` and ESLint on the three changed main.ts files exit 0. Prettier and git diff --check pass.
`PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs` against the rebuilt embedded editors:
```text
PASS vanilla-js: hosted editor, typing, StackBlitz link
PASS react-plain-text: hosted editor, typing, StackBlitz link
PASS react-rich: hosted editor, typing, StackBlitz link
PASS emoji schema: clone, inherited formatting, JSON round trip
PASS vanilla-js-plugin: hosted editor, typing, StackBlitz link
PASS NodeState: toggle, clone, JSON, HTML export/import
PASS node-state-review: hosted editor, typing, StackBlitz link
PASS getting started examples: no runtime errors or StackBlitz requests
```
Firefox and WebKit were not exercised.
…ng started guides ## Description The getting started pages import and render example components while using the Markdown extension. Rename the four interactive guides to .mdx, update their relative links, and apply the existing MDX formatter. Their published routes stay the same. ## Test plan ### Before Running `node_modules/.bin/prettier --check packages/lexical-website/docs/getting-started/*.mdx` immediately after renaming exposes formatting that was previously ignored for .md files: ```text [warn] packages/lexical-website/docs/getting-started/creating-plugin.mdx [warn] packages/lexical-website/docs/getting-started/node-state.mdx [warn] packages/lexical-website/docs/getting-started/quick-start.mdx [warn] packages/lexical-website/docs/getting-started/react.mdx [warn] Code style issues found in 4 files. Run Prettier with --write to fix. ``` ### After `node_modules/.bin/prettier --check packages/lexical-website/docs/getting-started/*.mdx`: ```text All matched files use Prettier code style! ``` `IGNORE_PEER_DEPENDENCIES=react node_modules/.bin/docusaurus build` in packages/lexical-website: ```text [SUCCESS] Generated static files in "build". ``` `PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs`: ```text PASS vanilla-js: hosted editor, typing, StackBlitz link PASS react-plain-text: hosted editor, typing, StackBlitz link PASS react-rich: hosted editor, typing, StackBlitz link PASS emoji schema: clone, inherited formatting, JSON round trip PASS vanilla-js-plugin: hosted editor, typing, StackBlitz link PASS NodeState: toggle, clone, JSON, HTML export/import PASS node-state-review: hosted editor, typing, StackBlitz link PASS getting started examples: no runtime errors or StackBlitz requests ``` The build retains existing TypeDoc and API-page HTML-minifier warnings. Firefox and WebKit were not exercised.
…review
## Description
Stop bundling the emoji PNG collection. Load displayed images from version-pinned jsDelivr URLs, keeping native emoji text visible until loading succeeds, following the fallback pattern in lexical-builder's emoji extension. Retain the unifiedID property schema and protect against stale image responses.
Move styled HTML export to DOMRenderExtension, make documentation autofocus opt out through an explicit embed parameter, and build example assets with relative URLs so site base paths work. Keep the guides in sync and extend the existing CI browser check with image failures, boolean JSON parsing, HTML export, preview iframe focus, and a non-root base path.
## Test plan
### Before
The emoji example output contained 3,595 files and 22,994,943 bytes of file contents.
`PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs` against the previous site build:
```text
ExpectError: expect(locator).toHaveAttribute(expected) failed
Locator: locator('[data-doc-example="vanilla-js"]').locator('iframe')
Expected: "/examples/vanilla-js/?embed"
Received: "/examples/vanilla-js/"
Timeout: 5000ms
```
### After
`node scripts/build-doc-examples.mjs`:
```text
Built 5 documentation examples.
```
The emoji output now contains 3 files and 1,589,905 bytes of file contents, with no bundled PNGs.
TypeScript checks for the website and all three changed standalone examples, ESLint on changed code, and `git diff --check` exited 0.
`IGNORE_PEER_DEPENDENCIES=react node_modules/.bin/docusaurus build` in packages/lexical-website:
```text
[SUCCESS] Generated static files in "build".
```
`PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs`:
```text
PASS vanilla-js: hosted editor, typing, StackBlitz link
PASS react-plain-text: hosted editor, typing, StackBlitz link
PASS HTML styles: allowed import, clean export, retained formatting
PASS react-rich: hosted editor, typing, StackBlitz link
PASS emoji: CDN image, clone, formatting, JSON round trip, missing-image fallback
PASS vanilla-js-plugin: hosted editor, typing, StackBlitz link
PASS NodeState: toggle, clone, boolean JSON validation, HTML export/import
PASS node-state-review: hosted editor, typing, StackBlitz link
PASS examples: non-root base path, autofocus in preview iframes
PASS getting started examples: no runtime errors or StackBlitz requests
```
The browser check intercepts CDN requests with a local package PNG or a 404, testing success and failure without depending on CDN availability.
`PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-homepage-examples.mjs`:
```text
✅ Homepage examples OK (7 editors mounted, no runtime errors, no broken examples).
```
Firefox and WebKit were not exercised. The build still emits existing TypeDoc, transformer import.meta, API HTML-minifier, and Vite warnings.
…g started guides ## Description Keep runnable example code and the guides in sync by importing named source regions into MDX. Mark those regions in TypeScript, CSS, and HTML, and fail the docs build for missing, duplicate, reversed, or empty regions. Add loader tests to the existing CI example checks. Remove legacy video tutorial links and verify renamed guide links target .mdx. Move vanilla app registration into root extensions, use event registration helpers and mergeRegister for disposal, and dispatch SET_REVIEWED_COMMAND from the review toolbar. Configure HMRExtension in all five examples while keeping the Vite accept/dispose lifecycle in vanilla entry points. ## Test plan ### Before The updated getting-started browser check against the previous build failed after editor.dispose(): the export button still changed the HTML textarea and the toolbar still prevented mousedown. ```text AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal + prevented: true - prevented: false ``` ### After Example TypeScript checks, website TypeScript, ESLint, Prettier, and git diff --check passed. The example bundle and Docusaurus builds passed with existing TypeDoc/API-page warnings. ```text node --test packages/lexical-website/scripts/example-source.test.mjs 4 tests passed PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs PASS NodeState: editor disposal removes toolbar handlers PASS getting started examples: no runtime errors or StackBlitz requests ``` A browser comparison confirmed all 17 imported regions render exactly their marked source, hide marker comments, and use .mdx edit links. Live Vite HMR checks confirmed review command payloads, disposal, preserved document/undo history, and single event registration; both React examples retained their documents through Fast Refresh. Firefox and WebKit were not exercised.
… setup ## Description Emoji DOM creation currently preloads images during HTML export and carries editor-only loading attributes into copied HTML. Render images with DOMRenderExtension.$decorateDOM so export inherits plain TextNode behavior. Preserve loaded backgrounds during style changes, and derive the CDN version from the installed emoji package instead of duplicated literals. Pass HMRExtension directly to buildEditorFromExtensions in the three vanilla entry points, keeping Vite-specific setup out of their AppExtension definitions. Simplify Quick Start's runnable source to initialize Hello world inline and restore paragraph, bold, and italic theme classes. Explain optional Vite setup and its TypeScript types; React's single-root composer retains its documented HMR dependency. ## Test plan ### Before PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs ```text AssertionError [ERR_ASSERTION]: HTML export must not load images 1 !== 0 ``` ### After The same browser check passes against the rebuilt site: ```text PASS emoji: clean clipboard HTML, no export loads, stable image on style changes PASS emoji: CDN image, clone, formatting, JSON round trip, missing-image fallback PASS getting started examples: no runtime errors or StackBlitz requests ``` node scripts/build-doc-examples.mjs ```text Built 5 documentation examples. ``` IGNORE_PEER_DEPENDENCIES=react node_modules/.bin/docusaurus build ```text [SUCCESS] Generated static files in "build". ``` Live Vite checks after moving HMR to main.ts: ```text PASS HMR /src/AppExtension.ts: editor replaced, old editor disposed, state retained without page reload PASS HMR /src/main.ts: editor replaced, old editor disposed, state retained without page reload PASS HMR: undo/redo history retained, toolbar handlers registered once ``` TypeScript for the three changed vanilla examples, ESLint, Prettier, source-region tests, and git diff --check pass. A browser comparison verifies all 17 imported source regions still match the rendered code. Existing Vite, TypeDoc, and API HTML-minifier warnings remain. Firefox and WebKit were not exercised.
## Description Emoji HTML export currently preserves text and formatting but loses the custom node's identity on import. Add a data-emoji-id attribute through DOMRenderExtension and a DOMImportExtension rule that restores the node only when the attribute agrees with the imported Unicode text. Preserve formatting and token mode, with ordinary text fallback for invalid or mismatched attributes. Keep the node, factory, transform, and DOM hooks in EmojiExtension.ts. Update the named documentation regions and remove the separate EmojiNode.ts file. Add export/import controls owned by the app extension so readers can try HTML round trips directly in the example. ## Test plan ### Before PLAYWRIGHT_CHROMIUM_PATH=/tmp/chromium node packages/lexical-website/scripts/check-getting-started-examples.mjs ```text AssertionError [ERR_ASSERTION]: HTML export must preserve the emoji ID for import actual: '<b><strong style="white-space: pre-wrap;">🙂</strong></b><b><strong style="white-space: pre-wrap;"> </strong></b>' expected: /data-emoji-id="1f642"/ ``` ### After The same browser check passes against the rebuilt site: ```text PASS emoji: clean clipboard HTML, no export loads, stable image on style changes PASS emoji: CDN image, clone, formatting, JSON round trip, missing-image fallback PASS emoji HTML: clipboard import, formatted and multi-code-point round trips, invalid attribute fallback PASS getting started examples: no runtime errors or StackBlitz requests ``` node scripts/build-doc-examples.mjs ```text Built 5 documentation examples. ``` IGNORE_PEER_DEPENDENCIES=react packages/lexical-website/node_modules/.bin/docusaurus build packages/lexical-website ```text [SUCCESS] Generated static files in "packages/lexical-website/build". ``` Example TypeScript, ESLint, Prettier, and git diff --check pass. A browser comparison verifies all 18 imported source regions match the rendered docs, including the three fragments from EmojiExtension.ts. Existing Vite, TypeDoc, and API HTML-minifier warnings remain. Firefox and WebKit were not exercised.
etrepum
marked this pull request as ready for review
September 25, 2026 22:34
etrepum
requested review from
acywatson,
fantactuka and
zurfyx
as code owners
September 25, 2026 22:34
etrepum
pushed a commit
to etrepum/lexical
that referenced
this pull request
Sep 27, 2026
…zation links valid alongside meta#9237 ## Description meta#9237 renames the getting-started quick-start and react pages from `.md` to `.mdx` and moves the react-rich example off the `html` editor config. - intro.md linked those pages by file (`./getting-started/quick-start.md`), which would no longer resolve after the rename. It now links by URL (`/docs/getting-started/quick-start`), which works with either extension. - The Legacy serialization page linked the react-rich sandbox as its `html` config example. After meta#9237 that example no longer uses `html`, so the link is removed. ## Test plan ### Before The link change is inferred from meta#9237's diff (it deletes `docs/getting-started/quick-start.md` and `react.md` and adds `.mdx` files), not from a failing build. ### After This branch with meta#9237's head merged in (no textual conflicts), then `pnpm exec docusaurus build`: ``` [SUCCESS] Generated static files in "build". ``` No broken links or anchors. The only diagnostics are the two HTML minifier "No p element" messages that the build already printed before this change. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
etrepum
pushed a commit
to etrepum/lexical
that referenced
this pull request
Sep 27, 2026
## Description The examples that display the editor state as JSON wrote the legacy form (`editorState.toJSON()`), which repeats every default and the deprecated `version` property. They now use the compact form available since 0.51.0, `editorState.toJSON(true)`: - extension-vanilla-tailwind: the "Editor state" panel - vanilla-js-iframe: the state textarea - node-state-style: the Shiki JSON view - extension-sveltekit-ssr-hydration: the export JSON view - shadow-dom-web-component: the element's `value` and its form value (both read back with `parseEditorState`, which accepts either form) vanilla-js and vanilla-js-plugin are left alone: meta#9237 rewrites both and already switches them to `toJSON(true)`, so changing them here would only conflict. While checking the SvelteKit example, `svelte-check` failed on its Vitest config (`provider: 'playwright'` is not accepted by Vitest 4). It now uses `playwright()` from `@vitest/browser-playwright`, added as a dev dependency. ## Test plan ### Before ``` $ pnpm run check # extension-sveltekit-ssr-hydration vite.config.ts:33:7 Error: No overload matches this call. svelte-check found 1 error and 0 warnings in 1 file ``` ### After Each changed example extracted on its own, installed against the published 0.51.0 packages and built (`✓ built in ...` for all five). ``` $ pnpm run check # extension-sveltekit-ssr-hydration COMPLETED 954 FILES 0 ERRORS 0 WARNINGS 0 FILES_WITH_PROBLEMS $ playwright test # extension-sveltekit-ssr-hydration 2 passed (9.9s) $ playwright test # shadow-dom-web-component 35 passed (17.3s) ``` In Chromium, the extension-vanilla-tailwind state panel shows the compact form (each node leads with `type`, no `version` properties). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
etrepum
enabled auto-merge
September 27, 2026 22:44
trueadm
approved these changes
Sep 27, 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
The getting started guides and runnable examples teach manual registration and legacy React behavior plugins. Rewrite the vanilla, React, theming, and custom-feature guides around module-level root extensions, with initialization, cleanup, history, HTML paste, toolbar signals, and debug views composed through extensions.
Use explicit
editor.read('latest', ...)for normal reads, with oneforce-commitexample for an immediate programmatic result. Explain how extension themes merge recursively and how the root extension overrides individual entries.Teach
$configJSON schemas with an emoji node whoseunifiedIDis a property, preserving its flat JSON representation and inherited text formatting. Add a separate paragraph-review example that attaches ad-hoc NodeState to existing paragraphs and usesDOMRenderExtensionandDOMImportExtensionto render, export, and import the review flag.Replace embedded StackBlitz IDEs with five runnable editors served by the documentation site in same-origin frames. Build the actual standalone example sources using workspace dependencies, keep React resolution consistent, and avoid autofocus stealing focus from the page. Each editor has an Open in StackBlitz button that opens a separate tab; Cloudflare fork previews link to their deployed commit. Preserve the existing guide and example URLs.
The JSON state views use
editorState.toJSON(true)to omit default-valued fields while keeping indentation. The paragraph-review example usesbooleanValue()as its NodeState parser.The vanilla examples declare their static editor interfaces in
index.html; their root extensions own editor configuration and event handlers, and their entry points build and attach the editors without assigninginnerHTML.The four guides that import and render example components use
.mdx, with relative source links updated and published routes preserved.Load emoji PNGs on demand from the version-pinned jsDelivr copy of
emoji-datasource-facebook, keeping native text visible until an image succeeds, including for unknown IDs and failed requests. This follows the loading fallback from lexical-builder's emoji extension and removes the eager image glob and Vite alias. The emoji example no longer emits thousands of PNG assets into each documentation deployment.Keep
EmojiNode, its factory, DOM hooks, HTML import rule, and transform together inEmojiExtension.ts, with named regions showing each part in the guide. Render images throughDOMRenderExtension.$decorateDOMonly in the live editor. Clipboard and HTML export keep native text and formatting without image loading attributes or preloads, and add a stabledata-emoji-idattribute. ADOMImportExtensionrule restores the custom node and token mode when that ID agrees with the Unicode text, preserving imported formatting and leaving malformed or mismatched content unchanged. Add Export HTML and Import HTML controls to demonstrate the round trip. Reuse loaded images across inline-style changes, and derive CDN URLs from the installed emoji package version in both the example and browser check.Use
DOMRenderExtensionand a$exportDOMoverride for the rich-text example's style-free HTML export. Documentation embeds explicitly pass?embedto disable autofocus; standalone and StackBlitz previews retain autofocus even in iframes. Build example assets with relative URLs so they also work under a non-root site base path. Keep the guides in sync.Move the vanilla examples' app setup into module-level
AppExtensiondefinitions. Own toolbar events and JSON listeners inregister, combine their cleanup withmergeRegister, and useregisterEventListener(s).ReviewExtensionregistersSET_REVIEWED_COMMANDwith boolean or updater payloads; the toolbar dispatches the command. Document when to useafterRegistrationand the runtime abort signal.Configure
HMRExtensionin all five examples to preserve editor state and history during Vite updates. The three vanilla entry points pass it directly tobuildEditorFromExtensions, keeping Vite out of their app extensions; those entry points also accept updates and dispose old editors. React's composer owns disposal and accepts a single root extension, so the React examples document HMR as an optional Vite dependency.Keep Quick Start self-contained: initialize “Hello world” inline and include paragraph, bold, and italic theme classes in the runnable source. Explain how to omit Vite-specific code with other bundlers and how to provide
vite/clienttypes.Read 18 code fragments directly from named regions in the runnable TypeScript, CSS, and HTML sources. Explicit source comments identify the guide that consumes each region. A local loader removes markers and common indentation, tracks file changes, and rejects missing, duplicate, reversed, or empty regions. No line ranges or new dependencies are used. Remove the legacy video tutorials and verify links to renamed guides, including rendered edit URLs, use
.mdx.Preview: Quick Start · Theming · Adding Data to Nodes
Test plan
Doc only update, but it adds tests to verify that the in-doc examples build properly