tiptap icon indicating copy to clipboard operation
tiptap copied to clipboard

Can't escape a created link

Open Calvein opened this issue 2 years ago • 13 comments

What’s the bug you are facing?

Here's a video with the issue:

As you can see, we can't "get out" of the link once it's set.

Which browser was this experienced in? Are any special extensions installed?

Only tested in Chrome 105

How can we reproduce the bug on our side?

On the example page, can have 3 ways to add links:

  • Select text & paste a link
  • Select text & click on setLink
  • Paste a link

We don't have the issue when you paste a link directly when we do for the 2 others cases, see:

Can you provide a CodeSandbox?

No response

What did you expect to happen?

I would expect the link to not be active after setting it.

Anything to add? (optional)

No response

Did you update your dependencies?

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

Are you sponsoring us?

  • [ ] Yes, I’m a sponsor. 💖

Calvein avatar Oct 10 '22 09:10 Calvein

FYI, I fixed this by installing the v30 since the issue since to be from the v31

Calvein avatar Oct 10 '22 14:10 Calvein

FYI, I fixed this by installing the v30 since the issue since to be from the v31

Thanks for the tips! I encounter the same bug, and your solution works!

Pats666 avatar Oct 12 '22 06:10 Pats666

Facing the same issue w/ latest v2.0.0-beta.199. I was able to temporarily solve it by running editor.commands.unsetMark('link'); when the user clicks on link button and no text is selected.

lordinkavu avatar Nov 02 '22 18:11 lordinkavu

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Feb 01 '23 00:02 github-actions[bot]

I confirm I have the same issue. Commenting to remove the "stale" tag

cnicodeme avatar Feb 01 '23 10:02 cnicodeme

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar May 06 '23 00:05 github-actions[bot]

Commenting again to remove "stale" tag.

chrisdeeming avatar May 08 '23 02:05 chrisdeeming

I assumed the solution to this would be to use exitable but this doesn't appear to do anything.

chrisdeeming avatar May 08 '23 02:05 chrisdeeming

This still an issue

DannyFeliz avatar Aug 07 '23 22:08 DannyFeliz

Overwriting the "inclusive" attribute of the Link extension to be false, like the following,

Link.extend({
    inclusive: false
})

, worked for me.

hugh-sun-everlaw avatar Aug 08 '23 00:08 hugh-sun-everlaw

This actually should be controlled with exitable and inclusive properties. exitable: true allows to "escape" link mark with ArrowRight key. inclusive: false makes mark inactive when cursor is at its end so typing "escapes" mark.

Unfortunately due to a bug in extension config overrides value of the exitable property wasn't preserved properly. This appears to be fixed by https://github.com/ueberdosis/tiptap/pull/4191 that's included in 2.2.0-rc.4.

By default @tiptap/extension-link isn't exitable so you'd need to extend it.

Link.extend({
  exitable: true
})

romansp avatar Oct 17 '23 19:10 romansp

I can verify that @romansp's solution works. Instead of having editable: true, simply put inclusive: false works.

Link.extend({
  inclusive: false
})

And you don't have to upgrade to 2.2.0-rc.4. 2.1.12 works too.

mechiland avatar Nov 03 '23 03:11 mechiland

Ok this Link.extend({ inclusive: false })

this is working but there is error " hello how are you " (" ") is being interpreted between the text. when I inspect the <P> </P>

Screenshot (336)

loki4514 avatar Mar 25 '24 12:03 loki4514