-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[@lexical/selection] Feature: yield target to style patch fn #6472
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
string | null | ((currentStyleValue: string | null) => string) | ||
| string | ||
| null | ||
| ((currentStyleValue: string | null, _target: typeof target) => string) |
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.
Is there a need to underscore this parameter name? Does it get caught by the eslint shadow rule?
| ((currentStyleValue: string | null, _target: typeof target) => string) | |
| ((currentStyleValue: string | null, target: typeof target) => string) |
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.
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.
LGTM, it seems reasonable to pass this information along and it's great that you've also added tests for this feature! One thing that might be a bit counter-intuitive is that the target is not necessarily the same target that is passed to $patchStyle
since it will only be a RangeSelection
when the given selection is collapsed
@etrepum , is there anything I need to do to get this PR merged? Thanks for approving the PR. |
Description
$patchStyleText doesn't expose the target to the CSS property
patch
function. However, it can be very helpful when the next style value may depend on the target node/selection.Test plan
Added unit tests
Before
After