1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-27 06:00:37 +00:00
bramw_baserow/web-frontend/modules/database/components/row/RowEditFieldFormulaLink.vue
2022-09-20 08:51:55 +00:00

37 lines
848 B
Vue

<template>
<div class="control__elements">
<a
v-if="isValidLinkURL"
:href="copy && copy.url"
target="_blank"
rel="nofollow noopener noreferrer"
>
{{ labelOrURL }}
</a>
<span v-else>
{{ labelOrURL }}
</span>
</div>
</template>
<script>
import rowEditField from '@baserow/modules/database/mixins/rowEditField'
import rowEditFieldInput from '@baserow/modules/database/mixins/rowEditFieldInput'
import { isValidURL } from '@baserow/modules/core/utils/string'
export default {
mixins: [rowEditField, rowEditFieldInput],
computed: {
isValidLinkURL() {
return this.copy && isValidURL(this.copy.url)
},
labelOrURL() {
if (!this.copy) {
return ''
} else {
return this.copy.label ? this.copy.label : this.copy.url
}
},
},
}
</script>