From 637fffd5aabd5b0e5da9e16af8a97905d2b7709d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 6 Aug 2023 18:54:56 +0200 Subject: [PATCH] Allow selection of text without flipping the card --- todoblue/src/app/board/[board]/TaskDisplay.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/todoblue/src/app/board/[board]/TaskDisplay.tsx b/todoblue/src/app/board/[board]/TaskDisplay.tsx index 86443d0..af1184d 100644 --- a/todoblue/src/app/board/[board]/TaskDisplay.tsx +++ b/todoblue/src/app/board/[board]/TaskDisplay.tsx @@ -54,6 +54,13 @@ export function TaskDisplay({task}: {task: TaskWithId}) { } + const conditionalToggleDisplayingActions = useCallback(() => { + if(window.getSelection()?.isCollapsed === false) { + return + } + setDisplayingActions(prev => !prev) + }, []) + return (
setDisplayingActions(!isDisplayingActions)} + onClick={conditionalToggleDisplayingActions} > {contents}