From 4f6830fdd6158eb992315d7081547fd9a8736a87 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Fri, 10 Jul 2026 21:15:08 +0900 Subject: [PATCH] Update MkMediaList.vue --- packages/frontend/src/components/MkMediaList.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkMediaList.vue b/packages/frontend/src/components/MkMediaList.vue index 06ae1a0d48..2e497e97de 100644 --- a/packages/frontend/src/components/MkMediaList.vue +++ b/packages/frontend/src/components/MkMediaList.vue @@ -95,7 +95,12 @@ const previewable = (file: Misskey.entities.DriveFile): boolean => { return (file.type.startsWith('video') || file.type.startsWith('image')) && FILE_TYPE_BROWSERSAFE.includes(file.type); }; -async function openGallery(id: string) { +async function openGallery(id?: string) { + if (id == null) { + const firstImage = props.mediaList.find(media => previewable(media)); + if (firstImage == null) return; + id = firstImage.id; + } const getElementByMarker = (marker: string) => { if (gallery.value == null) return null; const found = gallery.value.querySelector(`[data-marker="${marker}"]`) as HTMLElement | null;