Merge branch 'main' of github.com:wbkd/react-flow into main

This commit is contained in:
Christopher Möller
2020-10-06 17:12:44 +02:00
3 changed files with 11 additions and 8 deletions

View File

@@ -69,5 +69,5 @@ import ReactFlow from 'react-flow-renderer';
- `connectionLineComponent`: [custom connection line component](/example/src/CustomConnectionLine/index.js)
### Keys
- `deleteKeyCode`: default: `8` (delete)
- `deleteKeyCode`: default: `8` (backspace)
- `selectionKeyCode`: default: `16` (shift)

View File

@@ -49,7 +49,7 @@ const elements = [
{ id: 'e2-3', source: '2', target: '3' },
];
export default () => <ReactFlow elements={elements} />;
export default () => <div style={{ height: 300 }}><ReactFlow elements={elements} /></div>;
```
import Flow from './index';
@@ -86,16 +86,19 @@ export default () => {
const onConnect = (params) => setElements((els) => addEdge(params, els));
return (
<ReactFlow
elements={elements}
onElementsRemove={onElementsRemove}
onConnect={onConnect}
/>
<div style={{ height: 300 }}>
<ReactFlow
elements={elements}
onElementsRemove={onElementsRemove}
onConnect={onConnect}
deleteKeyCode={46} /* 'delete'-key */
/>
</div>
);
}
```
In this example you can connect nodes and remove selected nodes and edges with the delete key.
In this example you can connect nodes and remove selected nodes and edges with the backspace key.
import Basic from './BasicFunctions';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

After

Width:  |  Height:  |  Size: 361 KiB