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
@@ -69,5 +69,5 @@ import ReactFlow from 'react-flow-renderer';
- `connectionLineComponent`: [custom connection line component](/example/src/CustomConnectionLine/index.js) - `connectionLineComponent`: [custom connection line component](/example/src/CustomConnectionLine/index.js)
### Keys ### Keys
- `deleteKeyCode`: default: `8` (delete) - `deleteKeyCode`: default: `8` (backspace)
- `selectionKeyCode`: default: `16` (shift) - `selectionKeyCode`: default: `16` (shift)
@@ -49,7 +49,7 @@ const elements = [
{ id: 'e2-3', source: '2', target: '3' }, { 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'; import Flow from './index';
@@ -86,16 +86,19 @@ export default () => {
const onConnect = (params) => setElements((els) => addEdge(params, els)); const onConnect = (params) => setElements((els) => addEdge(params, els));
return ( return (
<ReactFlow <div style={{ height: 300 }}>
elements={elements} <ReactFlow
onElementsRemove={onElementsRemove} elements={elements}
onConnect={onConnect} 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'; import Basic from './BasicFunctions';
Binary file not shown.

Before

Width:  |  Height:  |  Size: 420 KiB

After

Width:  |  Height:  |  Size: 361 KiB