Skip to content
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

Error on using link annotation with no selected value #8180

Open
lcnogueira opened this issue Jan 4, 2025 · 1 comment
Open

Error on using link annotation with no selected value #8180

lcnogueira opened this issue Jan 4, 2025 · 1 comment
Assignees

Comments

@lcnogueira
Copy link

lcnogueira commented Jan 4, 2025

Describe the bug

When using a block type field, Sanity adds a "link" annotation to the studio by default. Sometimes using that annotation link throws an error.

To Reproduce

Steps to reproduce the behavior:

  1. Go to any block type field.
  2. Move the mouse cursor to the end of the line and press "space" to move away from the last word on that line.
  3. Click the "Link" annotation.
  4. See an error that looks like this:
Error: Cannot resolve a DOM point from Slate point: {"path":[28,0],"offset":20}

I also recorded a video in case it's helpful:
https://github.com/user-attachments/assets/2e36a92d-3621-4b95-b4be-822ba3c1bc6c

Expected behavior

It should either 1) disable the link annotation button or 2) select the last word on that line to apply the link.

Screenshots
Screenshot 2025-01-04 at 15 49 04

Which versions of Sanity are you using?

@sanity/cli (global)  3.49.0 (latest: 3.68.3)
@sanity/code-input     4.1.4 (latest: 5.1.2)
@sanity/icons          3.4.0 (latest: 3.5.7)
@sanity/table          1.1.2 (latest: 1.1.3)
@sanity/ui            2.8.10 (latest: 2.10.18)
@sanity/vision        3.48.1 (latest: 3.68.3)
sanity                3.62.0 (latest: 3.68.3)

What operating system are you using?
Mac OS Ventura 13.3.1

Which versions of Node.js / npm are you running?

v20.15.0

Additional Information
I also noticed this applies to other custom annotations I created.

@christianhg
Copy link
Member

Thank you for reporting this. There seems to be an off-by-one error going on here. I'll look into it.

@christianhg christianhg self-assigned this Jan 7, 2025
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

No branches or pull requests

2 participants