Skip to content

fix: update y-prosemirror to fix #1462 #1608

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

Merged
merged 1 commit into from
Apr 17, 2025
Merged

fix: update y-prosemirror to fix #1462 #1608

merged 1 commit into from
Apr 17, 2025

Conversation

nperez0111
Copy link
Contributor

This only updates y-prosemirror to the latest patch version which includes this fix for selection handling: yjs/y-prosemirror#181

Which resolves #1462

Copy link

vercel bot commented Apr 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Apr 14, 2025 7:01am
blocknote-website ✅ Ready (Inspect) Visit Preview Apr 14, 2025 7:01am

Copy link

pkg-pr-new bot commented Apr 14, 2025

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@1608

@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@1608

@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@1608

@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@1608

@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@1608

@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@1608

@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@1608

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@1608

@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@1608

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@1608

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@1608

commit: 480dc36

@YousefED
Copy link
Collaborator

Great to see this fixed!! I'm not sure if we can prevent this, but I do think you can now force one's cursor to jump to the next block (the gif below is not super clear - can jump on a call to discuss)

cursors

@nperez0111
Copy link
Contributor Author

Great to see this fixed!! I'm not sure if we can prevent this, but I do think you can now force one's cursor to jump to the next block (the gif below is not super clear - can jump on a call to discuss)

Unfortunately, I think this is an inherent limitation of y-prosemirror representing content as an XML tree: yjs/y-prosemirror#44 (comment) If this were a flat tree, then the character position would be stable in an operation like this.

The node that the cursor is referencing is deleted so the relative position points to a node that no longer exists, but did exist after the first node, so it guesses that it was closer to the end of the content. TextSelection.between then moves that in-between position to the first position in the node since it's bias is unspecified. You could try to bias it going backward (i.e. pick the position before so the end of the node content), but that still is just as unexpected and would mess with the logic in the other direction so it makes sense to keep the current default.

If y-prosemirror applied minimal diffs, then we could map the selection using normal prosemirror behavior instead of having to use a relative position. But, that would still require work on the y-prosemirror side to resolve.

@nperez0111
Copy link
Contributor Author

nperez0111 commented Apr 15, 2025

Along the way of looking into this. I rewrote the selection handling in y-prosemirror to be much more robust, so I guess it wasn't completely wasted effort! yjs/y-prosemirror#182

@nperez0111 nperez0111 merged commit 2bbaa2a into main Apr 17, 2025
8 checks passed
@nperez0111 nperez0111 deleted the fix/1462 branch April 17, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't delete a line where the is cursor
2 participants