fix(frontend) : copie presse-papiers fonctionnelle en HTTP via fallback execCommand
Auto Tag Develop / tag (push) Successful in 7s

navigator.clipboard n'est disponible qu'en secure context (HTTPS/localhost),
ce qui cassait la copie en prod HTTP. Ajout d'un utilitaire copyToClipboard
avec fallback textarea + execCommand, appliqué au viewer Markdown, au token
API du profil et au nom de branche Git.
This commit is contained in:
Matthieu
2026-06-01 22:52:07 +02:00
parent 85897708ec
commit e1bf9ecb22
4 changed files with 47 additions and 8 deletions
+3 -3
View File
@@ -129,6 +129,7 @@
<script setup lang="ts">
import { useAvatarService } from '~/composables/useAvatarService'
import { useApiTokenService } from '~/services/api-token'
import { copyToClipboard } from '~/utils/clipboard'
const auth = useAuthStore()
const toast = useToast()
@@ -181,10 +182,9 @@ async function onRemove() {
async function onCopy() {
if (!auth.user?.apiToken) return
try {
await navigator.clipboard.writeText(auth.user.apiToken)
if (await copyToClipboard(auth.user.apiToken)) {
toast.success({ message: t('profile.apiToken.copied') })
} catch {
} else {
toast.error({ message: t('profile.apiToken.copyFailed') })
}
}