fix(hyperlinking): fixed url detection

This commit is contained in:
Amir 2021-07-23 02:04:09 +04:30
parent 1a7337a170
commit 5846e90372

View file

@ -162,9 +162,6 @@ const mixin = {
const regex = /(((https?:\/\/)|(www\.))[^\s]+)/g;
if (!string) return '';
return string.replace(regex, (url) => {
if (!url.match('^https?:\\/\\/')) { // If URL does not have http(s), we're adding it manually.
return `<a class="uk-button uk-button-text" href="http://${url}" target="_blank">${url}</a>`
}
return `<a class="uk-button uk-button-text" href="${url}" target="_blank">${url}</a>`
})
}