diff --git a/frontend/components/task/TaskDocumentPreview.vue b/frontend/components/task/TaskDocumentPreview.vue index deb7781..e6e4327 100644 --- a/frontend/components/task/TaskDocumentPreview.vue +++ b/frontend/components/task/TaskDocumentPreview.vue @@ -124,6 +124,7 @@ import type { TaskDocument } from '~/services/dto/task-document' import { useTaskDocumentService } from '~/services/task-documents' import { formatFileSize } from '~/utils/format' +import { copyToClipboard } from '~/utils/clipboard' const props = defineProps<{ document: TaskDocument | null @@ -159,13 +160,10 @@ const isPdf = computed(() => props.document?.mimeType === 'application/pdf') const isText = computed(() => isTextDocument(props.document)) async function copyContent() { - try { - await navigator.clipboard.writeText(textContent.value) + if (await copyToClipboard(textContent.value)) { copied.value = true useToast().success(t('taskDocuments.copied')) setTimeout(() => { copied.value = false }, 2000) - } catch { - // Clipboard unavailable } } diff --git a/frontend/components/task/TaskGitSection.vue b/frontend/components/task/TaskGitSection.vue index ae4012a..0e6dffc 100644 --- a/frontend/components/task/TaskGitSection.vue +++ b/frontend/components/task/TaskGitSection.vue @@ -229,6 +229,7 @@ import type { Task } from '~/services/dto/task' import type { GiteaBranch, GiteaPullRequest } from '~/services/dto/gitea' import { useGiteaService } from '~/services/gitea' +import { copyToClipboard } from '~/utils/clipboard' const { t } = useI18n() const props = defineProps<{ @@ -374,7 +375,7 @@ async function handleCreate() { async function handleCopy() { try { const result = await getBranchName(props.task.id, branchForm.type) - await navigator.clipboard.writeText(result.name) + await copyToClipboard(result.name) const { success } = useToast() success(t('gitea.branch.copied')) } catch { diff --git a/frontend/pages/profile.vue b/frontend/pages/profile.vue index 2119c80..368185f 100644 --- a/frontend/pages/profile.vue +++ b/frontend/pages/profile.vue @@ -129,6 +129,7 @@