mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-30 15:20:01 +00:00
Baserow 1237 add protocol cherrypick
This commit is contained in:
parent
d605cf30a7
commit
f19eba47e6
2 changed files with 20 additions and 3 deletions
web-frontend/modules/database/components/view/grid/fields
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue