Undo and redo are fundamental features for any application that involves editing. Lix provides simple undo()
and redo()
commands that are built on top of its robust history and restore capabilities.
This makes it easy to implement reliable undo/redo functionality in your application, allowing users to step backward and forward through their changes with confidence. You can even undo or redo multiple steps at once.
import { openLix } from "@lix-js/sdk";
// Basic undo operation
await undo({ lix });
console.log("Performed undo operation");
// Undo with a specific number of steps
await undo({ lix, steps: 3 });
console.log("Performed undo with 3 steps");
// Basic redo operation
await redo({ lix });
console.log("Performed redo operation");