fix(core): track modifier keys on useKey press

This commit is contained in:
Daniel Leal
2023-03-03 11:46:50 +00:00
parent afa38727fa
commit 5293fd74be
4 changed files with 32 additions and 6 deletions
@@ -38,6 +38,9 @@ const BasicFlow = () => {
onSelectionContextMenu={onPaneContextMenu}
>
<Background variant={BackgroundVariant.Cross} />
<div style={{ position: 'absolute', right: 10, top: 10, zIndex: 4 }}>
<input type={'text'} placeholder={'name'} />
</div>
</ReactFlow>
);
};
@@ -18,6 +18,20 @@ const initialNodes: Node[] = [
data: { label: 'Node 1' },
position: { x: 250, y: 5 },
},
{
id: '2',
type: 'default',
data: { label: 'Node 2' },
position: { x: 250, y: 100 },
},
];
const initialEdges: Edge[] = [
{
id: 'e1-2',
source: '1',
target: '2',
},
];
const SelectionLogger = () => {
@@ -34,7 +48,7 @@ const SelectionLogger = () => {
const Flow = () => {
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
const onConnect = useCallback((params: Edge | Connection) => setEdges((els) => addEdge(params, els)), [setEdges]);
return (
@@ -52,6 +66,9 @@ const WrappedFlow = () => (
<ReactFlowProvider>
<Flow />
<SelectionLogger />
<div style={{ position: 'absolute', right: 10, top: 10, zIndex: 4 }}>
<input type={'text'} placeholder={'name'} />
</div>
</ReactFlowProvider>
);