refactor(nodes): don't delete nodes when user focuses input and presses modifier

This commit is contained in:
moklick
2023-09-26 15:48:40 +02:00
parent 306f56d7f2
commit 9865b9c2bf
2 changed files with 26 additions and 11 deletions
@@ -2,12 +2,14 @@ import { useEffect } from 'react';
import type { KeyCode } from '@xyflow/system';
import { useStoreApi } from '../hooks/useStore';
import useKeyPress from './useKeyPress';
import useKeyPress, { UseKeyPressOptions } from './useKeyPress';
import useReactFlow from './useReactFlow';
import { Edge, Node } from '../types';
const selected = (item: Node | Edge) => item.selected;
const deleteKeyOptions: UseKeyPressOptions = { actInsideInputWithModifier: false };
export default ({
deleteKeyCode,
multiSelectionKeyCode,
@@ -18,7 +20,7 @@ export default ({
const store = useStoreApi();
const { deleteElements } = useReactFlow();
const deleteKeyPressed = useKeyPress(deleteKeyCode);
const deleteKeyPressed = useKeyPress(deleteKeyCode, deleteKeyOptions);
const multiSelectionKeyPressed = useKeyPress(multiSelectionKeyCode);
useEffect(() => {