-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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(react-editor): reset focus offset when triple clicking #4512
fix(react-editor): reset focus offset when triple clicking #4512
Conversation
|
if (innermostFocusElement) { | ||
const lastTextNode = innermostFocusElement.childNodes[0] | ||
focusNode = lastTextNode | ||
// if (anchorNode!.nodeType === 1) { |
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.
Just remove the commented out code.
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.
I'm not sure what you meant. Which part is the comment-out code?
EDIT: Okay, I saw it.
Sigh, I merged without a changeset. opening a PR for the changeset now. |
I forgot to ask: When should I add a changeset, and when should I not? I thought this change is a correction for my flawed triple click fix, so I didn't think of adding a changeset. |
… unhanging range with void
Description
In my triple click fix, I reset the
focusNode
but forgot to reset the relatedfocusOffset
value. As a result, the Slate range computed from DOM selection is still not correct and cause a number of issues when users try to transform a block by applying formatting or deleting.Issue
Fixes: #4492
Example
Before the fix
2021-09-08--16-22-05__triple-click-on-marks.mp4
After the fix
2021-09-13--17-57-12__select-element-delete.mp4
2021-09-13--18-01-13__click-shift-arrow-down.mp4
2021-09-13--18-01-38__triple-click-at-mark.mp4
Context
Here's what I did:
focusNode
to avoid error thrown when accessing property of a potentially null value.focusNode
object.Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)