chore(examples): second input for useNodesData
This commit is contained in:
@@ -14,8 +14,16 @@ function TextNode({ id, data }: NodeProps) {
|
|||||||
return (
|
return (
|
||||||
<div style={{ background: '#eee', color: '#222', padding: 10, fontSize: 12, borderRadius: 10 }}>
|
<div style={{ background: '#eee', color: '#222', padding: 10, fontSize: 12, borderRadius: 10 }}>
|
||||||
<div>node {id}</div>
|
<div>node {id}</div>
|
||||||
<div>
|
<div style={{ marginTop: 5 }}>
|
||||||
<input onChange={(evt) => updateText(evt.target.value)} value={text} />
|
<label style={{ fontSize: 12 }}>useState + updateNodeData</label>
|
||||||
|
<input onChange={(evt) => updateText(evt.target.value)} value={text} style={{ display: 'block' }} />
|
||||||
|
|
||||||
|
<label style={{ fontSize: 12 }}>updateNodeData</label>
|
||||||
|
<input
|
||||||
|
onChange={(evt) => updateNodeData(id, { text: evt.target.value })}
|
||||||
|
value={data.text}
|
||||||
|
style={{ display: 'block' }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Handle type="source" position={Position.Right} />
|
<Handle type="source" position={Position.Right} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,16 +3,7 @@ import { getElementsToRemove, getOverlappingArea, isRectObject, nodeToRect, type
|
|||||||
|
|
||||||
import useViewportHelper from './useViewportHelper';
|
import useViewportHelper from './useViewportHelper';
|
||||||
import { useStoreApi } from './useStore';
|
import { useStoreApi } from './useStore';
|
||||||
import type {
|
import type { ReactFlowInstance, Instance, Node, Edge } from '../types';
|
||||||
ReactFlowInstance,
|
|
||||||
Instance,
|
|
||||||
NodeAddChange,
|
|
||||||
EdgeAddChange,
|
|
||||||
Node,
|
|
||||||
Edge,
|
|
||||||
NodeChange,
|
|
||||||
EdgeChange,
|
|
||||||
} from '../types';
|
|
||||||
import { getElementsDiffChanges, isNode } from '../utils';
|
import { getElementsDiffChanges, isNode } from '../utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user