From 318af2e1ff3f358d5d64bc149832c1309aa14277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:35:33 +0900 Subject: [PATCH] fix(frontend): follow-up of #17811 (#17814) --- .../frontend/src/composables/use-uploader.ts | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/packages/frontend/src/composables/use-uploader.ts b/packages/frontend/src/composables/use-uploader.ts index 58fe648874..dd4825d024 100644 --- a/packages/frontend/src/composables/use-uploader.ts +++ b/packages/frontend/src/composables/use-uploader.ts @@ -234,29 +234,35 @@ export function useUploader(options: { closed: () => dispose(), }); }, - }, { - text: i18n.ts.preview, - icon: 'ti ti-photo-search', - action: async () => { - const contents = items.value - .filter(item => item.file.type.startsWith('image/') || item.file.type.startsWith('video/')) - .map(item => ({ - id: item.id, - type: item.file.type.startsWith('video/') ? 'video' : 'image', - url: item.objectUrl, - thumbnail: item.thumbnail, - filename: getUploadName(item), - caption: item.caption ?? null, - })); + }); - const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkLightbox.vue').then(x => x.default), { - defaultIndex: contents.findIndex(x => x.id === item.id), - contents, - }, { - closed: () => dispose(), - }); - }, - }, { + if (item.file.type.startsWith('image/') || item.file.type.startsWith('video/')) { + menu.push({ + text: i18n.ts.preview, + icon: 'ti ti-photo-search', + action: async () => { + const contents = items.value + .filter(item => item.file.type.startsWith('image/') || item.file.type.startsWith('video/')) + .map(item => ({ + id: item.id, + type: item.file.type.startsWith('video/') ? 'video' : 'image', + url: item.objectUrl, + thumbnail: item.thumbnail, + filename: getUploadName(item), + caption: item.caption ?? null, + })); + + const { dispose } = await os.popupAsyncWithDialog(import('@/components/MkLightbox.vue').then(x => x.default), { + defaultIndex: contents.findIndex(x => x.id === item.id), + contents, + }, { + closed: () => dispose(), + }); + }, + }); + } + + menu.push({ type: 'divider', }); }