Skip to content

Add a setter for the format property on RangeSelection#5829

Merged
etrepum merged 3 commits intofacebook:mainfrom
HyperVS:rangeselection
Jul 6, 2025
Merged

Add a setter for the format property on RangeSelection#5829
etrepum merged 3 commits intofacebook:mainfrom
HyperVS:rangeselection

Conversation

@HyperVS
Copy link
Copy Markdown
Contributor

@HyperVS HyperVS commented Apr 4, 2024

This pull request introduces a setter method for the format property within the RangeSelection class. This enhancement aims to simplify the process of updating the format for range selections within the API.

Changes Made:

  • Added a setFormat() method to the RangeSelection class.

This method allows developers to modify the format of the range selection in a more intuitive manner, eliminating the need to directly manipulate the format property.

Benefits

Improves code readability and maintainability by providing a clear and consistent interface for modifying the format property.
Reduces the likelihood of errors and misuse by encapsulating the logic for setting format values within a dedicated method.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 4, 2024

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 Jul 5, 2025 5:36pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2025 5:36pm

@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 Apr 4, 2024
@agriffis
Copy link
Copy Markdown
Contributor

agriffis commented Apr 4, 2024

Where's the code that calls this setter?

@HyperVS
Copy link
Copy Markdown
Contributor Author

HyperVS commented Apr 7, 2024

This addition is more of an api enhancement (exactly like setStyle on the same RangeSelection class). Whilst internal lexical code can use this setter, it is much easier to just use this.format directly within the class.

However, this addition provides a safe way for developers to update the format property without unexpected side-effects, namely from forgetting to set the dirty flag to true after directly manipulating the format property.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 2, 2024

size-limit report 📦

Path Size
lexical - cjs 30.99 KB (0%)
lexical - esm 30.82 KB (0%)
@lexical/rich-text - cjs 39.76 KB (0%)
@lexical/rich-text - esm 32.63 KB (0%)
@lexical/plain-text - cjs 38.35 KB (0%)
@lexical/plain-text - esm 29.95 KB (0%)
@lexical/react - cjs 41.48 KB (0%)
@lexical/react - esm 34.02 KB (0%)

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Jul 5, 2025
@etrepum etrepum added this pull request to the merge queue Jul 6, 2025
Merged via the queue into facebook:main with commit cedd6ef Jul 6, 2025
39 checks passed
@etrepum etrepum mentioned this pull request Jul 10, 2025
fantactuka pushed a commit that referenced this pull request Aug 11, 2025
Co-authored-by: Bob Ippolito <bob@redivi.com>
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.

5 participants