Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: expose forEachSelectedTextNode #6981

Merged
merged 29 commits into from
Dec 21, 2024

Conversation

GermanJablo
Copy link
Contributor

I'd like to extract this feature from my previous PR as it wasn't the point of that PR and will likely be closed.

I'm basically extracting the logic from $patchStyleText into this new function. Iterating over selected text nodes is not a trivial task, since it has to consider partitioning of partial textNodes or token/segmented texts.

The code for this function is mostly repeated in Selection.formatText (I leave a comment there), and perhaps elsewhere.

@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 Dec 19, 2024
Copy link

vercel bot commented Dec 19, 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 Dec 20, 2024 5:46pm
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 5:46pm

Copy link

github-actions bot commented Dec 19, 2024

size-limit report 📦

Path Size
lexical - cjs 31.29 KB (0%)
lexical - esm 31.11 KB (0%)
@lexical/rich-text - cjs 40.34 KB (0%)
@lexical/rich-text - esm 33.04 KB (0%)
@lexical/plain-text - cjs 38.88 KB (0%)
@lexical/plain-text - esm 30.3 KB (0%)
@lexical/react - cjs 42.12 KB (0%)
@lexical/react - esm 34.29 KB (0%)

Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a very useful thing to expose

This reverts commit f6407b7.
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, are you planning to write any additional tests or are we just depending on the $patchStyle tests to verify the behavior here?

@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Dec 20, 2024
@GermanJablo
Copy link
Contributor Author

$patchStyle tests seem enough to me. If there is something wrong with forEachSelectedTextNode, it should fail in patchStyles since it is a very basic wrapper.

@etrepum etrepum added this pull request to the merge queue Dec 21, 2024
Merged via the queue into facebook:main with commit e0dafb8 Dec 21, 2024
35 of 37 checks passed
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.

3 participants