|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import type { ButtonType, ColumnType } from 'nocodb-sdk' |
|
|
|
|
import type { Ref } from 'vue' |
|
|
|
|
import { decode, encode } from 'html-entities' |
|
|
|
|
|
|
|
|
|
const column = inject(ColumnInj) as Ref< |
|
|
|
|
ColumnType & { |
|
|
|
@ -50,7 +51,15 @@ const triggerAction = async () => {
|
|
|
|
|
const componentProps = computed(() => { |
|
|
|
|
if (column.value.colOptions.type === 'url') { |
|
|
|
|
let url = `${cellValue.value?.url}` |
|
|
|
|
url = encodeURI(/^(https?|ftp|mailto|file):\/\//.test(url) ? url : url.trim() ? `http://${url}` : '') |
|
|
|
|
url = /^(https?|ftp|mailto|file):\/\//.test(url) ? url : url.trim() ? `http://${url}` : '' |
|
|
|
|
|
|
|
|
|
// if url params not encoded, encode them using encodeURI |
|
|
|
|
try { |
|
|
|
|
url = decodeURI(url) === url ? encodeURI(url) : url |
|
|
|
|
} catch { |
|
|
|
|
url = encodeURI(url) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
href: url, |
|
|
|
|
target: '_blank', |
|
|
|
|