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

Linkify urls in text #1860

Open
1 task done
JoepHeijnen opened this issue May 13, 2024 · 6 comments
Open
1 task done

Linkify urls in text #1860

JoepHeijnen opened this issue May 13, 2024 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@JoepHeijnen
Copy link
Contributor

JoepHeijnen commented May 13, 2024

Is there an existing issue for this?

The question

It seems that not all variants of urls are linkified in the text only the urls with a prefix like http or https. I see support for regex, but only for QuillToolbarImageButton and other kinds of buttons. What I want is that when I add one of the urls below that the editor automatically detects that it's an url.

Urls that are linkified
http://google.com
https://google.com
https://www.google.com

Urls that aren't linkified
www.google.com
google.com

I can remember that this used to work, but at the moment it isn't.

@JoepHeijnen JoepHeijnen added the help wanted Extra attention is needed label May 13, 2024
@hoangsang17th
Copy link
Contributor

hoangsang17th commented May 13, 2024

In QuillToolbar > QuillToolbarImageButton, you can update regex of the link for all cases that you know
image

@JoepHeijnen
Copy link
Contributor Author

Isn't this just the regex for adding an image with an url? I meant the urls in the text.

@JoepHeijnen JoepHeijnen changed the title Linkify urls Linkify urls in text May 13, 2024
@hoangsang17th
Copy link
Contributor

Sorry, my mistake.
You can update linkPrefixes at here.
image

// this is default
const linkPrefixes = [
  'mailto:', // email
  'tel:', // telephone
  'sms:', // SMS
  'callto:',
  'wtai:',
  'market:',
  'geopoint:',
  'ymsgr:',
  'msnim:',
  'gtalk:', // Google Talk
  'skype:',
  'sip:', // Lync
  'whatsapp:',
  'http'
];

@JoepHeijnen
Copy link
Contributor Author

Thanks for the response. This is really nice if you want a prefix, but in my use case I don't want the prefix. For example, www.google.com and google.com are links without an prefix, but are still a link.

@hoangsang17th
Copy link
Contributor

hoangsang17th commented May 16, 2024

You can fork, update and make a PR

@hoangsang17th
Copy link
Contributor

Basically, before, the package supported regex determination, but no one really made a regex to support a text like google.com. You know what? Because of typographical errors, a lot of text will be automatically marked as a link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants