fix(frontend) : copie presse-papiers fonctionnelle en HTTP via fallback execCommand
Auto Tag Develop / tag (push) Successful in 7s
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:
@@ -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') })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user