-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: #5974 Cursor jump to the end of the document when a collaborator deletes focusing paragraph #5975
Conversation
…s-focusing-paragraph
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@fantactuka could you look into this one, would really like to land this one before the next release. |
packages/lexical-yjs/src/Utils.ts
Outdated
} | ||
|
||
// retrieve the parent paragraph node for the currently selected node | ||
const selectedParagraphNode = $findParentParagraphNode( |
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 think you can reuse:
const selectedParagraphNode = $findMatchingParent(selectedNode, (node) => $isParagraphNode(node));
Validate that it's the behaviour you are after - get the closest paragraph parent to 'selectedNode'
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.
thank you!
This is great! Can you pls add a test for this fix? To prevent regression |
packages/lexical-yjs/src/Utils.ts
Outdated
} | ||
|
||
const prevParagraphNode = $getNodeByKey(prevParagraphNodeKey); | ||
if (prevParagraphNodeKey in currentParagraphKeys && prevParagraphNode) { |
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.
As currentParagraphKeys
is an array, it should probably be includes()
not in
if (prevParagraphNodeKey in currentParagraphKeys && prevParagraphNode) { | |
if (currentParagraphKeys .includes(prevParagraphNodeKey) && prevParagraphNode) { |
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.
thank you!
I added a test and fixed! |
The pull request that almost same with my code was created and passed....😢 is it ok in Lexilcal community? |
A more generic fix was merged here: b5fa87d |
fixed #5974
Screen.Recording.2024-04-27.at.16.41.24.mov