Skip to content

Commit

Permalink
fix(horizontal-rule): fix insertion being broken on empty docs (#4375)
Browse files Browse the repository at this point in the history
* fix(horizontal-rule): fix insertion being broken on empty docs
* add back text selection offset
  • Loading branch information
bdbch committed Aug 23, 2023
1 parent 028411e commit 2a83166
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/extension-horizontal-rule/src/horizontal-rule.ts
Expand Up @@ -44,7 +44,7 @@ export const HorizontalRule = Node.create<HorizontalRuleOptions>({
const currentChain = chain()

if ($originTo.parentOffset === 0) {
currentChain.insertContentAt($originTo.pos - 2, { type: this.name })
currentChain.insertContentAt(Math.max($originTo.pos - 2, 0), { type: this.name })
} else {
currentChain.insertContent({ type: this.name })
}
Expand Down

0 comments on commit 2a83166

Please sign in to comment.