Skip to content

[Breaking Changes][lexical][lexical-list][lexical-playground] Bug Fix: deleteCharacter through ListNode->ListItemNode - #7248

Merged
etrepum merged 4 commits into
meta:mainfrom
etrepum:delete-character-through-list-7246
Feb 25, 2025
Merged

etrepum merged 4 commits into
meta:mainfrom
etrepum:delete-character-through-list-7246

Conversation

@etrepum

@etrepum etrepum commented Feb 25, 2025 •

Copy link
Copy Markdown
Collaborator

Breaking Changes

As a follow-up to #7180 the collapseAtStart logic now continues through both inline and non-inline nodes so long as there are no previous siblings, roots, or shadow roots encountered. This is because nodes such as CollapsibleTitleNode had a collapseAtStart that returns true but contain nodes that are not inline and have a collapseAtStart that returns false (e.g. ParagraphNode).

In order to fix an inconsistency for how nested !isInline elements behave, CollapsibleContainerNode is now a shadowRoot. The CollapsibleContentNode was already a shadowRoot. This is now similar to the situation for tables where both TableNode and TableCellNode are both shadowRoot. The fix here also moved collapseAtStart from CollapsibleTitleNode to CollapsibleContainerNode which makes a bit more sense since the whole container gets collapsed, not just the title. The title is still the only location that you can initiate this collapse from, since it is always the first child.

Description

Fix deleteCharacter regression introduced in #7155 (v0.25.0). This new deleteCharacter implementation did not handle the scenario when a block element contained !isInline elements and no shadow roots were involved. The fix here changes the state machine to keep descending until a stop condition (shadowRoot or sibling caret) is met

Closes #7246

Test plan

Before

See #7246 for demo of regression

After

e2e test to reproduce regression and confirm fix

@facebook-github-bot facebook-github-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 Feb 25, 2025
@etrepum etrepum added extended-tests Run extended e2e tests on a PR and removed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Feb 25, 2025
@vercel

vercel Bot commented Feb 25, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 8:18pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 8:18pm

@facebook-github-bot facebook-github-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 Feb 25, 2025
@etrepum etrepum changed the title [lexical][lexical-list] Bug Fix: deleteCharacter through ListNode->ListItemNode [Breaking Changes][lexical][lexical-list] Bug Fix: deleteCharacter through ListNode->ListItemNode Feb 25, 2025
@etrepum
etrepum marked this pull request as draft February 25, 2025 18:03
@etrepum etrepum changed the title [Breaking Changes][lexical][lexical-list] Bug Fix: deleteCharacter through ListNode->ListItemNode [Breaking Changes][lexical][lexical-list][lexical-playground] Bug Fix: deleteCharacter through ListNode->ListItemNode Feb 25, 2025
@etrepum
etrepum marked this pull request as ready for review February 25, 2025 20:27
@etrepum
etrepum added this pull request to the merge queue Feb 25, 2025
Merged via the queue into meta:main with commit a79ed52 Feb 25, 2025
@etrepum
etrepum deleted the delete-character-through-list-7246 branch February 25, 2025 21:29
etrepum added a commit to etrepum/lexical that referenced this pull request Mar 1, 2025
@etrepum etrepum mentioned this pull request Mar 3, 2025

This branch was successfully deployed

2 active deployments
Preview – lexical-playground — 66af3fa6 Deployed Feb 25, 2025 by vercel[bot]
Preview – lexical — 66af3fa6 Deployed Feb 25, 2025 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: can't delete backward when previous is a list item

3 participants