Skip to content

[lexical] Bug Fix: Keep the line break when deleting a line that starts with an inline decorator - #9301

Merged
etrepum merged 1 commit into
meta:mainfrom
rinarakaki:fix/line-deletion-stops-at-line-break
Sep 30, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
rinarakaki:fix/line-deletion-stops-at-line-break

Conversation

@rinarakaki

Copy link
Copy Markdown
Contributor

Description

In Chromium, a backward line deletion (Cmd+Backspace on Apple platforms, or a beforeinput of deleteSoftLineBackward) on a line that starts with an inline decorator right after a line break also deletes the break, and the two lines join: pq rs⏎[@x] tu| becomes pq rs|. From just after the decorator, or from the start of that line, it deletes the whole line above as well: pq rs⏎[@x]| tu becomes | tu, and pq rs⏎|[@x] tu becomes |[@x] tu.

From inside the line, it takes a decorator that renders as an inline element with text, like a mention. From just after the decorator and from the start of the line, an inline-block chip with text does it too.

deleteLine measures where the line starts with the native Selection.modify('move', 'backward', 'lineboundary'). Chromium has no caret position between the <br> and such a decorator (#6916), so the start it measures is on the line before. From inside the line, it's the end of the line above. From the position just after the <br>, it's the start of the line above; the measurement starts there from the start of the line, and from just after the decorator once the caret has stepped over it. $deleteTextByGranularity only keeps a line deletion inside one block, so removeText() deletes the <br> with the rest.

With this change, once a line deletion has measured its boundary, $deleteTextByGranularity pulls the boundary back to the caret's side of the first LineBreakNode between the two, before the existing check that keeps the deletion in one block:

  • The deletion stops at the break: pq rs⏎[@x] tu| becomes pq rs⏎|, and pq rs⏎[@x]| tu becomes pq rs⏎| tu.
  • From the start of a line, the selection ends up collapsed, and deleteCharacter deletes the break, joining the lines as it does at the start of any line: pq rs⏎|[@x] tu becomes pq rs|[@x] tu.
  • It only runs when a line deletion extends a collapsed caret, so deleting a selected range is unchanged. When the measured range has no line break in it, which is every case where the measurement was already right, backward or forward, nothing changes.

Closes #9294

Test plan

LineBreakDecoratorLineDeletion.test.ts is a browser test next to InlineDecoratorLineDeletion.test.ts, in plain and rich text. The paragraph is pq rs, a line break, a decorator with text, then tu vw xy, and the decorator is inline (like a mention) or inline-block (like a chip). The test runs a backward line deletion from offsets 0, 1, 4 and 9 of the text after the decorator, and from the start of the line: the element point (paragraph, 2) between the break and the decorator, which is where the caret is after Backspace deletes a character typed before the decorator. On main, every inline case fails. The inline-block cases fail from offset 0 and from the start of the line; the others pass on main and stay as checks.

Trimmed: each test's |browser (chromium)| <file> > prefix, the failure reports after the list, and the run header and timing lines.

Before

$ pnpm exec vitest --project browser --no-watch --reporter=verbose --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/LineBreakDecoratorLineDeletion.test.ts
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 235ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 99ms
   → expected 'pq rstu vw xy' to be 'pq rs\ntu vw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 118ms
   → expected 'pq rsvw xy' to be 'pq rs\nvw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 152ms
   → expected 'pq rs' to be 'pq rs\n' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 119ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 5ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 1ms
 × @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 87ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 99ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 100ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 107ms
   → expected 'pq rstu vw xy' to be 'pq rs\ntu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 106ms
   → expected 'pq rsvw xy' to be 'pq rs\nvw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 100ms
   → expected 'pq rs' to be 'pq rs\n' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 138ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 2ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 8ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 2ms
 × @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 109ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 110ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 Test Files  1 failed (1)
      Tests  14 failed | 6 passed (20)

$ pnpm exec vitest --project browser --no-watch --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/
 Test Files  1 failed | 17 passed (18)
      Tests  14 failed | 166 passed | 1 skipped (181)

After

$ pnpm exec vitest --project browser --no-watch --reporter=verbose --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/LineBreakDecoratorLineDeletion.test.ts
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 30ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 4ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 5ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 3ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 2ms
 ✓ @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 2ms
 ✓ @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 2ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 2ms
 ✓ @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 1ms
 ✓ @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 1ms
 Test Files  1 passed (1)
      Tests  20 passed (20)

$ pnpm exec vitest --project browser --no-watch --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/
 Test Files  18 passed (18)
      Tests  180 passed | 1 skipped (181)

$ pnpm exec vitest --project browser --no-watch --api.port=63376 --api.strictPort
 Test Files  36 passed (36)
      Tests  275 passed | 1 skipped (276)

$ pnpm run test-unit
 Test Files  369 passed (369)
      Tests  9011 passed | 1 skipped (9012)

pnpm run tsc and pnpm run tsc-test pass, and prettier and eslint are clean on the changed files. There are no public API or type changes, so no Flow changes.

The browser tests ran in Chromium only (Playwright's headless Chrome 151). Firefox, WebKit and the e2e suites weren't run.

🤖 Generated with Claude Code

…ts with an inline decorator

## Description

In Chromium, a backward line deletion (Cmd+Backspace on Apple platforms, or a `beforeinput` of `deleteSoftLineBackward`) on a line that starts with an inline decorator right after a line break also deletes the break, and the two lines join: `pq rs⏎[@x] tu|` becomes `pq rs|`. From just after the decorator, or from the start of that line, it deletes the whole line above as well: `pq rs⏎[@x]| tu` becomes `| tu`, and `pq rs⏎|[@x] tu` becomes `|[@x] tu`.

From inside the line, it takes a decorator that renders as an inline element with text, like a mention. From just after the decorator and from the start of the line, an `inline-block` chip with text does it too.

`deleteLine` measures where the line starts with the native `Selection.modify('move', 'backward', 'lineboundary')`. Chromium has no caret position between the `<br>` and such a decorator (meta#6916), so the start it measures is on the line before. From inside the line, it's the end of the line above. From the position just after the `<br>`, it's the start of the line above; the measurement starts there from the start of the line, and from just after the decorator once the caret has stepped over it. `$deleteTextByGranularity` only keeps a line deletion inside one block, so `removeText()` deletes the `<br>` with the rest.

With this change, once a line deletion has measured its boundary, `$deleteTextByGranularity` pulls the boundary back to the caret's side of the first `LineBreakNode` between the two, before the existing check that keeps the deletion in one block:
- The deletion stops at the break: `pq rs⏎[@x] tu|` becomes `pq rs⏎|`, and `pq rs⏎[@x]| tu` becomes `pq rs⏎| tu`.
- From the start of a line, the selection ends up collapsed, and `deleteCharacter` deletes the break, joining the lines as it does at the start of any line: `pq rs⏎|[@x] tu` becomes `pq rs|[@x] tu`.
- It only runs when a line deletion extends a collapsed caret, so deleting a selected range is unchanged. When the measured range has no line break in it, which is every case where the measurement was already right, backward or forward, nothing changes.

Closes meta#9294

## Test plan

`LineBreakDecoratorLineDeletion.test.ts` is a browser test next to `InlineDecoratorLineDeletion.test.ts`, in plain and rich text. The paragraph is `pq rs`, a line break, a decorator with text, then ` tu vw xy`, and the decorator is `inline` (like a mention) or `inline-block` (like a chip). The test runs a backward line deletion from offsets 0, 1, 4 and 9 of the text after the decorator, and from the start of the line: the element point `(paragraph, 2)` between the break and the decorator, which is where the caret is after Backspace deletes a character typed before the decorator. On `main`, every `inline` case fails. The `inline-block` cases fail from offset 0 and from the start of the line; the others pass on `main` and stay as checks.

Trimmed: each test's `|browser (chromium)| <file> >` prefix, the failure reports after the list, and the run header and timing lines.

### Before

```
$ pnpm exec vitest --project browser --no-watch --reporter=verbose --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/LineBreakDecoratorLineDeletion.test.ts
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 235ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 99ms
   → expected 'pq rstu vw xy' to be 'pq rs\ntu vw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 118ms
   → expected 'pq rsvw xy' to be 'pq rs\nvw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 152ms
   → expected 'pq rs' to be 'pq rs\n' // Object.is equality
 × @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 119ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 5ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 1ms
 × @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 87ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 × @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 99ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 100ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 107ms
   → expected 'pq rstu vw xy' to be 'pq rs\ntu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 106ms
   → expected 'pq rsvw xy' to be 'pq rs\nvw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 100ms
   → expected 'pq rs' to be 'pq rs\n' // Object.is equality
 × @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 138ms
   → expected ' tu vw xy' to be 'pq rs\n tu vw xy' // Object.is equality
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 2ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 8ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 2ms
 × @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 109ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 × @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 110ms
   → expected ' tu vw xy' to be 'pq rs tu vw xy' // Object.is equality
 Test Files  1 failed (1)
      Tests  14 failed | 6 passed (20)

$ pnpm exec vitest --project browser --no-watch --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/
 Test Files  1 failed | 17 passed (18)
      Tests  14 failed | 166 passed | 1 skipped (181)
```

### After

```
$ pnpm exec vitest --project browser --no-watch --reporter=verbose --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/LineBreakDecoratorLineDeletion.test.ts
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 30ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 4ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 5ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 2ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 3ms
 ✓ @lexical/rich-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 2ms
 ✓ @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 2ms
 ✓ @lexical/rich-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 0) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 1) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 4) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline, offset: 9) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 0) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 1) 1ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 4) 2ms
 ✓ @lexical/plain-text > backward line deletion after a decorator that begins a line stops at the line break (display: inline-block, offset: 9) 2ms
 ✓ @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline) 1ms
 ✓ @lexical/plain-text > backward line deletion from the start of a line that begins with a decorator deletes the line break (display: inline-block) 1ms
 Test Files  1 passed (1)
      Tests  20 passed (20)

$ pnpm exec vitest --project browser --no-watch --api.port=63376 --api.strictPort packages/lexical/src/__tests__/browser/
 Test Files  18 passed (18)
      Tests  180 passed | 1 skipped (181)

$ pnpm exec vitest --project browser --no-watch --api.port=63376 --api.strictPort
 Test Files  36 passed (36)
      Tests  275 passed | 1 skipped (276)

$ pnpm run test-unit
 Test Files  369 passed (369)
      Tests  9011 passed | 1 skipped (9012)
```

`pnpm run tsc` and `pnpm run tsc-test` pass, and prettier and eslint are clean on the changed files. There are no public API or type changes, so no Flow changes.

The browser tests ran in Chromium only (Playwright's headless Chrome 151). Firefox, WebKit and the e2e suites weren't run.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@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 30, 2026
@vercel

vercel Bot commented Sep 30, 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 30, 2026 4:30pm UTC
lexical-playground Ready Ready Preview Sep 30, 2026 4:30pm UTC

Request Review

@etrepum
etrepum added this pull request to the merge queue Sep 30, 2026
Merged via the queue into meta:main with commit 71a270e Sep 30, 2026
50 checks passed
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -7
3:### Breaking changes
28:### Features
36:### Fixes
98:### Performance
102:### Other
106:### Contributors
110:### All changes
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

Four fixes change observable output or behavior, so their changesets have
a `Verify:` paragraph and are listed under Behavior changes: #9303 (new
tabs get no `window.opener`), #9272 (imported code content is normalized),
#9261 (`$patchStyleText` styles the selection it is given), #9319 (editor
keys and namespaces are a counter without a DOM).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -8
3:### Breaking changes
28:### Behavior changes
54:### Features
62:### Fixes
108:### Performance
112:### Other
116:### Contributors
120:### All changes
$ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md
### Behavior changes

- **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303))

  This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged.

  Verify: pages opened from editor links that relied on `window.opener`.

$ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json   # (kind, [(pr, behavior)])
[('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])]
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
zurfyx added a commit that referenced this pull request Oct 15, 2026
## Description

The changes merged since v0.52.0 predate changesets, so without entries the
v0.53.0 section would leave them out, including the breaking removal of the
deprecated import extensions (#9316).

This adds a changeset for every user-facing pull request in
v0.52.0..main, written from each pull request, with a `PR: #N` line (they
land in this pull request rather than the original ones) and the original
author's handle:

- breaking: #9316, with the full replacement table as `Migration:`
- feature: #9312
- fix: #9335, #9332, #9331, #9328, #9325, #9317, #9321, #9320, #9319,
  #9283, #9303, #9295, #9291, #9260, #9300, #9301, #9272, #9267, #9302,
  #9261, #9262, #9263, #9258
- perf: #9264

Skipped as not user-facing: dependency bumps (all devDependencies), website
and docs updates, test and CI changes, the private devtools extension and
eslint-plugin-internal, and #9353 (a behavior-preserving Flow `Object` to
`any` change).

Four fixes change observable output or behavior, so their changesets have
a `Verify:` paragraph and are listed under Behavior changes: #9303 (new
tabs get no `window.opener`), #9272 (imported code content is normalized),
#9261 (`$patchStyleText` styles the selection it is given), #9319 (editor
keys and namespaces are a counter without a DOM).

