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

fix(link): Fix autolinking and pasting #4292

Merged
merged 2 commits into from
Aug 10, 2023
Merged

fix(link): Fix autolinking and pasting #4292

merged 2 commits into from
Aug 10, 2023

Conversation

bdbch
Copy link
Contributor

@bdbch bdbch commented Aug 5, 2023

Please describe your changes

This PR will fix multiple issues with the current auto linking.

  • First fix is that pasteOnLink option was not working anymore
  • I'll also fix an apparent issue that content after a pasted link is also autolinked? (wasn't able to reproduce for now)

Checklist

  • The changes are not breaking the editor
  • Added tests where possible
  • Followed the guidelines
  • Fixed linting issues

Related issues

fixes #4256
fixes #4258

@netlify
Copy link

netlify bot commented Aug 5, 2023

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 9b7ef50
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/64d25307e800100008fa5d8a
😎 Deploy Preview https://deploy-preview-4292--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@bdbch bdbch self-assigned this Aug 10, 2023
@bdbch bdbch marked this pull request as ready for review August 10, 2023 23:31
@bdbch bdbch requested a review from svenadlung as a code owner August 10, 2023 23:31
@bdbch bdbch removed the request for review from svenadlung August 10, 2023 23:44
@bdbch bdbch merged commit a2ce734 into develop Aug 10, 2023
14 checks passed
@bdbch bdbch deleted the bdbch/fix-autolink branch August 10, 2023 23:44
@rfgamaral
Copy link
Contributor

@bdbch The docs for the linkOnPaste option say:

Adds a link to the current selection if the pasted content only contains an url.

But I don't think this is quite true...

Take the link editor example and paste something like [tiptap](https://tiptap.dev). You can see that https://tiptap.dev will be converted into a link, but the pasted content does not only contain a URL, it contains more than that.

firefox_paI0aAJ33T

This became a problem for us because we have Markdown support on our editor, and we have our own paste rules to handle the Markdown syntax. However, this new linkOnPaste option (default: true) caused us an issue by auto-linking when it shouldn't (based on my interpretation of the documentation).

As a workaround, we are setting linkOnPaste to false, and this seems to fix everything for us, but I'm wondering if this shouldn't be fixed in Tiptap itself? Although Tiptap does not support Markdown, I don't think the link found in [tiptap](https://tiptap.dev) should be auto-linked.

Here's another example of a similar situation where auto-linking shouldn't have worked:

firefox_oa8cLw6arn

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
2 participants