Skip to content

Commit a84cd4a

Browse files
committed
🐛 fix #9178
1 parent a0d51e8 commit a84cd4a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/src/protyle/undo/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ export class Undo {
6868
}
6969

7070
public replace(doOperations: IOperation[]) {
71+
// undo 引发 replace 导致 stack 错误 https://github.com/siyuan-note/siyuan/issues/9178
72+
if (this.hasUndo && this.redoStack.length > 0) {
73+
this.undoStack.push(this.redoStack.pop())
74+
this.redoStack = [];
75+
this.hasUndo = false;
76+
}
7177
if (this.undoStack.length > 0) {
7278
this.undoStack[this.undoStack.length - 1].doOperations = doOperations;
7379
}

0 commit comments

Comments
 (0)