-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Fix child element decorations #4910
Fix child element decorations #4910
Conversation
🦋 Changeset detectedLatest commit: 898cd87 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🚀 |
The regression I'm fixing was caused by #4876 - which I should have tagged above for context. |
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.
Good catch, and good PR.
I've left a couple of questions for consideration, and also if you could as part of this PR please remove const decorate = useDecorate()
on line 36 (and the import for useDecorate) as it's not used anymore.
* fix slate-react handling of nested element decorations * chore: add changeset * changes from review
This reverts commit 2a8d86f.
Description
Due to a regression, decorations that cross child elements were not properly passed to those elements for rendering; the offsets from the anchor and node were being applied to every child node, rather than the specific intersection. This PR ensures that the child elements always receive the intersecting range of the decoration.
Issue
Fixes: #4909
Example
Given this value, where some elments are nested under a parent element:
And this return from decorateNode on the parent element above:
The decorations passed down to the child elements will be only their intersecting range, so that the decoration is applied correctly across the children.
From the linked issue, see this image of the regression (this PR seeks to restore prior behavior shown on 0.66 here):
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)