-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Ensure only valid URLs or anchors within text are automatically created as links #32663
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @tjcafferkey! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
I think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Tom 👋
Thanks for contributing to Gutenberg 😄
This looks good to me and seems like a positive change.
I wonder whether you'd consider adding an e2e test to cover this scenario?
All the building blocks should be there in the other tests.
npm run test-e2e packages/e2e-tests/specs/editor/various/links.test.js
should run the tests. There are docs on testing as well with a section on e2e tests.
Yeah shouldn't be a problem :) I'll update the PR soon with some E2E coverage. Thanks for pointing me in the right direction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for the e2e test. Some small ideas and then we're good to go.
It wasn't moved there originally because the function validates anchor links, which aren't URLs. Maybe that isn't a strong enough reason not to move it there, but I think it shouldn't be confused with a URL checker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good @tjcafferkey 🥇
Thanks for contributing 🤝
Congratulations on your first merged pull request, @tjcafferkey! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
This also fixed #33009 🎉 Thanks for the contribution @tjcafferkey. |
Fixes #32301
Description
isValidHref
withinaddLink
function to check the validity of selected textHow has this been tested?
this: is invalid text
Unit tests also included.
Types of changes
Bug fix (non-breaking change which fixes an issue)Checklist:
*.native.js
files for terms that need renaming or removal).