This example demonstrates how to add undo and redo functionality to a flow-based diagram built with Foblex Flow. Undo/redo gives users the ability to revert recent changes or reapply reverted actions, creating a smoother and more interactive editing experience.
The implementation is based on @foblex/mutator, a lightweight state management utility that tracks state changes, snapshots, and history. With it, you can maintain a stack of operations and easily implement time-travel behavior inside your editor.
Before running this example, install the additional package:
[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/undo-redo-v2/undo-redo-v2.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/undo-redo-v2/undo-redo-v2.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/undo-redo-v2/undo-redo-v2.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss