-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Make linkValidation allow hash links #1143
Conversation
link = editor.elements[0].querySelector('a'); | ||
expect(link).not.toBeNull(); | ||
expect(link.getAttribute('href')).toBe(validHashLink); | ||
}); |
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.
Could you add an extra space before and after this assertion?
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.
Good point, I will add spaces.
@@ -235,7 +235,8 @@ | |||
// Matches any alphabetical characters followed by :// | |||
// Matches protocol relative "//" | |||
// Matches common external protocols "mailto:" "tel:" "maps:" | |||
var urlSchemeRegex = /^([a-z]+:)?\/\/|^(mailto|tel|maps):/i, | |||
// Matches relative hash link, "#" followed by any character | |||
var urlSchemeRegex = /^([a-z]+:)?\/\/|^(mailto|tel|maps):|^\#.+/i, |
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.
Should this allow just plain #
as a valid link? Right now it seems like it wouldn't allow that.
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.
In my opinion, the hash should be omitted if there is no fragment identifier; however, you are correct that it is valid, so it should be allowed here.
Looks awesome @cruzanmo , thanks a ton! |
Description
Allows hash links, e.g.
#fragment-identifier
, whenlinkValidation
is set totrue
. This was brought up in this discussion: #714