From cfbff75f78963e3d24326f731590e78a4d719e9e Mon Sep 17 00:00:00 2001 From: Zéro~Informatique Date: Sun, 6 Nov 2022 19:34:26 +0100 Subject: viewer/command: add item download button Fixed a reactivity issue with props used in a composition function (useItemResource) Fixed crash with null items in LayoutTop Changed how downloadable items are identified: We use the fact they are materialized in the gallery instead of a hardly defined "listing condition". This also simplifies the code. --- viewer/src/views/item_handlers/AudioViewer.vue | 4 ++-- viewer/src/views/item_handlers/DownloadViewer.vue | 4 ++-- viewer/src/views/item_handlers/MarkdownViewer.vue | 4 ++-- viewer/src/views/item_handlers/PdfViewer.vue | 4 ++-- viewer/src/views/item_handlers/PictureViewer.vue | 4 ++-- viewer/src/views/item_handlers/PlainTextViewer.vue | 4 ++-- viewer/src/views/item_handlers/VideoViewer.vue | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) (limited to 'viewer/src/views/item_handlers') diff --git a/viewer/src/views/item_handlers/AudioViewer.vue b/viewer/src/views/item_handlers/AudioViewer.vue index bbba7e5..124d132 100644 --- a/viewer/src/views/item_handlers/AudioViewer.vue +++ b/viewer/src/views/item_handlers/AudioViewer.vue @@ -43,7 +43,7 @@ import { AudioItem } from '@/@types/gallery'; import { useNavigation } from '@/services/navigation'; import { useItemResource } from '@/services/ui/ldItemResourceUrl'; -import { computed, PropType } from 'vue'; +import { computed, PropType, toRef } from 'vue'; import { useI18n } from 'vue-i18n'; import ItemThumbnail from '../ItemThumbnail.vue'; @@ -54,7 +54,7 @@ const props = defineProps({ const { t } = useI18n(); const navigation = useNavigation(); -const { itemResourceUrl } = useItemResource(props.item); +const { itemResourceUrl } = useItemResource(toRef(props, 'item')); const itemFileName = computed(() => navigation.getFileName(props.item)); diff --git a/viewer/src/views/item_handlers/DownloadViewer.vue b/viewer/src/views/item_handlers/DownloadViewer.vue index 6562bee..c627d3e 100644 --- a/viewer/src/views/item_handlers/DownloadViewer.vue +++ b/viewer/src/views/item_handlers/DownloadViewer.vue @@ -41,7 +41,7 @@ import { DownloadableItem } from '@/@types/gallery'; import { useNavigation } from '@/services/navigation'; import { useItemResource } from '@/services/ui/ldItemResourceUrl'; import { faFileDownload } from '@fortawesome/free-solid-svg-icons'; -import { computed, PropType } from 'vue'; +import { computed, PropType, toRef } from 'vue'; import { useI18n } from 'vue-i18n'; const props = defineProps({ @@ -52,7 +52,7 @@ const { t } = useI18n(); const navigation = useNavigation(); const itemFileName = computed(() => navigation.getFileName(props.item)); -const { itemResourceUrl } = useItemResource(props.item); +const { itemResourceUrl } = useItemResource(toRef(props, 'item'));