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 validate option to link extension #2781

Merged
merged 4 commits into from
May 16, 2022
Merged

Conversation

bdbch
Copy link
Contributor

@bdbch bdbch commented May 13, 2022

As requested in #2779 this PR implements a way to validate entered urls via a validate option.

Since we don't use the full linkify functionality but only the .find function to filter out links, I decided to only use one simple function for that.

closes #2779

Demo:
https://deploy-preview-2781--tiptap-embed.netlify.app/preview/Examples/AutolinkValidation

Example Code:

Link.configure({
    validate: link => /^https?:\/\//.test(link),
}),

@bdbch bdbch requested a review from svenadlung May 13, 2022 09:41
@bdbch bdbch self-assigned this May 13, 2022
@netlify
Copy link

netlify bot commented May 13, 2022

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 33b9ed5
🔍 Latest deploy log https://app.netlify.com/sites/tiptap-embed/deploys/62821301b04ada000951da9f
😎 Deploy Preview https://deploy-preview-2781--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 settings.

svenadlung
svenadlung previously approved these changes May 16, 2022
Copy link
Contributor

@svenadlung svenadlung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thx a lot!

@svenadlung svenadlung dismissed their stale review May 16, 2022 08:53

Please recheck copy/paste behaviour.

@bdbch bdbch merged commit 3a3eb53 into main May 16, 2022
@bdbch bdbch deleted the feature/expose-linkify-options branch May 16, 2022 10:00
@georgemandis
Copy link
Contributor

Thanks!

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.

Expose Linkify validate method in Link extension
3 participants