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:
parent
9a844b5ad3
commit
637fffd5aa
1 changed files with 8 additions and 1 deletions
|
@ -54,6 +54,13 @@ export function TaskDisplay({task}: {task: TaskWithId}) {
|
|||
</>
|
||||
}
|
||||
|
||||
const conditionalToggleDisplayingActions = useCallback(() => {
|
||||
if(window.getSelection()?.isCollapsed === false) {
|
||||
return
|
||||
}
|
||||
setDisplayingActions(prev => !prev)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn({
|
||||
|
@ -75,7 +82,7 @@ export function TaskDisplay({task}: {task: TaskWithId}) {
|
|||
[style.taskStatusInProgress]: task.status === "InProgress",
|
||||
[style.taskStatusComplete]: task.status === "Complete",
|
||||
})}
|
||||
onClick={() => setDisplayingActions(!isDisplayingActions)}
|
||||
onClick={conditionalToggleDisplayingActions}
|
||||
>
|
||||
{contents}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue