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

[Bug]: extendMarkRange doesn't work selecting first character #4237

Open
1 of 2 tasks
timfuhrmann opened this issue Jul 20, 2023 · 1 comment
Open
1 of 2 tasks

[Bug]: extendMarkRange doesn't work selecting first character #4237

timfuhrmann opened this issue Jul 20, 2023 · 1 comment
Labels
Triage: Open A new issue or pullrequest that requires triage (added by default)

Comments

@timfuhrmann
Copy link

timfuhrmann commented Jul 20, 2023

Which packages did you experience the bug in?

react, extension-link

What Tiptap version are you using?

2.0.4

What’s the bug you are facing?

Selecting the first character of a link and calling extendMarkRange("link").unsetLink().run() will only unset the link for the first character - selecting any other character and calling said chain of functions will completely remove the link, as expected. Same behavior for other extensions like bold or italic - it seems that extendMarkRange is not working properly selecting the first character only.

What browser are you using?

Chrome

Code example

https://codesandbox.io/s/laughing-ardinghelli-g255xt?file=/src/App.js

What did you expect to happen?

Since extendMarkRange is being called the link should be remove completely.

Anything to add? (optional)

How To Reproduce

  1. Select first character of a link
  2. Click unsetLink

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@timfuhrmann timfuhrmann added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Triage: Open A new issue or pullrequest that requires triage (added by default) Type: Bug The issue or pullrequest is related to a bug labels Jul 20, 2023
@timfuhrmann timfuhrmann changed the title [Bug]: extendMarkRange doesn't work selecting first character of a link [Bug]: extendMarkRange doesn't work selecting first character Jul 20, 2023
@gilmarsquinelato
Copy link

gilmarsquinelato commented Oct 16, 2023

Hello everyone!

This bug is happening to me as well.

Even by simply running editor.chain().focus().extendMarkRange('link').run() you can see how it's behaving.

If the selection only contains part of the text but not the first character, it works perfectly.
If the selection contains the first character (it doesn't need to be only the first character) but isn't the entire link range, it doesn't extend the selection.

I hope this information helps you to find the root cause :)

@bdbch bdbch removed Type: Bug The issue or pullrequest is related to a bug Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. labels Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Open A new issue or pullrequest that requires triage (added by default)
Projects
Status: Triage open
Development

No branches or pull requests

4 participants