MCPcopy Create free account
hub / github.com/SplootCode/splootcode / undo

Method undo

packages/editor/src/context/undoWatcher.ts:35–50  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33 }
34
35 undo() {
36 // No undo snapshots to use.
37 if (this.undoSnapshots.length == 0) {
38 return
39 }
40 // Remove current snapshot
41 const newSnapshot = this.undoSnapshots.shift()
42 // Put current snapshot on the redo stack
43 this.redoSnapshots.unshift(this.currentSnapshot)
44 this.currentSnapshot = newSnapshot
45
46 // Disable undo shapshotting (but not other mutation firing) and recursively apply the snapshot as edits.
47 this.enabled = false
48 this.rootNode.applySerializedSnapshot(this.currentSnapshot)
49 this.enabled = true
50 }
51
52 redo() {
53 // No redo snapshots to use.

Callers 1

EditorClass · 0.80

Calls 1

Tested by

no test coverage detected