Skip to content

Commit

Permalink
fix: catch error of node not found while undo
Browse files Browse the repository at this point in the history
fix #274
  • Loading branch information
SSShooter committed Sep 7, 2024
1 parent 114422e commit 7535cb2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/plugin/operationHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ export default function (mei: MindElixirInstance) {
const h = history[currentIndex]
current = h.prev
mei.refresh(h.prev)
if (h.currentObject.type === 'node') mei.selectNode(findEle(h.currentObject.value))
else if (h.currentObject.type === 'nodes') mei.selectNodes(h.currentObject.value.map(id => findEle(id)))
currentIndex--
try {
if (h.currentObject.type === 'node') mei.selectNode(findEle(h.currentObject.value))
else if (h.currentObject.type === 'nodes') mei.selectNodes(h.currentObject.value.map(id => findEle(id)))
} catch (e) {
// undo add node cause node not found
} finally {
currentIndex--
}
// console.log('current', current)
}
}
Expand Down

0 comments on commit 7535cb2

Please sign in to comment.