2
0

fix(editor): ️ Improve block focus

This commit is contained in:
Baptiste Arnaud
2022-03-29 10:23:45 +02:00
parent 1f992c6779
commit 261cd9a5c7
4 changed files with 22 additions and 3 deletions

View File

@ -73,6 +73,8 @@ const graphContext = createContext<{
openedStepId?: string
setOpenedStepId: Dispatch<SetStateAction<string | undefined>>
isReadOnly: boolean
focusedBlockId?: string
setFocusedBlockId: Dispatch<SetStateAction<string | undefined>>
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({
@ -98,6 +100,8 @@ export const GraphProvider = ({
const [blocksCoordinates, setBlocksCoordinates] = useState<BlocksCoordinates>(
{}
)
const [focusedBlockId, setFocusedBlockId] = useState<string>()
useEffect(() => {
setBlocksCoordinates(
blocks.reduce(
@ -149,6 +153,8 @@ export const GraphProvider = ({
blocksCoordinates,
updateBlockCoordinates,
isReadOnly,
focusedBlockId,
setFocusedBlockId,
}}
>
{children}