undo & redo for file info

This commit is contained in:
codetypes committed 2025-03-18 22:53:31 +08:00
1 parent 4d1d09fe80
commit d9dbf15d30
5 files changed
+45 -16

No files matched your search

+11 -2
View File
@@ -58,7 +58,7 @@ export class EditorStore {
alertReload: boolean = false;
searchingText?: string;
historyStack: NodeModel[] = [];
historyStack: string[] = [];
historyIndex: number = 0;
selectedId?: string | null;
@@ -79,7 +79,16 @@ export class EditorStore {
this.import = this.data.import.map((v) => ({ path: v, vars: [] }));
this.declvar = this.data.declvar.map((v) => ({ ...v }));
this.autoId = b3util.refreshTreeDataId(this.root, this.data.firstid);
this.historyStack.push(b3util.createNode(this.root));
this.historyStack.push(
JSON.stringify(
{
...this.data,
root: b3util.createNode(this.root),
},
null,
2
)
);
this.historyIndex = 0;
}
}