[lexical-playground] Bug fix: make clear formatting work on multiple paragraphs#8224
Merged
etrepum merged 7 commits intofacebook:mainfrom Mar 16, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Mar 15, 2026
Collaborator
etrepum
left a comment
There was a problem hiding this comment.
It would be better for maintainability for these to use the public API. Whenever direct property access is used there's extra mental effort involved to ensure that either the intent is to inspect that exact version, the node is guaranteed to be the latest version, or at least the value should be identical to the latest version. Using the getter means that you don't have to do that analysis when reviewing the code.
etrepum
reviewed
Mar 16, 2026
Collaborator
etrepum
left a comment
There was a problem hiding this comment.
Something about the e2e test isn't working consistently in firefox and webkit, might want to try a different technique to make the selection
etrepum
approved these changes
Mar 16, 2026
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
Clear formatting functionality does not work correctly when selection spans over more than one paragraph. This PR modifies
clearFormattingfunction frompackages/lexical-playground/src/plugins/ToolbarPlugin/utils.tsto fix this issue. This function was mainly operating on nodes fromselection.getNodes(), now it leveragesselection.extract().Test plan
Added one test in
packages/lexical-playground/__tests__/e2e/ClearFormatting.spec.mjs.Before
lexical.-.clear.format.-.before.mp4
After
lexical.-.clear.format.-.after.mp4