balibabu commited on
Commit
916b3cc
·
1 Parent(s): 9cf0c51

feat: Support shortcut keys to delete nodes #3283 (#3284)

Browse files

### What problem does this PR solve?
feat: Support shortcut keys to delete nodes #3283

### Type of change


- [x] New Feature (non-breaking change which adds functionality)

web/src/pages/flow/canvas/index.tsx CHANGED
@@ -11,7 +11,6 @@ import { Operator } from '../constant';
11
  import FlowDrawer from '../flow-drawer';
12
  import {
13
  useHandleDrop,
14
- useHandleKeyUp,
15
  useSelectCanvasData,
16
  useShowDrawer,
17
  useValidateConnection,
@@ -87,7 +86,6 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
87
 
88
  const { onDrop, onDragOver, setReactFlowInstance } = useHandleDrop();
89
 
90
- const { handleKeyUp } = useHandleKeyUp();
91
  useWatchNodeFormDataChange();
92
 
93
  return (
@@ -127,7 +125,7 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
127
  onNodeClick={onNodeClick}
128
  onPaneClick={onPaneClick}
129
  onInit={setReactFlowInstance}
130
- onKeyUp={handleKeyUp}
131
  onSelectionChange={onSelectionChange}
132
  nodeOrigin={[0.5, 0]}
133
  isValidConnection={isValidConnection}
@@ -142,6 +140,7 @@ function FlowCanvas({ chatDrawerVisible, hideChatDrawer }: IProps) {
142
  stroke: 'rgb(202 197 245)',
143
  },
144
  }}
 
145
  >
146
  <Background />
147
  <Controls />
 
11
  import FlowDrawer from '../flow-drawer';
12
  import {
13
  useHandleDrop,
 
14
  useSelectCanvasData,
15
  useShowDrawer,
16
  useValidateConnection,
 
86
 
87
  const { onDrop, onDragOver, setReactFlowInstance } = useHandleDrop();
88
 
 
89
  useWatchNodeFormDataChange();
90
 
91
  return (
 
125
  onNodeClick={onNodeClick}
126
  onPaneClick={onPaneClick}
127
  onInit={setReactFlowInstance}
128
+ // onKeyUp={handleKeyUp}
129
  onSelectionChange={onSelectionChange}
130
  nodeOrigin={[0.5, 0]}
131
  isValidConnection={isValidConnection}
 
140
  stroke: 'rgb(202 197 245)',
141
  },
142
  }}
143
+ deleteKeyCode={['Delete', 'Backspace']}
144
  >
145
  <Background />
146
  <Controls />