It also adds a `[chore]` changeset for this pull request itself, which adds
CHANGELOG.md to the `lexical` package's `files`.

## Test plan

### Before

```
$ node scripts/changesets/check.mjs --base origin/main --head HEAD --coverage warn   # at the previous commit
warning: This pull request changes published code without a changeset for:
  lexical: packages/lexical/package.json (files)
...
Changeset check passed: 0 pending changeset(s) valid; coverage: 1 warning(s), reported only.
```

### After

```
$ node scripts/changesets/check.mjs --base origin/main
Changeset check passed: 27 pending changeset(s) valid; coverage: lexical changed, each named by a changeset.
```

The `latest` release step in a throwaway clone of this branch, with the
real tags:

```
$ LATEST_RELEASE=v0.52.0 npm_package_version=0.53.0 node scripts/changesets/release.mjs --date 2026-10-30
Added v0.53.0 to CHANGELOG.md from 27 changeset(s).
$ ls .changeset
changelog.cjs
config.json
README.md
$ sed -n 1,9p CHANGELOG.md
## v0.53.0 (2026-10-30)

### Breaking changes

- **@lexical/code-core, @lexical/code-shiki, @lexical/html, @lexical/link, @lexical/list, @lexical/mdast, @lexical/rich-text, @lexical/table**: Remove the extensions deprecated in v0.52.0 and earlier ([#9316](#9316))

  The deprecated import and alias extensions are removed. The `*ImportRules`
  arrays, including `HorizontalRuleImportRules`, stay.

$ grep -n '^### ' CHANGELOG.md | head -8
3:### Breaking changes
28:### Behavior changes
54:### Features
62:### Fixes
108:### Performance
112:### Other
116:### Contributors
120:### All changes
$ sed -n '/^### Behavior changes/,+7p' CHANGELOG.md
### Behavior changes

- **@lexical/link**: Open new-tab links from `ClickableLinkPlugin` / `registerClickableLink` without `window.opener` ([#9303](#9303))

  This prevents the opened page from navigating the editor's tab (reverse tabnabbing). Same-tab opens are unchanged.

  Verify: pages opened from editor links that relied on `window.opener`.

$ node scripts/changesets/range.mjs --from 0.52.0 --breaking --json   # (kind, [(pr, behavior)])
[('breaking', [(9316, False)]), ('behavior', [(9303, True), (9272, True), (9261, True), (9319, True)])]
$ sed -n '/^### Contributors/,+2p' CHANGELOG.md
### Contributors

@Tabisharaza, @etrepum, @mbret, @maximilliangrand, @Vedthakar, @rinarakaki, @potatowagon, @followdarko, Gerard Rovira
$ sed -n '/^### All changes/,/^## v0.52.0/p' CHANGELOG.md | sed -n '5,6p;$p' | head -2
- [lexical-yjs][Chore] Change last `Object` to `any` in lexical ([#9353](#9353)) Sam Zhou
- [lexical-eslint-plugin-internal] Chore: lint window messaging channel scoping ([#9339](#9339)) Sherry
```

