Browse Source

fix: use `useCopy` composable for copying content to clipboard

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/8023/head
Pranav C 8 months ago
parent
commit
72e013a8d9
  1. 6
      packages/nc-gui/components/general/CopyUrl.vue

6
packages/nc-gui/components/general/CopyUrl.vue

@ -12,19 +12,21 @@ const isCopied = ref({
embed: false, embed: false,
}) })
const { copy } = useCopy()
const openUrl = async () => { const openUrl = async () => {
window.open(url.value, '_blank', 'noopener,noreferrer') window.open(url.value, '_blank', 'noopener,noreferrer')
} }
const embedHtml = async () => { const embedHtml = async () => {
await navigator.clipboard.writeText(`<iframe src="${url.value}" width="100%" height="100%" style="border: none;"></iframe>`) await copy(`<iframe src="${url.value}" width="100%" height="100%" style="border: none;"></iframe>`)
isCopied.value.embed = true isCopied.value.embed = true
} }
const copyUrl = async () => { const copyUrl = async () => {
isCopied.value.link = false isCopied.value.link = false
await navigator.clipboard.writeText(url.value) await copy(url.value)
setTimeout(() => { setTimeout(() => {
isCopied.value.link = true isCopied.value.link = true

Loading…
Cancel
Save