1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-21 23:37:55 +00:00
bramw_baserow/web-frontend/modules/database/mixins/linkURLField.js
2024-07-15 10:19:55 +00:00

21 lines
448 B
JavaScript

import { isValidURL } from '@baserow/modules/core/utils/string'
import { ensureUrlProtocol } from '@baserow/modules/core/utils/url'
export default {
methods: {
isValid(value) {
return isValidURL(value?.url)
},
getLabelOrURL(value) {
if (!value) {
return ''
} else {
return value.label ? value.label : value.url
}
},
getHref(value) {
return ensureUrlProtocol(value)
},
},
}