-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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]: link plugin doesn't detect link unless it's followed by whitespace #6251
Comments
Hey @duhaime! The reason this happens is that we're using a specific regex triggering as soon as a whitespace is inserted. First this helps us to only do it once when a full link was inserted and the full link is known to the editor to be set as the links href but also for performance reasons as we'd otherwise always would have to check the whole text node for links. I checked what Notion does and it works the same over there. Is there a specific reason why you'd need to not want a whitespace as a trigger except maybe adding a link to the end of a sentence? |
Hey @duhaime this is actually not an issue, the editor requires a whitespace to properly trigger a lookup for links, if you don't add a whitespace, it means that the word didn't end, so it cannot be used as a lookup. It won't happen when you copy and paste links because there we we act at the moment of parsing the copied text so we can identify links. But while you're writing it requires a whispace so we can trigger for a link identification :) |
hey guys! Thanks for the fast follow up. The intended behavior here is fundamentally up to you, but for what it's worth, the current logic feels flawed to me. I think Slack's model is much nicer--as soon as you type a valid link with a valid tld, the editor linkifies the mark. Screen.Recording.2025-04-08.at.11.46.29.AM.movOn tiptap, though, the logic is such that you can't end a sentence with a link :/ Screen.Recording.2025-04-08.at.11.51.28.AM.mov |
@duhaime you can acheive the desired behaviour by extending tiptap Link extension like this
|
Affected Packages
extension-link
Version(s)
current
Bug Description
Hey all, possibly there's some config we can pass to avoid this behavior, but it looks like the Link component doesn't recognize a link unless the link text is followed by whitespace:
Screen.Recording.2025-04-07.at.10.15.18.AM.mov
Is there a way to get the editor to recognize the link without the trailing whitespace?
Browser Used
Chrome
Code Example URL
No response
Expected Behavior
I'd expect google.com to be highlighted / linkified before the trailing whitespace is added
Additional Context (Optional)
I'm checking the dependecy updates box below on the assumption that the live demo has updated deps
Dependency Updates
The text was updated successfully, but these errors were encountered: