From f8f157db5620b93b9e2e32a0413edd66d21009a1 Mon Sep 17 00:00:00 2001 From: yanle <421361608@qq.com> Date: Thu, 28 Mar 2024 22:18:41 +0800 Subject: [PATCH 1/2] feat: listener the up/down/enter keys in the spotlight search component --- ui/src/components/SpotlightSearch.tsx | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ui/src/components/SpotlightSearch.tsx b/ui/src/components/SpotlightSearch.tsx index 8fbc300..576723a 100644 --- a/ui/src/components/SpotlightSearch.tsx +++ b/ui/src/components/SpotlightSearch.tsx @@ -194,7 +194,19 @@ export default function SpotlightSearch() { }; const keydownListener = (event: KeyboardEvent) => { - keyRef.current.lastPressedKey = event.key.toUpperCase(); + const key = event.key.toUpperCase(); + keyRef.current.lastPressedKey = key; + switch (key) { + case "ARROWDOWN": + changeSelectIndex(1); + break; + case "ARROWUP": + changeSelectIndex(-1); + break; + case "ENTER": + onOpen(renderDataSourceRef.current[selectIndexRef.current]); + break; + } }; const shortcutTrigger = (event: CustomEvent) => { @@ -202,15 +214,6 @@ export default function SpotlightSearch() { case EShortcutKeys.openSpotlightSearch: changeSelectIndex(1); break; - case EOtherKeys.ArrowDown: - changeSelectIndex(1); - break; - case EOtherKeys.ArrowUp: - changeSelectIndex(-1); - break; - case EOtherKeys.Enter: - onOpen(renderDataSourceRef.current[selectIndexRef.current]); - break; } }; From e13ca7c116c14c9535e3ab6d4a4872d4eb7c080b Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Thu, 28 Mar 2024 22:24:07 +0800 Subject: [PATCH 2/2] fix carousel becoming smaller and disppears when more rows of gallery images --- .../components/GalleryCarouselImageViewer.tsx | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ui/src/gallery/components/GalleryCarouselImageViewer.tsx b/ui/src/gallery/components/GalleryCarouselImageViewer.tsx index c64ce5d..38ce9af 100644 --- a/ui/src/gallery/components/GalleryCarouselImageViewer.tsx +++ b/ui/src/gallery/components/GalleryCarouselImageViewer.tsx @@ -21,17 +21,18 @@ export function GalleryCarouselImageViewer({ mediaList }: MetaDataInfoProps) { flex={1} gap={2} > - ({ - id: v.id, - imageUrl: `/workspace/view_media?filename=${v.localPath}`, - }))} - currentNum={mediaList?.findIndex((p) => p.id === curMedia?.id) ?? 0} - setMediaAct={(newMedia) => - setCurMedia(mediaList?.find((v) => v.id === newMedia.id) ?? null) - } - /> - +
+ ({ + id: v.id, + imageUrl: `/workspace/view_media?filename=${v.localPath}`, + }))} + currentNum={mediaList?.findIndex((p) => p.id === curMedia?.id) ?? 0} + setMediaAct={(newMedia) => + setCurMedia(mediaList?.find((v) => v.id === newMedia.id) ?? null) + } + /> +
{mediaList?.map((media) => (