Skip to content

feat: flow copy/paste with undo/redo support#40

Merged
moosebay merged 5 commits intomainfrom
feat/new-feature
Mar 4, 2026
Merged

feat: flow copy/paste with undo/redo support#40
moosebay merged 5 commits intomainfrom
feat/new-feature

Conversation

@moosebay
Copy link
Copy Markdown
Contributor

@moosebay moosebay commented Mar 4, 2026

Summary

  • Copy/paste flow nodes (Cmd+C / Cmd+V) with full type-specific data preservation via YAML serialization, position offsets, variable remapping, and edge reconstruction between copied nodes
  • Undo/redo (Cmd+Z / Cmd+Shift+Z / Cmd+Y) for canvas operations: position drag, node delete, edge delete, edge create, and paste
  • Smart paste positioning: same-flow paste offsets 200px below selection, cross-flow paste centers in viewport
  • Extract useFlowSelection hook for centralized selection management (also used in agent panel)
  • Remove OpenReplay integration
  • Bump @xyflow/react to 12.10.1 (fixes drag/selection bugs)

New server RPCs

  • FlowNodesCopy — serializes selected nodes to YAML (including HTTP config, JS code, conditions, AI settings)
  • FlowNodesPaste — deserializes YAML back into new nodes with fresh IDs, variable remapping, and edge reconstruction

Test plan

  • Server copy/paste tests (rflowv2_copy_paste_test.go)
  • Copy nodes → paste in same flow → nodes appear 200px below with correct data
  • Copy nodes → paste in different flow → nodes appear at viewport center
  • Drag node → Cmd+Z → returns to original position → Cmd+Shift+Z → goes back
  • Delete node → Cmd+Z → node reappears with correct type-specific data
  • Delete edge → Cmd+Z → edge reappears
  • Create edge → Cmd+Z → edge removed
  • Paste nodes → Cmd+Z → pasted nodes removed
  • Multi-node drag → single Cmd+Z reverts all
  • Typing in input/textarea → Cmd+Z does browser undo, not canvas undo

moosebay added 5 commits March 4, 2026 23:05
- Add FlowNodesCopy/FlowNodesPaste RPCs with YAML serialization,
  position preservation, variable remapping, and edge reconstruction
- Add client-side undo/redo stack (Cmd+Z / Cmd+Shift+Z) supporting
  position drag, node delete, edge delete, edge create, and paste
- Extract useFlowSelection hook for centralized selection management
- Smart paste positioning: same flow offsets 200px, cross-flow centers
  in viewport
- Remove OpenReplay, bump @xyflow/react to 12.10.1
@moosebay moosebay merged commit 51534e0 into main Mar 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant