mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-28 06:46:13 +03:00
fix(clipboard): Add missing toast on clipboard action (#1452)
This commit is contained in:
parent
2711307a12
commit
9b81865ded
3 changed files with 22 additions and 2 deletions
|
@ -10,6 +10,7 @@ import { TRCMenuEntry } from '@/types/vuetorrent'
|
|||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { toast } from 'vue3-toastify'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
|
@ -94,7 +95,14 @@ async function toggleTag(tag: string) {
|
|||
}
|
||||
|
||||
async function copyValue(valueToCopy: string) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(valueToCopy)
|
||||
} catch (error) {
|
||||
toast.error(t('toast.copy.error'))
|
||||
return
|
||||
}
|
||||
|
||||
toast.success(t('toast.copy.success'))
|
||||
}
|
||||
|
||||
function setDownloadLimit() {
|
||||
|
|
|
@ -9,6 +9,7 @@ import { Torrent } from '@/types/vuetorrent'
|
|||
import { useIntervalFn } from '@vueuse/core'
|
||||
import { computed, ref, watch, onMounted, onUnmounted } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { toast } from 'vue3-toastify'
|
||||
import { useTheme } from 'vuetify'
|
||||
|
||||
const props = defineProps<{ torrent: Torrent; isActive: boolean }>()
|
||||
|
@ -114,7 +115,14 @@ async function renderTorrentPieceStates() {
|
|||
}
|
||||
|
||||
async function copyHash() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(props.torrent.hash)
|
||||
} catch (error) {
|
||||
toast.error(t('toast.copy.error'))
|
||||
return
|
||||
}
|
||||
|
||||
toast.success(t('toast.copy.success'))
|
||||
}
|
||||
|
||||
function openMoveTorrentDialog(mode: 'dl' | 'save') {
|
||||
|
|
|
@ -1015,6 +1015,10 @@
|
|||
}
|
||||
},
|
||||
"toast": {
|
||||
"copy": {
|
||||
"error": "Unable to copy, context isn't secured!",
|
||||
"success": "Copied to clipboard!"
|
||||
},
|
||||
"magnet_handler": {
|
||||
"not_supported": "Current context isn't secure. Unable to register handler.",
|
||||
"registered": "Magnet handler registered."
|
||||
|
|
Loading…
Reference in a new issue