fix(comments): always surface the closest mark to the current position #2073#2164
fix(comments): always surface the closest mark to the current position #2073#2164nperez0111 merged 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
matthewlipski
left a comment
There was a problem hiding this comment.
Looks good, though am I right in thinking that there's still an issue if 2 comments span the exact same range?
Yep, theoretically, we could cycle between the marks at a range, (i.e. you have to click again to see the "next" mark), but honestly that is an edge case of an edge case that isn't worth it right now |
|
Yeah makes sense, probably more sensible to come up with a UI solution to see multiple threads at once at that point anyway (which ofc is way out of scope), since cycling through threads on click would probably be confusing to users. |
Summary
This changes the logic for selecting a mark to try to surface the mark which is actually closest to the clicked position. Otherwise, it will give preference to marks which span shorter lengths (which are more likely to be hidden when overlapping with other marks).
Rationale
What is happening here is that a text range can contain several marks overlapping on it (pointing to different thread ids). This attempts to surface the "correct" comment by picking which ever is actually closest to the selected position in absolute distance.
Changes
Sorts the list of marks by distance, and chooses the closest mark to the current position to select the thread of
Impact
Testing
Manual testing was done for this. I'm not sure how we'd test this event handler right now, and we want to get this in quickly
Screenshots/Video
Checklist
Additional Notes
Fixes #2073