This example demonstrates how to add undo and redo functionality to a flow-based diagram built with Foblex Flow. It uses @foblex/mutator, a lightweight state management utility for snapshots, history, and predictable state transitions.
Use this version when your editor already has enough state complexity that you want a dedicated history layer instead of ad hoc manual stacks.
[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
Before running this example, install the additional package:
update() call when they should be undone as a single step.This version is a better fit for editors that already have complex state and need a more disciplined history model.