Repository navigation
[lexical-playground] Bug Fix: Fix Find & Replace offsets across decorators and slots - #9186
Conversation
|
Hi @Monier-Ayman! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
etrepum
left a comment
There was a problem hiding this comment.
The PR title and description should follow the pull request template
|
@etrepum Thanks for the feedback. I updated the PR title and description to follow the template, and I fixed the offset issue. I also added regression tests and verified the fix in the Playground with the YouTube reproduction. It works correctly now. |
|
@etrepum Added a regression test for DecoratorNode with block slot content and verified the offsets after the decorator. |
|
Thanks @etrepum! I reworked the traversal so $dfsWithSlotsIterator() is no longer used here, and each slot is visited only once. I also added tests for DecoratorNodes and ElementNodes with named slots. All 61 FindReplace tests are passing. |
|
Thanks @etrepum! I updated the All 60 FindReplace tests are passing. |
|
@etrepum When you have some time, could you please take another look at the latest changes and run the CI checks? I’ve addressed your latest feedback and the 60 FindReplace tests are passing locally. Thank you! |
|
@etrepum The CI checks have now completed successfully (42/42). The latest changes address your feedback, and the 60 FindReplace tests are passing locally. When you have a chance, could you please take a final look? Thank you! |
|
You don't need to comment every time you make a change, it won't make the review happen any faster. There are already notifications in place, extra comments are just an unwelcome distraction. |
|
Thanks for clarifying @etrepum! My point was just to make sure the latest changes were visible to you. I’ll avoid adding extra comments going forward. |
…at release, ship it in lexical, add a range view ## Description `scripts/npm/update-changelog.mjs` wrote each release's CHANGELOG.md block from `git log --oneline LATEST_RELEASE...HEAD~1`. It stripped every character outside `[a-zA-Z0-9()\n \-,.#]`, so `[lexical][lexical-html] Breaking Change:` became `lexicallexical-html Breaking Change`, `$insertList` became `insertList`, and `Find & Replace` became `Find Replace`. The `HEAD~1` range dropped the newest commit, and the block had no categories, links or migration notes. This replaces it with the changesets added in the previous commit: - `pnpm run update-changelog` (still called from `postversion` on the `latest` channel) now runs `scripts/changesets/release.mjs`: it validates the pending changesets, prepends a `## vX.Y.Z (date)` block (the heading shape Renovate and Dependabot slice on) with `### Breaking changes`, `### Deprecations`, `### Features`, `### Fixes`, `### Performance`, `### Documentation`, `### Other` (the `chore` category) and `### Contributors`, empty sections omitted, and deletes the consumed changesets. Each bullet is `**packages**: summary (#PR link)` with the entry's details, including `Migration:` code, reproduced verbatim. The PR number comes from the squash-merge subject of the commit that added the changeset; contributors from `@handle` lines, else that commit's author. Text is never filtered and nothing is dropped, since the input is the set of pending files rather than a git range. - The release still picks its own version (Lexical does not run `changeset version`), but `increment-version` refuses a `latest` patch while a `[breaking]` changeset is pending, and `update-changelog` repeats the check. Prereleases (nightly, next, dev) leave changesets pending. - `pnpm run changelog` previews the next block instead of printing `git log`. - `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json]` prints every entry in (X, Y], oldest first, optionally only breaking changes and deprecations, optionally as JSON for tools and coding agents. - `pnpm run release-notes -- --version X` prints a version's block for the GitHub release, under the hand-written intro. - `lexical` now ships CHANGELOG.md: `prepare-release` copies the root file into `packages/lexical/` (gitignored) and `update-version` adds it to that package's `files`. Every app that uses Lexical installs `lexical`, so `node_modules/lexical/CHANGELOG.md` gives the full history to anyone upgrading from an installed version, offline. - The maintainers guide describes the new release steps. No library runtime code or public API changes. ## Test plan ### Before The output of the old script, as committed in CHANGELOG.md: ``` $ grep -n 'lexicallexical-html\|Find Replace\|fix insertList' CHANGELOG.md 20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito 47:- lexical-playground Bug Fix Fix Find Replace offsets across decorators and slots (#9186) Monier Ayman 49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry ``` ### After ``` $ pnpm run test-unit scripts/__tests__/unit/changelog.test.ts scripts/__tests__/unit/changesets.test.ts ✓ |scripts-unit| scripts/__tests__/unit/changesets.test.ts (19 tests) 22ms ✓ |scripts-unit| scripts/__tests__/unit/changelog.test.ts (17 tests) 2327ms Test Files 2 passed (2) Tests 36 passed (36) ``` With three temporary example changesets (not committed) in `.changeset/`: ``` $ pnpm run changelog ## v0.53.0 (2026-10-15) ### Breaking changes - **lexical, @lexical/html**: Example: remove `ExampleNode.legacyMethod` Migration: call `$exampleHelper(node)` instead. ```ts // Before node.legacyMethod(); // After $exampleHelper(node); ``` Detect: calls to `.legacyMethod(`. ### Deprecations - **@lexical/table**: Example: deprecate `$exampleTableHelper` Replacement: `$exampleTableHelperFrom`. Removal: no earlier than v0.60.0. ### Fixes - **@lexical/list**: Example: keep `listStyleType` when a list item is split ### Contributors @Example-contributor $ node scripts/changesets/release.mjs --version 0.52.1 Refusing to release 0.52.1 as a patch: 1 pending [breaking] changeset(s) need a minor release: - .changeset/tmp-breaking.md: Example: remove `ExampleNode.legacyMethod` Run the release with the "minor" increment instead. $ node scripts/npm/increment-version.mjs -i patch --channel latest Refusing a patch release: 1 pending [breaking] changeset(s) need a minor release: - .changeset/tmp-breaking.md: Example: remove `ExampleNode.legacyMethod` Run the "Create New Release Branch" workflow with the "minor" increment. ``` The same changesets in a throwaway clone, each committed with a squash-merge style `(#NNNN)` subject, then the step `postversion` runs: ``` $ npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30 Added v0.53.0 to CHANGELOG.md from 3 changeset(s). $ git status --short D .changeset/tmp-breaking.md D .changeset/tmp-deprecation.md D .changeset/tmp-fix.md M CHANGELOG.md $ head -32 CHANGELOG.md ## v0.53.0 (2026-10-30) ### Breaking changes - **lexical, @lexical/html**: Example: remove `ExampleNode.legacyMethod` ([#9992](#9992)) Migration: call `$exampleHelper(node)` instead. ... ### Deprecations - **@lexical/table**: Example: deprecate `$exampleTableHelper` ([#9991](#9991)) ... ### Fixes - **@lexical/list**: Example: keep `listStyleType` when a list item is split ([#9990](#9990)) ### Contributors @Example-contributor, Dev Example ## v0.52.0 (2026-09-27) ``` Stock `changeset version` also accepts the config in that clone (all published packages to 0.53.0, `lexical-playground` left at 0.52.0): ``` $ changeset version 🦋 changeset v3.0.3 All files have been updated. Review them and commit at your leisure $ node -e "...lexical, @lexical/yjs, lexical-playground versions" 0.53.0 0.53.0 0.52.0 ``` Range view and release notes on the current CHANGELOG.md (the breaking sections are backfilled in the next commit): ``` $ pnpm run changelog:range -- --from 0.51.0 --breaking No breaking changes or deprecations after 0.51.0. $ pnpm run release-notes -- --version 0.52.0 | head -1 - lexical Bug Fix Track explicit Shift state for iOS line breaks (#9242) Bob Ippolito ``` The `lexical` tarball includes the copied changelog: ``` $ cp CHANGELOG.md packages/lexical/ && (cd packages/lexical && pnpm pack --dry-run) | grep -A3 'Tarball Contents' Tarball Contents CHANGELOG.md LICENSE README.md ``` `pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and Prettier pass on the changed files. The release workflows themselves were not run.
…md from them at release ## Description CHANGELOG.md is built from `git log` subjects by `scripts/npm/update-changelog.mjs`. That script strips every character outside `[a-zA-Z0-9()\n \-,.#]` (`[lexical][lexical-html] Breaking Change:` becomes `lexicallexical-html Breaking Change`, `$insertList` becomes `insertList`), drops the newest commit (`HEAD~1`), and has no categories, links or migration notes. Whether a change is breaking is only as reliable as the PR title, and migration instructions exist only in hand-written GitHub release notes. Someone upgrading across several 0.x minors, or a tool such as Renovate, Dependabot, or a coding agent, has nothing consistent to read. This adds changesets, in the layout of the changesets project and following the conventions of facebook/astryx, as the source of each changelog entry. No new dependency: the scripts use Node built-ins only. Format and checks: - `.changeset/config.json` has one `fixed` group with every published package (globs) and ignores the private ones, so it stays compatible with standard changesets tooling. `.changeset/README.md` documents the format. - A changeset body starts with `[category] one-line summary`; categories, in changelog order: `breaking`, `deprecation`, `feature`, `fix`, `perf`, `docs`, `chore` (aliases accepted). While 0.x, `breaking` uses `minor`, everything else `patch`; `major` is rejected. `breaking` needs a `Migration:` paragraph (optional `Detect:`, `Codemod:`, `Verify:`); `deprecation` needs `Replacement:` and should have `Removal:`. Optional `@handle` and `PR: #123` lines go under the summary. - `pnpm run check-changesets` (in `ci-check`, a hard failure) also rejects empty frontmatter (pointing at the `skip-changeset` label), frontmatter comments, duplicate packages, Markdown headings in the body, TODO placeholders, and a config that no longer covers every package. - `pnpm run changeset:new -- --category fix --packages lexical --summary "..."` writes a valid file, with TODO lines for the required breaking or deprecation paragraphs. - A `Changesets` workflow checks coverage on pull requests: a change to a published package's `src/` (tests, benches, mocks excluded), Flow types, or consumer-facing `package.json` fields (dependencies, exports, files, type, imports, typesVersions, browser, publishConfig, ...) needs a changeset naming that package; deleting a published package needs a `[breaking]` one. It runs the checker from the base revision, exempts release PRs only from this repository, honors a `skip-changeset` label, and starts in warning mode (`CHANGESET_COVERAGE: warn`: job summary plus an annotation with the file to add). Release: - `update-changelog` (run by `postversion` on `latest`) now runs `scripts/changesets/release.mjs`. It renders the pending changesets as `## vX.Y.Z (date)` (the heading Renovate and Dependabot slice on) with Breaking changes, Deprecations, Features, Fixes, Performance, Documentation, Other and Contributors, then `### All changes`: every commit since the previous release with its subject unchanged and its PR linked, the newest included and release bump commits excluded. It then deletes the consumed changesets. - PRs come from a `PR:` line, the squash-merge subject of the commit that added the changeset (following renames, not copies), the first-parent `Merge pull request #N`, or, with `GITHUB_TOKEN` (now passed in `call-release.yml`), the GitHub API, which also gives contributor logins. Bots are not credited. - It refuses to run while the previous stable release (newest tag or `LATEST_RELEASE`) has no section in CHANGELOG.md, i.e. its release PR is not merged, so a second run cannot consume the same changesets. `increment-version` and `update-changelog` refuse a `latest` patch while a `[breaking]` changeset is pending. - `lexical` ships CHANGELOG.md (copied by `prepare-release`, gitignored). For a prerelease the copy also lists pending changesets as `## Unreleased`; the repository file is unchanged. - `pnpm run changelog` previews the next section; `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json] [--changelog F]` prints a range, oldest first (strict arguments, exit 2 on bad input, a note naming versions `--breaking` cannot show); `pnpm run release-notes -- --version X` prints a section as a starting point for the GitHub release. CONTRIBUTING.md, the PR template, AGENTS.md and the maintainers guide describe all of this. The maintainers guide keeps the `[Breaking Change]` title rule and adds the changeset rule beside it. No library runtime code or public API changes. ## Test plan ### Before The output of the old script, as committed in CHANGELOG.md on main: ``` $ grep -n 'lexicallexical-html\|Find Replace\|fix insertList' CHANGELOG.md 20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito 47:- lexical-playground Bug Fix Fix Find Replace offsets across decorators and slots (#9186) Monier Ayman 49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry ``` ### After ``` $ pnpm run test-unit scripts/__tests__/unit/changesets.test.ts scripts/__tests__/unit/changelog.test.ts Tests 58 passed (58) $ pnpm install --frozen-lockfile && git diff --stat origin/main -- pnpm-lock.yaml (no lockfile change) ``` Format errors: ``` $ node scripts/changesets/check.mjs --dir demo-cs Changeset check found 4 problem(s): - demo-cs/bad.md: comments are not supported in the frontmatter ("# note"); list only "'package': bump" lines and put notes in the body. - demo-cs/bad.md: "lexical" is listed more than once in the frontmatter. - demo-cs/bad.md: Markdown headings ("## Details") are not allowed in a changeset; they would break the CHANGELOG.md structure. Use a paragraph or **bold** text instead. - demo-cs/empty.md: the frontmatter lists no packages. Empty changesets are not used here: if the change has no effect on people who use Lexical, delete this file and ask a maintainer for the `skip-changeset` label instead. ``` Coverage on this commit alone (it changes `lexical`'s `files`, and its changeset is in the next commit): ``` $ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn warning: This pull request changes published code without a changeset for: lexical: packages/lexical/package.json (files) Add a changeset, e.g. with pnpm run changeset:new -- --category fix --packages lexical --summary "..." ... Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only. ``` Range input checks: ``` $ pnpm run changelog:range -- --from latest --from must be a version such as 0.40.0, got "latest". usage: pnpm run changelog:range -- --from <version> [--to <version>] [--breaking] [--json] [--changelog <file>] (exit 2) $ pnpm run changelog:range -- --from 0.50.0 --bogus Unknown option '--bogus' (exit 2) ``` Release dry runs with the changesets from the next commit are in that commit's message. `pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and Prettier pass. The workflows themselves only run on GitHub.
…md from them at release ## Description CHANGELOG.md is built from `git log` subjects by `scripts/npm/update-changelog.mjs`. That script strips every character outside `[a-zA-Z0-9()\n \-,.#]` (`[lexical][lexical-html] Breaking Change:` becomes `lexicallexical-html Breaking Change`, `$insertList` becomes `insertList`), drops the newest commit (`HEAD~1`), and has no categories, links or migration notes. Whether a change is breaking is only as reliable as the PR title, and migration instructions exist only in hand-written GitHub release notes. Someone upgrading across several 0.x minors, or a tool such as Renovate, Dependabot, or a coding agent, has nothing consistent to read. This adds changesets, in the layout of the changesets project and following the conventions of facebook/astryx, as the source of each changelog entry. No new dependency: the scripts use Node built-ins only. Format and checks: - `.changeset/config.json` has one `fixed` group with every published package (globs) and ignores the private ones, so it stays compatible with standard changesets tooling. `.changeset/README.md` documents the format. - A changeset body starts with `[category] one-line summary`; categories, in changelog order: `breaking`, `deprecation`, `feature`, `fix`, `perf`, `docs`, `chore` (aliases accepted). While 0.x, `breaking` uses `minor`, everything else `patch`; `major` is rejected. `breaking` needs `Migration:` and `Detect:` (optional `Codemod:`, `Verify:`); `deprecation` needs `Replacement:` and `Removal:` (a version, `no earlier than v0.NN`, or `not scheduled`). Optional `@handle` and `PR: #123` lines go under the summary. - A non-breaking entry with a `Verify:` paragraph (a fix that changes observable output or behavior) is listed under `### Behavior changes`, right after the breaking changes, with no new category. - `pnpm run check-changesets` (in `ci-check`, a hard failure) also rejects empty frontmatter (pointing at the `skip-changeset` label), frontmatter comments, duplicate packages, Markdown headings in the body, TODO placeholders, and a config that no longer covers every package. - `pnpm run changeset:new -- --category fix --packages lexical --summary "..."` writes a valid file, with TODO lines for the required breaking or deprecation paragraphs. - A `Changesets` workflow checks coverage on pull requests: a change to a published package's `src/` (tests, benches, mocks excluded), Flow types, or consumer-facing `package.json` fields (dependencies, exports, files, type, imports, typesVersions, browser, publishConfig, ...) needs a changeset naming that package; deleting a published package needs a `[breaking]` one. It runs the checker from the base revision, exempts release PRs only from this repository, honors a `skip-changeset` label, and starts in warning mode (`CHANGESET_COVERAGE: warn`: job summary plus an annotation with the file to add and a link that opens it prefilled on the pull request's branch, built from the event payload). It stays `warn` until the `skip-changeset` label exists. Release: - `update-changelog` (run by `postversion` on `latest`) now runs `scripts/changesets/release.mjs`. It renders the pending changesets as `## vX.Y.Z (date)` (the heading Renovate and Dependabot slice on) with Breaking changes, Behavior changes, Deprecations, Features, Fixes, Performance, Documentation, Other and Contributors, then `### All changes`: every commit since the previous release with its subject unchanged and its PR linked, the newest included and release bump commits excluded. It then deletes the consumed changesets. - PRs come from a `PR:` line, the squash-merge subject of the commit that added the changeset (following renames, not copies), the first-parent `Merge pull request #N`, or, with `GITHUB_TOKEN` (now passed in `call-release.yml`), the GitHub API, which also gives contributor logins. Bots are not credited. - It refuses to run while the previous stable release (newest tag or `LATEST_RELEASE`) has no section in CHANGELOG.md, i.e. its release PR is not merged, so a second run cannot consume the same changesets. `increment-version` and `update-changelog` refuse a `latest` patch while a `[breaking]` changeset is pending. - `lexical` ships CHANGELOG.md (copied by `prepare-release`, gitignored). For a prerelease the copy also lists pending changesets as `## Unreleased`; the repository file is unchanged. - `pnpm run changelog` previews the next section; `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json] [--changelog F]` prints a range, oldest first; `--breaking` keeps breaking changes, behavior changes and deprecations, and JSON marks behavior changes with `behavior: true` (strict arguments, exit 2 on bad input, a note naming versions `--breaking` cannot show); `pnpm run release-notes -- --version X` prints a section as a starting point for the GitHub release. CONTRIBUTING.md, the PR template, AGENTS.md and the maintainers guide describe all of this. The maintainers guide keeps the `[Breaking Change]` title rule and adds the changeset rule beside it. No library runtime code or public API changes. ## Test plan ### Before The output of the old script, as committed in CHANGELOG.md on main: ``` $ grep -n 'lexicallexical-html\|Find Replace\|fix insertList' CHANGELOG.md 20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito 47:- lexical-playground Bug Fix Fix Find Replace offsets across decorators and slots (#9186) Monier Ayman 49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry ``` ### After ``` $ pnpm run test-unit scripts/__tests__/unit/changesets.test.ts scripts/__tests__/unit/changelog.test.ts Tests 63 passed (63) $ pnpm install --frozen-lockfile && git diff --stat origin/main -- pnpm-lock.yaml (no lockfile change) ``` Format errors: ``` $ node scripts/changesets/check.mjs --dir demo-cs Changeset check found 4 problem(s): - demo-cs/bad.md: comments are not supported in the frontmatter ("# note"); list only "'package': bump" lines and put notes in the body. - demo-cs/bad.md: "lexical" is listed more than once in the frontmatter. - demo-cs/bad.md: Markdown headings ("## Details") are not allowed in a changeset; they would break the CHANGELOG.md structure. Use a paragraph or **bold** text instead. - demo-cs/empty.md: the frontmatter lists no packages. Empty changesets are not used here: if the change has no effect on people who use Lexical, delete this file and ask a maintainer for the `skip-changeset` label instead. ``` Coverage on this commit alone (it changes `lexical`'s `files`, and its changeset is in the next commit): ``` $ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn warning: This pull request changes published code without a changeset for: lexical: packages/lexical/package.json (files) Add a changeset, e.g. with pnpm run changeset:new -- --category fix --packages lexical --summary "..." ... Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only. ``` The same check as the Changesets workflow runs it, with the event values it copies into the environment: ``` $ GITHUB_ACTIONS=true GITHUB_STEP_SUMMARY=summary.md HEAD_REPO=zurfyx/lexical HEAD_REF=zurfyx/upgrade-guide \ PR_TITLE="[lexical] Chore: Ship CHANGELOG.md in lexical" node scripts/changesets/check.mjs --base origin/main --coverage warn $ tail -3 summary.md [Add the changeset in the browser](https://github.com/zurfyx/lexical/new/zurfyx/upgrade-guide?filename=.changeset%2Fship-changelog-md-in-lexical.md&value=---%0A'lexical'%3A%20patch%0A---%0A%0A%5Bchore%5D%20Ship%20CHANGELOG.md%20in%20lexical%0A) (opens a prefilled file on this pull request's branch; edit the summary before committing). See "Changesets" in CONTRIBUTING.md. ``` Range input checks: ``` $ pnpm run changelog:range -- --from latest --from must be a version such as 0.40.0, got "latest". usage: pnpm run changelog:range -- --from <version> [--to <version>] [--breaking] [--json] [--changelog <file>] (exit 2) $ pnpm run changelog:range -- --from 0.50.0 --bogus Unknown option '--bogus' (exit 2) ``` Release dry runs with the changesets from the next commit are in that commit's message. `pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and Prettier pass. The workflows themselves only run on GitHub.
…md from them at release ## Description CHANGELOG.md is built from `git log` subjects by `scripts/npm/update-changelog.mjs`. That script strips every character outside `[a-zA-Z0-9()\n \-,.#]` (`[lexical][lexical-html] Breaking Change:` becomes `lexicallexical-html Breaking Change`, `$insertList` becomes `insertList`), drops the newest commit (`HEAD~1`), and has no categories, links or migration notes. Whether a change is breaking is only as reliable as the PR title, and migration instructions exist only in hand-written GitHub release notes. Someone upgrading across several 0.x minors, or a tool such as Renovate, Dependabot, or a coding agent, has nothing consistent to read. This adds changesets, in the layout of the changesets project and following the conventions of facebook/astryx, as the source of each changelog entry. No new dependency: the scripts use Node built-ins only. Format and checks: - `.changeset/config.json` has one `fixed` group with every published package (globs) and ignores the private ones, so it stays compatible with standard changesets tooling. `.changeset/README.md` documents the format. - A changeset body starts with `[category] one-line summary`; categories, in changelog order: `breaking`, `deprecation`, `feature`, `fix`, `perf`, `docs`, `chore` (aliases accepted). While 0.x, `breaking` uses `minor`, everything else `patch`; `major` is rejected. `breaking` needs `Migration:` and `Detect:` (optional `Codemod:`, `Verify:`); `deprecation` needs `Replacement:` and `Removal:` (a version, `no earlier than v0.NN`, or `not scheduled`). Optional `@handle` and `PR: #123` lines go under the summary. - A non-breaking entry with a `Verify:` paragraph (a fix that changes observable output or behavior) is listed under `### Behavior changes`, right after the breaking changes, with no new category. - `pnpm run check-changesets` (in `ci-check`, a hard failure) also rejects empty frontmatter (pointing at the `skip-changeset` label), frontmatter comments, duplicate packages, Markdown headings in the body, TODO placeholders, and a config that no longer covers every package. - `pnpm run changeset:new -- --category fix --packages lexical --summary "..."` writes a valid file, with TODO lines for the required breaking or deprecation paragraphs. - A `Changesets` workflow checks coverage on pull requests: a change to a published package's `src/` (tests, benches, mocks excluded), Flow types, or consumer-facing `package.json` fields (dependencies, exports, files, type, imports, typesVersions, browser, publishConfig, ...) needs a changeset naming that package; deleting a published package needs a `[breaking]` one. It runs the checker from the base revision, exempts release PRs only from this repository, honors a `skip-changeset` label, and starts in warning mode (`CHANGESET_COVERAGE: warn`: job summary plus an annotation with the file to add and a link that opens it prefilled on the pull request's branch, built from the event payload). It stays `warn` until the `skip-changeset` label exists. Release: - `update-changelog` (run by `postversion` on `latest`) now runs `scripts/changesets/release.mjs`. It renders the pending changesets as `## vX.Y.Z (date)` (the heading Renovate and Dependabot slice on) with Breaking changes, Behavior changes, Deprecations, Features, Fixes, Performance, Documentation, Other and Contributors, then `### All changes`: every commit since the previous release with its subject unchanged and its PR linked, the newest included and release bump commits excluded. It then deletes the consumed changesets. - PRs come from a `PR:` line, the squash-merge subject of the commit that added the changeset (following renames, not copies), the first-parent `Merge pull request #N`, or, with `GITHUB_TOKEN` (now passed in `call-release.yml`), the GitHub API, which also gives contributor logins. Bots are not credited. - It refuses to run while the previous stable release (newest tag or `LATEST_RELEASE`) has no section in CHANGELOG.md, i.e. its release PR is not merged, so a second run cannot consume the same changesets. `increment-version` and `update-changelog` refuse a `latest` patch while a `[breaking]` changeset is pending. - `lexical` ships CHANGELOG.md (copied by `prepare-release`, gitignored). For a prerelease the copy also lists pending changesets as `## Unreleased`; the repository file is unchanged. - `pnpm run changelog` previews the next section; `pnpm run changelog:range -- --from X [--to Y] [--breaking] [--json] [--changelog F]` prints a range, oldest first; `--breaking` keeps breaking changes, behavior changes and deprecations, and JSON marks behavior changes with `behavior: true` (strict arguments, exit 2 on bad input, a note naming versions `--breaking` cannot show); `pnpm run release-notes -- --version X` prints a section as a starting point for the GitHub release. CONTRIBUTING.md, the PR template, AGENTS.md and the maintainers guide describe all of this. The maintainers guide keeps the `[Breaking Change]` title rule and adds the changeset rule beside it. No library runtime code or public API changes. ## Test plan ### Before The output of the old script, as committed in CHANGELOG.md on main: ``` $ grep -n 'lexicallexical-html\|Find Replace\|fix insertList' CHANGELOG.md 20:- lexicallexical-html Breaking Change honor createDOM overrides in default DOM export (#9231) Bob Ippolito 47:- lexical-playground Bug Fix Fix Find Replace offsets across decorators and slots (#9186) Monier Ayman 49:- lexical-website Documentation Update fix insertList argument in the commands guide (#9188) Sherry ``` ### After ``` $ pnpm run test-unit scripts/__tests__/unit/changesets.test.ts scripts/__tests__/unit/changelog.test.ts Tests 64 passed (64) $ pnpm install --frozen-lockfile && git diff --stat origin/main -- pnpm-lock.yaml (no lockfile change) ``` Format errors: ``` $ node scripts/changesets/check.mjs --dir demo-cs Changeset check found 4 problem(s): - demo-cs/bad.md: comments are not supported in the frontmatter ("# note"); list only "'package': bump" lines and put notes in the body. - demo-cs/bad.md: "lexical" is listed more than once in the frontmatter. - demo-cs/bad.md: Markdown headings ("## Details") are not allowed in a changeset; they would break the CHANGELOG.md structure. Use a paragraph or **bold** text instead. - demo-cs/empty.md: the frontmatter lists no packages. Empty changesets are not used here: if the change has no effect on people who use Lexical, delete this file and ask a maintainer for the `skip-changeset` label instead. ``` Coverage on this commit alone (it changes `lexical`'s `files`, and its changeset is in the next commit): ``` $ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn warning: This pull request changes published code without a changeset for: lexical: packages/lexical/package.json (files) Add a changeset, e.g. with pnpm run changeset:new -- --category fix --packages lexical --summary "..." ... Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only. ``` The same check as the Changesets workflow runs it, with the event values it copies into the environment: ``` $ GITHUB_ACTIONS=true GITHUB_STEP_SUMMARY=summary.md HEAD_REPO=zurfyx/lexical HEAD_REF=zurfyx/upgrade-guide \ PR_TITLE="[lexical] Chore: Ship CHANGELOG.md in lexical" node scripts/changesets/check.mjs --base origin/main --coverage warn $ tail -3 summary.md [Add the changeset in the browser](https://github.com/zurfyx/lexical/new/zurfyx/upgrade-guide?filename=.changeset%2Fship-changelog-md-in-lexical.md&value=---%0A'lexical'%3A%20patch%0A---%0A%0A%5Bchore%5D%20Ship%20CHANGELOG.md%20in%20lexical%0A) (opens a prefilled file on this pull request's branch; edit the summary before committing). See "Changesets" in CONTRIBUTING.md. ``` Range input checks: ``` $ pnpm run changelog:range -- --from latest --from must be a version such as 0.40.0, got "latest". usage: pnpm run changelog:range -- --from <version> [--to <version>] [--breaking] [--json] [--changelog <file>] (exit 2) $ pnpm run changelog:range -- --from 0.50.0 --bogus Unknown option '--bogus' (exit 2) ``` Release dry runs with the changesets from the next commit are in that commit's message. `pnpm run tsc-scripts`, `pnpm run tsc-test`, ESLint and Prettier pass. The workflows themselves only run on GitHub.

Find & Replace could highlight the wrong text when a match appeared after a
DecoratorNode, including content after a YouTube node.The offset map is built using
$dfsWithSlotsIterator(), but$buildOffsetMap()did not account for text contributed directly byDecoratorNodes. For example, the PlaygroundYouTubeNodecontributes its YouTube URL throughgetTextContent(). This caused all offsets after the node to be shifted by the length of that text.This change:
DecoratorNodes.+2offset for actual non-inline element sibling boundaries.Closes #9185
Test plan
Before
Find & Replace could highlight the wrong text after a YouTube/decorator node.
For example, searching for
playgroundcould produce incorrect highlights in text after the YouTube block.After
Find & Replace correctly highlights matches after decorator and slot content.
The Lexical Playground was manually tested with a YouTube block followed by additional content, and all
playgroundmatches were highlighted at the correct positions.A regression test was also added covering:
DecoratorNodebetween block nodes.DecoratorNodecontaining block slot content.Automated test result:
FindReplace.test.ts: 60/60 tests passingScreen.Recording.2026-09-22.033312.mp4