refactor(nodes): don't delete nodes when user focuses input and presses modifier
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user