Skip to content

[examples] Chore: Replace node-state-style with the dev-examples version - #8647

Merged
etrepum merged 1 commit into
meta:mainfrom
etrepum:claude/elegant-feynman-EDekq
Jun 7, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
etrepum:claude/elegant-feynman-EDekq

Conversation

@etrepum

@etrepum etrepum commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Description

Since 0.45.0 was released, the DOMImportExtension-based node-state-style example no longer needs to live in dev-examples (which builds against the workspace source). Move its code and dependencies into the standalone examples/node-state-style, which builds against the published 0.45.0 packages, and remove the dev-examples copy.

  • Bring over App.tsx, ToolbarPlugin.tsx, and styleState.ts (the extension/signal-based toolbar and the DOMImportExtension-based style import), dropping the dev- prefix from the internal extension names.
  • Prefer the dev-examples dependency versions (shiki 4, lucide-react 1.17, vite 8, typescript 6, @vitejs/plugin-react 6, cross-env 10, rollup 4.61); keep the lexical packages pinned to the published 0.45.0.
  • Keep the standalone examples vite/tsconfig setup (vite.config.ts + vite.config.monorepo.ts, self-contained tsconfig.json) since the example is no longer part of the workspace.
  • Mention the DOMImportExtension in the README, and drop the dev-examples/node-state-style entry from pnpm-lock.yaml.

Since 0.45.0 was released, the DOMImportExtension-based node-state-style
example no longer needs to live in dev-examples (which builds against the
workspace source). Move its code and dependencies into the standalone
examples/node-state-style, which builds against the published 0.45.0
packages, and remove the dev-examples copy.

- Bring over App.tsx, ToolbarPlugin.tsx, and styleState.ts (the
  extension/signal-based toolbar and the DOMImportExtension-based style
  import), dropping the dev- prefix from the internal extension names.
- Prefer the dev-examples dependency versions (shiki 4, lucide-react
  1.17, vite 8, typescript 6, @vitejs/plugin-react 6, cross-env 10,
  rollup 4.61); keep the lexical packages pinned to the published 0.45.0.
- Keep the standalone examples vite/tsconfig setup (vite.config.ts +
  vite.config.monorepo.ts, self-contained tsconfig.json) since the
  example is no longer part of the workspace.
- Mention the DOMImportExtension in the README, and drop the
  dev-examples/node-state-style entry from pnpm-lock.yaml.

https://claude.ai/code/session_01WcomYn34ahRPbwSWgQAcQ3
@vercel

vercel Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Jun 6, 2026 12:00am
lexical-playground Ready Ready Preview, Comment Jun 6, 2026 12:00am

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 Jun 5, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Jun 5, 2026
@etrepum
etrepum marked this pull request as ready for review June 6, 2026 00:17

@potatowagon potatowagon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: [examples] Chore — Replace node-state-style with the dev-examples version

Assessment: ✅ Safe to land

What this does

Removes the duplicate dev-examples/node-state-style directory (which was linked against workspace source) and consolidates everything into the published examples/node-state-style version. The examples version is upgraded to use the new Extension API patterns.

What I verified

  1. No functional regression — the example is self-contained and not imported by any core package. Removing the dev-examples copy has zero risk of breaking library consumers.

  2. Extension API migration is correct — The ToolbarPlugin now uses a proper ToolbarExtension with signal-based state (batch(), signal(), useExtensionSignalValue) instead of React useState + imperative command listeners. The canUndo/canRedo signals are sourced directly from HistoryExtension (no more CAN_UNDO_COMMAND/CAN_REDO_COMMAND listeners). This is architecturally cleaner and avoids stale-closure issues.

  3. DOMImportExtension migration — Replaces the legacy constructStyleImportMap (which monkey-patched TextNode.importDOM()) with a declarative defineImportRule using sel.any().attr('style', /\\S/). The logic is equivalent (filters IGNORE_STYLES, applies styleMapping to TextNodes), just expressed through the new pipeline.

  4. $exportDOM improvements — The pre-wrap cleanup now uses removeProperty + strips empty style attrs, which is more robust across browsers/JSDOM than the previous setProperty(null) approach.

  5. Dependency bumps are reasonable — shiki ^3→^4, lucide-react ^0.503→^1.17, vite ^7→^8, typescript ^5→^6, rollup 4.52→4.61. All major bumps but this is an example that's rebuilt from scratch by users anyway.

  6. pnpm-lock.yaml — the dev-examples entry is cleanly removed from the lockfile.

  7. CI — All core tests, unit tests, browser tests, integration tests, and nearly all e2e tests pass (3 pending webkit/firefox jobs still running, no failures).

No concerns. Clean consolidation, well-scoped, no risk to library consumers.

— via Navi (Tater Thoughts Bobblehead) on behalf of potatowagon

@etrepum
etrepum added this pull request to the merge queue Jun 7, 2026
Merged via the queue into meta:main with commit 2f7ebef Jun 7, 2026
52 checks passed
@etrepum etrepum mentioned this pull request Jun 25, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — f7f93d1c Deployed Jun 6, 2026 by vercel[bot]
Preview – lexical-playground — f7f93d1c Deployed Jun 5, 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. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants