import { getInstance } from '@flowdrop/flowdrop/editor';
const fd = getInstance();
// Start a transaction
fd.historyBindings.startTransaction(fd.workflow.current, 'Rearrange layout');
// Make multiple changes — none are recorded individually
fd.workflow.actions.updateNode('node-1', { position: { x: 100, y: 200 } });
fd.workflow.actions.updateNode('node-2', { position: { x: 300, y: 200 } });
fd.workflow.actions.updateNode('node-3', { position: { x: 500, y: 200 } });
// Commit — all changes become one undo step
fd.historyBindings.commitTransaction();
// Or cancel — all changes revert
// fd.historyBindings.cancelTransaction();