@reqquest/ui 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -56,8 +56,10 @@
|
|
|
56
56
|
// People often put punctuation at the end or enclose url's in parentheses or quotes so do not include
|
|
57
57
|
// https://www.youtube.com/watch?v=pYBrK1O4UEQ&list=UUHdD1ujwX1fCB0CiamefSWA.
|
|
58
58
|
// => href="https://www.youtube.com/watch?v=pYBrK1O4UEQ&list=UUHdD1ujwX1fCB0CiamefSWA"
|
|
59
|
+
// This runs on htmlEncoded text, so quotes arrive as entities (", '). Treat & as a
|
|
60
|
+
// delimiter except for the & and = entities that legitimately appear inside urls.
|
|
59
61
|
function clickableUrl(str: string) {
|
|
60
|
-
return str.replace(/(\bhttps?:\/\/([
|
|
62
|
+
return str.replace(/(\bhttps?:\/\/(&(?:amp|#x3D);|[^.,!?:&\n\r\t '")]+|[.,!?:][^&\n\r\t '")])+)/g, (m: string) => `<a href="${unencodeUrl(m)}" target="_blank">${m}</a>`)
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
</script>
|