mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-04-01 14:24:12 +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 { computed } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
import { toast } from 'vue3-toastify'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: boolean
|
modelValue: boolean
|
||||||
|
@ -94,7 +95,14 @@ async function toggleTag(tag: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copyValue(valueToCopy: string) {
|
async function copyValue(valueToCopy: string) {
|
||||||
await navigator.clipboard.writeText(valueToCopy)
|
try {
|
||||||
|
await navigator.clipboard.writeText(valueToCopy)
|
||||||
|
} catch (error) {
|
||||||
|
toast.error(t('toast.copy.error'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
toast.success(t('toast.copy.success'))
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDownloadLimit() {
|
function setDownloadLimit() {
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { Torrent } from '@/types/vuetorrent'
|
||||||
import { useIntervalFn } from '@vueuse/core'
|
import { useIntervalFn } from '@vueuse/core'
|
||||||
import { computed, ref, watch, onMounted, onUnmounted } from 'vue'
|
import { computed, ref, watch, onMounted, onUnmounted } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { toast } from 'vue3-toastify'
|
||||||
import { useTheme } from 'vuetify'
|
import { useTheme } from 'vuetify'
|
||||||
|
|
||||||
const props = defineProps<{ torrent: Torrent; isActive: boolean }>()
|
const props = defineProps<{ torrent: Torrent; isActive: boolean }>()
|
||||||
|
@ -114,7 +115,14 @@ async function renderTorrentPieceStates() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copyHash() {
|
async function copyHash() {
|
||||||
await navigator.clipboard.writeText(props.torrent.hash)
|
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') {
|
function openMoveTorrentDialog(mode: 'dl' | 'save') {
|
||||||
|
|
|
@ -1015,6 +1015,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"toast": {
|
"toast": {
|
||||||
|
"copy": {
|
||||||
|
"error": "Unable to copy, context isn't secured!",
|
||||||
|
"success": "Copied to clipboard!"
|
||||||
|
},
|
||||||
"magnet_handler": {
|
"magnet_handler": {
|
||||||
"not_supported": "Current context isn't secure. Unable to register handler.",
|
"not_supported": "Current context isn't secure. Unable to register handler.",
|
||||||
"registered": "Magnet handler registered."
|
"registered": "Magnet handler registered."
|
||||||
|
|
Loading…
Add table
Reference in a new issue