mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-06-01 17:32:07 +08:00

### What problem does this PR solve? feat: handle operator drag feat: add FlowCanvas #592 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
42 lines
982 B
TypeScript
42 lines
982 B
TypeScript
import { useCallback } from 'react';
|
|
import { Handle, NodeProps, Position } from 'reactflow';
|
|
|
|
import styles from './index.less';
|
|
|
|
const handleStyle = { left: 10 };
|
|
|
|
export function TextUpdaterNode({
|
|
data,
|
|
isConnectable = true,
|
|
}: NodeProps<{ value: number }>) {
|
|
const onChange = useCallback((evt) => {
|
|
console.log(evt.target.value);
|
|
}, []);
|
|
|
|
return (
|
|
<div className={styles.textUpdaterNode}>
|
|
<Handle
|
|
type="target"
|
|
position={Position.Top}
|
|
isConnectable={isConnectable}
|
|
/>
|
|
<Handle
|
|
type="source"
|
|
position={Position.Bottom}
|
|
// style={handleStyle}
|
|
isConnectable={isConnectable}
|
|
/>
|
|
<div>
|
|
<label htmlFor="text">Text:</label>
|
|
<input id="text" name="text" onChange={onChange} className="nodrag" />
|
|
</div>
|
|
{/* <Handle
|
|
type="source"
|
|
position={Position.Bottom}
|
|
id="b"
|
|
isConnectable={isConnectable}
|
|
/> */}
|
|
</div>
|
|
);
|
|
}
|