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

Add support for autolink #2226

Merged
merged 12 commits into from Dec 3, 2021
Merged

Add support for autolink #2226

merged 12 commits into from Dec 3, 2021

Conversation

philippkuehn
Copy link
Contributor

@philippkuehn philippkuehn commented Dec 2, 2021

This PR adds an option autolink to the link mark (enabled by default). It lets you automatically add or remove links as you type.

Features:

  • simply typed links like tiptap.dev get a correct url → http://tiptap.dev
  • an email address like humans@tiptap.dev get a correct url → mailto:humans@tiptap.dev
  • a link will be removed if it’s not a valid url anymore, e.g. if you insert a space tiptap .dev

fixes #1209

preview: https://deploy-preview-2226--tiptap-embed.netlify.app/preview/Marks/Link

@netlify
Copy link

netlify bot commented Dec 2, 2021

✔️ Deploy Preview for tiptap-embed ready!

🔨 Explore the source changes: 42cda78

🔍 Inspect the deploy log: https://app.netlify.com/sites/tiptap-embed/deploys/61a94a101eb67623ac886c2f

😎 Browse the preview: https://deploy-preview-2226--tiptap-embed.netlify.app

@philippkuehn philippkuehn mentioned this pull request Dec 2, 2021
@rfgamaral
Copy link
Contributor

* simply typed links like `tiptap.dev` get a correct url → `http://tiptap.dev`

I think the default should be https and not http, other than that, this looks good to me (feature-wise, didn't look through the code).

@philippkuehn
Copy link
Contributor Author

philippkuehn commented Dec 2, 2021

@rfgamaral Yes definitely! I’m using linkifyjs and there is an open issue for that. But it’s already fixed in v4. Not sure about a release date.

@hanspagel
Copy link
Contributor

Amazing work @philippkuehn!

Not sure about the https thing! Servers typically redirect http to https, but sites without https can’t redirect to http. So http is probably a better default.

Any feedback on the implementation @maccman?

@philippkuehn
Copy link
Contributor Author

@hanspagel good point!

Philipp Kühn added 5 commits December 2, 2021 15:15
@rfgamaral
Copy link
Contributor

rfgamaral commented Dec 2, 2021

So http is probably a better default.

A better default, but one that enables a less secure Web.

@philippkuehn I know it's not possible right now (without linkifyjs v4), but once it's possible, how easy would it be to allow the link extension to have the defaultProtocol option from linkifyjs? That way you can have http as the extension default, and consumers can change it if they want.

@philippkuehn
Copy link
Contributor Author

Yes, that should be possible.

@ArunGovil
Copy link

Is the autolink feature still present in latest releases?

I'm unable to create links while typing unless theres a whitespace followed by the url.

Is this an expected behaviour?

@philippkuehn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autolink
4 participants