From dac398237033b43afaf198a9b0c07a11815a6fd5 Mon Sep 17 00:00:00 2001 From: Salem Yaslem Date: Mon, 4 Nov 2024 12:34:53 +0300 Subject: [PATCH] add simple image viewer --- app.vue | 13 ++++--- components/ImageViewer.vue | 71 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 components/ImageViewer.vue diff --git a/app.vue b/app.vue index 2a30a14..42dab78 100644 --- a/app.vue +++ b/app.vue @@ -3,7 +3,7 @@ import { getElementInfo } from "moveable"; import { VueSelecto } from "vue3-selecto"; import { useDisplay } from 'vuetify/lib/framework.mjs'; import { HistoryManager } from './composables/history-manager'; -import { FilesManager, supportedExtensions } from './composables/files-manager'; +import { FilesManager, supportedExtensions, imageExtensions } from './composables/files-manager'; import type { iFile } from "composables/worker/7zip-manager" import { videoExtensions, binaryExtensions } from '#imports'; @@ -73,8 +73,9 @@ watchEffect(async () => { selectedElement.classList.remove("selected"); } - // Experimental feature - if (videoExtensions.includes(filesManager.getFile(selectedPath.value)?.extension?.toLowerCase())) { + // Update to handle both video and image files + if (videoExtensions.includes(filesManager.getFile(selectedPath.value)?.extension?.toLowerCase()) || + imageExtensions.includes(filesManager.getFile(selectedPath.value)?.extension?.toLowerCase())) { mediaBlobUrl.value = await filesManager.getFileBlobUrl(selectedPath.value) as string; } }) @@ -204,7 +205,11 @@ function stepUp(path: string) { +