tiptap: [Bug]: Pasting text with more than one link sets all links' href to the first link's href
Which packages did you experience the bug in?
link
What Tiptap version are you using?
2.1.12
What’s the bug you are facing?
I am trying to copy-paste a piece of content that contains more than one link, and the links’ text content can be interpreted as valid URLs. Below an example of such content:
— start copying below —
Some search engines:
- DuckDuckGo: https://duckduckgo.com/
- Bing: https://www.bing.com/
— stop copying above —
When I copy-paste this to a TipTap editor, every link but the first one has a wrong href attribute - all links have a href attribute equal to the href attribute of the first link. See a screen recording below.
Basically on paste, TipTap changes this:
Some search engines:
- DuckDuckGo: <a href="https://duckduckgo.com/">https://duckduckgo.com/</a>
- Bing: <a href="https://www.bing.com/">https://www.bing.com/</a>
To this:
Some search engines:
- DuckDuckGo: <a href="https://duckduckgo.com/">https://duckduckgo.com/</a>
- Bing: <a href="https://duckduckgo.com/">https://www.bing.com/</a>
This only happens for links whose text content is also an URL - it doesn’t happen when links are for example like [DGG](https://duckduckgo.com/)
What browser are you using?
Firefox
Code example
No response
What did you expect to happen?
I expect all links to always have the same href attribute as on the source page from which I copied them.
Anything to add? (optional)
https://github.com/ueberdosis/tiptap/assets/7852553/8a3f6431-a39a-4cc1-95e0-c67e6057fcd8
I didn’t prepare a CodeSandbox because this behavior can be observed right now on TipTap’s official page for the link extension, as seen on the video.
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. 💖
About this issue
- Original URL
- State: open
- Created 8 months ago
- Comments: 17 (7 by maintainers)
Created a draft PR. need to perform further testing of side effects and write tests before publishing
Fix there already?
Published. Ready for review