How do I position the cursor to the start and end of the block rendered by nodeView

Like the cursor in the red area below, you can locate the node to the beginning position

@marijn can you give me some advice, I have no idea how to insert the cursor into the start and end position of the node