()
| 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. |
no test coverage detected