Skip to content

Commit

Permalink
chore(core): improve remove
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Oct 6, 2021
1 parent b71f802 commit 8eeed0a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/core/src/models/Operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,10 @@ export class Operation {
for (let i = nodes.length - 1; i >= 0; i--) {
const node = nodes[i]
if (node.allowDelete()) {
const previousIndex = node.index - 1
const afterIndex = node.index + 1
const parent = node.parent
const previous = node.previous
const next = node.next
node.remove()
const previous = previousIndex > -1 && parent.children[previousIndex]
const after =
afterIndex < parent.children.length && parent.children[afterIndex]
this.selection.select(previous ? previous : after ? after : node.parent)
this.selection.select(previous ? previous : next ? next : node.parent)
this.hover.clear()
}
}
Expand Down

0 comments on commit 8eeed0a

Please sign in to comment.