1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-14 00:59:06 +00:00

Baserow 1237 add protocol cherrypick

This commit is contained in:
Nigel Gott 2023-06-19 10:22:23 +00:00 committed by Bram Wiepjes
parent d605cf30a7
commit f19eba47e6
2 changed files with 20 additions and 3 deletions
changelog/entries/1.18.0/bug
web-frontend/modules/database/components/view/grid/fields

View file

@ -0,0 +1,7 @@
{
"type": "bug",
"message": "Automatically add https protcol when it is missing from links",
"issue_number": 1237,
"bullet_points": [],
"created_at": "2023-06-02"
}

View file

@ -8,9 +8,12 @@
@contextmenu="stopContextIfEditing($event)"
>
<div v-show="!editing" class="grid-field-text">
<a :href="value" target="_blank" rel="nofollow noopener noreferrer">{{
value
}}</a>
<a
:href="getHref(value)"
target="_blank"
rel="nofollow noopener noreferrer"
>{{ value }}</a
>
</div>
<template v-if="editing">
<input
@ -39,6 +42,13 @@ export default {
this.$refs.input.selectionStart = this.$refs.input.selectionEnd = 100000
})
},
getHref(value) {
const protocolRegex = /^[a-zA-Z]+:\/\//
if (!protocolRegex.test(value)) {
return `https://${value}`
}
return value
},
},
}
</script>