1
Fork 0
mirror of https://github.com/Steffo99/todocolors.git synced 2024-11-22 08:14:18 +00:00

Allow selection of text without flipping the card

This commit is contained in:
Steffo 2023-08-06 18:54:56 +02:00
parent 9a844b5ad3
commit 637fffd5aa
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -54,6 +54,13 @@ export function TaskDisplay({task}: {task: TaskWithId}) {
</> </>
} }
const conditionalToggleDisplayingActions = useCallback(() => {
if(window.getSelection()?.isCollapsed === false) {
return
}
setDisplayingActions(prev => !prev)
}, [])
return ( return (
<div <div
className={cn({ className={cn({
@ -75,7 +82,7 @@ export function TaskDisplay({task}: {task: TaskWithId}) {
[style.taskStatusInProgress]: task.status === "InProgress", [style.taskStatusInProgress]: task.status === "InProgress",
[style.taskStatusComplete]: task.status === "Complete", [style.taskStatusComplete]: task.status === "Complete",
})} })}
onClick={() => setDisplayingActions(!isDisplayingActions)} onClick={conditionalToggleDisplayingActions}
> >
{contents} {contents}
</div> </div>