Precise cursor placement and selection issues

I have a question about cursor placement at element boundaries in ProseMirror. When working with text like this: 0 '<strong>' 1 'a' 2 '</strong>' 3, it seems that my cursor can only be placed at positions 0 or 2, but not at positions 1 or 3. Is this the case?

This leads to two issues for me:

  1. I’d like to give my editor’s users more precise control over cursor placement. In contrast to typical editors, where adding content before or after the ‘strong’ tag makes it either non-strong or strong, respectively, I want users to be able to control this behavior more explicitly.
  2. When selecting an entire block element (e.g., all text within a blockquote) and dragging it, an empty block element is always left behind in the original position. This seems to be because the selection’s start always begins after the block element’s tag.

Yes. Marks do not produce separate cursor positions inside and outside them.

You can use the state’s stored marks to control whether newly inserted text is going to get a specific set of marks.

Correct. Except if you create a node selection, which can cover the entire block.

1 Like