From ffa9bee287c3b65eade42ed585f8b95f8e1f20af Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 25 Aug 2025 21:12:22 +0800 Subject: [PATCH] feat: add double-click functionality to open entry URLs in a new tab Implemented a new handleDoubleClick function in EntryItemWrapper to allow users to open entry URLs in a new tab when double-clicking on an entry item. This enhances user interaction and accessibility for navigating to external links. Signed-off-by: Innei --- .../entry-column/layouts/EntryItemWrapper.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx index 9ca779dc3..3714c722a 100644 --- a/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx +++ b/apps/desktop/layer/renderer/src/modules/entry-column/layouts/EntryItemWrapper.tsx @@ -121,6 +121,17 @@ export const EntryItemWrapper: FC< }) }, [entry?.id]) + const handleDoubleClick = useCallback( + (e: MouseEvent) => { + e.preventDefault() + e.stopPropagation() + if (!entry?.url) return + if (!entry?.id) return + window.open(entry?.url, "_blank", "noopener,noreferrer") + }, + [entry?.id, entry?.url], + ) + const handleClick = useCallback( (e: TouchEvent | MouseEvent) => { e.preventDefault() @@ -218,6 +229,7 @@ export const EntryItemWrapper: FC< itemClassName, )} onClick={handleClick} + onDoubleClick={handleDoubleClick} onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave} {...contextMenuProps}