Closed hypest closed 5 years ago
We should also escape the double quote character ("
) when inserted in links, otherwise we're breaking the resulting HTML link.
For reference pasting here the link to email tests taken from chromium.
I've also found an interesting post on stackoverflow that could help with Regexps if we decide to investigate this further.
We should also escape the double quote character (" ) when inserted in links, otherwise we're breaking the resulting HTML link.
I added code (with 19c40b3) to encode the link text @daniloercoli . Let me know if that's what you had in mind.
By the way, as it currently is, the email regex won't match when there's a doublequote in the link text. How can I reproduce the case in the screenshot you shared above?
For reference pasting here the link to email tests taken from chromium.
I've also found an interesting post on stackoverflow that could help with Regexps if we decide to investigate this further.
Aha, thanks for looking into this! I feel though that an extensive support like that is outside the scope of this PR. Can we do it in a separate PR? If OK with you, can you open a ticket with the support you'd like to see implemented? Thanks!
Aha, thanks for looking into this! I feel though that an extensive support like that i outside the scope if this PR. Can we do it in a separate PR? If OK with you, can you open a ticket with the support you'd like to see implemented? Thanks!
I agree and will open a new ticket.
By the way, as it currently is, the email regex won't match when there's a doublequote in the link text. How can I reproduce the case in the screenshot you shared above?
If you try by inserting dan"@text.com
you will see there are 2 errors:
http://
prefix is added to it:shipit:
Thanks for the merge and for the new ticket @daniloercoli . We can move any regex discussion there I guess, cool?
Fix #460
This PR mirrors the behavior from Calypso to handle email links and links that need the scheme added.
Test 1
name@company.com
, copy the same to the Link text field and tap OKhref
points to:mailto:name@company.com
(prepended withmailto:
)Test 2
#internalanchor
, copy the same to the Link text field and tap OKhref
points to:#internalanchor
(nohttp://
added)Test 3
wordpress.org
, copy the same to the Link text field and tap OKhref
points to:http://wordpress.org
(there's an addedhttp://
)