Skip to content

Commit

Permalink
fix: remove node before hr if it’s an empty text block, fix #1665
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Sep 29, 2021
1 parent 9fc0ee9 commit 4151e2f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/extension-horizontal-rule/src/horizontal-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export const HorizontalRule = Node.create<HorizontalRuleOptions>({
return true
}

const posBefore = $anchor.before()
const from = $anchor.before()
const to = $anchor.start()

tr.deleteRange(posBefore, posBefore + 1)
tr.deleteRange(from, to)
tr.setSelection(TextSelection.create(tr.doc, from))

return true
})
Expand Down

0 comments on commit 4151e2f

Please sign in to comment.