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 <tukon479@gmail.com>
This commit is contained in:
@@ -121,6 +121,17 @@ export const EntryItemWrapper: FC<
|
||||
})
|
||||
}, [entry?.id])
|
||||
|
||||
const handleDoubleClick = useCallback(
|
||||
(e: MouseEvent<HTMLElement>) => {
|
||||
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<HTMLElement> | MouseEvent<HTMLElement>) => {
|
||||
e.preventDefault()
|
||||
@@ -218,6 +229,7 @@ export const EntryItemWrapper: FC<
|
||||
itemClassName,
|
||||
)}
|
||||
onClick={handleClick}
|
||||
onDoubleClick={handleDoubleClick}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...contextMenuProps}
|
||||
|
||||
Reference in New Issue
Block a user