I’ve written a (now) very big and complex selection plugin that paints CSS onto the editor to make selections visible (I made the simple version OS on NPM https://www.npmjs.com/package/prosemirror-selection-leaf-plugin I’d add the more complex one but it’s reeeally bespoke to my build). To get this to work properly with <br /> I had to do some extra work. In the end, I settled on a node that is comprised as follows: <span class=“pm-br”><br /></span>
This is almost spot on, but the span causes some weird behaviour with the cursor sometimes. see the demo below:
I’m certain that this is a problem with content-editable rather than prose mirror. I’m just wondering if anyone has any ideas how I might get around it. I’ve tried all kinds of variations, including separating out the span as a mark and the break as a node (which led to some weird and unreliable UX), using a div instead of br (again, weird UX) and a whole load of other subtle schema variations. simply put, this is the best of a bad bunch (again, thank content-editable for the glitches, for sure)
I’d really like the issue patched so, please, suggestions are very welcome!
My next avenue of investigation would be some kind of plugin to move the cursor back to the start of the line in the above instance (I think the cursor is actually rendering on the wrong line as the user is technically positioned after the break tag of the previous line rather than before it). Is it possible to move the user’s cursor in a plugin?