2
0

🐛 (graph) Make the text bubble selectable without moving group

This commit is contained in:
Baptiste Arnaud
2022-11-24 08:37:08 +01:00
parent 9d69470630
commit 0593d2ead8

View File

@@ -1,4 +1,9 @@
import { Flex, Stack, useOutsideClick } from '@chakra-ui/react' import {
Flex,
Stack,
useEventListener,
useOutsideClick,
} from '@chakra-ui/react'
import React, { useEffect, useRef, useState } from 'react' import React, { useEffect, useRef, useState } from 'react'
import { import {
Plate, Plate,
@@ -76,9 +81,13 @@ const TextBubbleEditorContent = ({
} }
} }
const handleMouseDown = (e: React.MouseEvent) => { useEventListener(
e.stopPropagation() 'pointerdown',
} (e) => {
e.stopPropagation()
},
textEditorRef.current
)
const handleVariableSelected = (variable?: Variable) => { const handleVariableSelected = (variable?: Variable) => {
setIsVariableDropdownOpen(false) setIsVariableDropdownOpen(false)
@@ -100,7 +109,6 @@ const TextBubbleEditorContent = ({
borderWidth="2px" borderWidth="2px"
borderColor="blue.400" borderColor="blue.400"
rounded="md" rounded="md"
onMouseDown={handleMouseDown}
pos="relative" pos="relative"
spacing={0} spacing={0}
cursor="text" cursor="text"