Skip to content

Commit 4fd17c5

Browse files
committed
prevent stack no more undo/redo alert
1 parent fe1d4c8 commit 4fd17c5

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/ide/windows.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class ProjectWindows {
2121
lasterrors: WorkerError[];
2222
undofiles: string[];
2323
redofiles: string[];
24+
alerting: boolean;
2425

2526
constructor(containerdiv: HTMLElement, project: CodeProject) {
2627
this.containerdiv = containerdiv;
@@ -145,7 +146,7 @@ export class ProjectWindows {
145146
this.redofiles.push(fileid);
146147
this.refresh(false);
147148
} else {
148-
bootbox.alert("No more steps to undo.");
149+
this.showAlert("No more steps to undo.");
149150
}
150151
}
151152

@@ -157,10 +158,16 @@ export class ProjectWindows {
157158
this.undofiles.push(fileid);
158159
this.refresh(false);
159160
} else {
160-
bootbox.alert("No more steps to redo.");
161+
this.showAlert("No more steps to redo.");
161162
}
162163
}
163164

165+
showAlert(msg: string) {
166+
if (this.alerting) return;
167+
this.alerting = true;
168+
bootbox.alert(msg, () => { this.alerting = false; });
169+
}
170+
164171
updateAllOpenWindows(store) {
165172
for (var fileid in this.id2window) {
166173
var wnd = this.id2window[fileid];

0 commit comments

Comments
 (0)