(`### All changes` has 50 lines: the 48 commits after v0.52.0, without the
`v0.52.0 (#9252)` bump commit, plus this branch's two commits.)

Running again before that release PR is merged:

```
$ git tag v0.53.0   # tagged, but CHANGELOG.md on main has no v0.53.0 section
$ npm_package_version=0.54.0 node scripts/changesets/release.mjs
CHANGELOG.md has no v0.53.0 section, so the v0.53.0 release pull request is not merged yet. Merge it (it consumes the changesets for v0.53.0) before cutting v0.54.0; running again now would put the same changesets in both releases.
(exit 1)
$ npm_package_version=0.53.1 node scripts/changesets/release.mjs
Refusing to release 0.53.1 as a patch: 1 pending [breaking] changeset(s) need a minor release:
  - .changeset/remove-deprecated-import-extensions.md: Remove the extensions deprecated in v0.52.0 and earlier
Run the release with the "minor" increment instead.
(exit 1)
```

A prerelease publish (lexical at 0.52.1-nightly.20261016.0, nothing built,
so the export check that follows fails as expected):

```
$ node scripts/npm/prepare-release.mjs
[lexical] CHANGELOG.md lists pending changes as Unreleased
[lexical] package.json references files that are not present in packages/lexical:
  ./dist/Lexical.dev.js
$ sed -n 1,5p packages/lexical/CHANGELOG.md
## Unreleased

Merged after the latest stable release and included in 0.52.1-nightly.20261016.0. These entries move into a version section when the next stable release is cut.

### Breaking changes
$ git status --short CHANGELOG.md
(clean: only the gitignored package copy changed)
```
@zurfyx zurfyx mentioned this pull request Oct 27, 2026

This branch was successfully deployed

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

Bug: [lexical] Backward line deletion on a line that starts with an inline decorator also deletes the line break before it

2 participants