Skip to content

Conversation

@Palanikannan1437
Copy link
Member

Description

When a horizontal rule/divider is placed in the position under an empty leaf node (such as an image/table/etc), it was not being inserted after the node.

Detailed Description of Changes:

Preventing Horizontal Rule from Appearing Before a Node:

The key change is in the way the position for inserting a horizontal rule is calculated when there's only a cursor at the position, particularly when the cursor is at the beginning (parentOffset === 0) of a node. Previously, the position calculated for insertion subtracted 2 from $originTo.pos, which could lead to the rule appearing before the intended node. This has been corrected to subtract 1 instead, ensuring the rule is inserted at the correct location, directly where the cursor is, avoiding unintended placements before the node.

This adjustment ensures that the rule is inserted in a more expected location, especially in cases where the cursor is at the very start of a node.

Demo

Screen.Recording.2024-03-06.at.6.24.44.PM.mov
@sriramveeraghanta sriramveeraghanta merged commit cace132 into develop Mar 6, 2024
@sriramveeraghanta sriramveeraghanta deleted the fix/horizontal-rule branch March 6, 2024 13:13
JayashTripathy pushed a commit that referenced this pull request Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants