-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
Co-authored-by: Bob Ippolito <[email protected]>
Co-authored-by: Bob Ippolito <[email protected]>
Co-authored-by: Bob Ippolito <[email protected]>
…I just needed to remove the return type
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
There was a problem hiding this 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.
There was a problem hiding this 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?
|
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.