Commit 8f143277 by pangchong

fix: 修复 undo 和 redo 中选中节点快照不对称及重做定位问题

parent 9fabf5d5
......@@ -783,15 +783,15 @@ export const useEditorStore = defineStore('editor', {
undo() {
if (this.undoStack.length === 0 || !this.xmlTree) return
const previousSnapshot = this.undoStack.pop()!
const currentClone = JSON.parse(JSON.stringify(this.xmlTree))
const currentSnapshot = {
tree: currentClone,
selectedNodeId: previousSnapshot.selectedNodeId || this.selectedNodeId
selectedNodeId: this.selectedNodeId
}
this.redoStack.push(currentSnapshot)
const previousSnapshot = this.undoStack.pop()!
this.xmlTree = previousSnapshot.tree
this.rebuildNodeMap()
if (previousSnapshot.selectedNodeId && this.hasNode(previousSnapshot.selectedNodeId)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment