[Summary: there’s a pre-release of prosemirror-view available for a somewhat invasive but hopefully helpful change, and I’d feel better if some people could help test it before I release it.]
So, traditionally, when the cursor is in a position where the DOM inline styles of the thing before it don’t correspond to the current marks (because there’s stored marks or a non-inclusive mark before), ProseMirror would create a
<span> element with a zero-width space inside of it, wrap that in the appropriate style nodes, and put the selection inside of it. (The hidden character was necessary for this to actually work—without it typed text would still receive the style of the surrounding DOM in Webkit/Chrome.)
This meant that A) ProseMirror would have to mess with the selection and DOM at unpredictable times, confusing browsers, and B) that the zero-width space inserted in the wrapper would easily end up in places where it shouldn’t be, and caused a bunch of issues (1, 2, 3, 4, 5, 6, etc).
The main reason we want DOM updates to happen inside the right marks is that, previous to prosemirror-view 1.9.0, there was a delay between the DOM change and the ProseMirror update, so you’d see the unmarked text you typed briefly and then it would snap to the proper, marked form. But since 1.9.0, DOM reading is synchronous, so that delay no longer occurs.
Only composition input does have a similar problem—there we can’t touch the DOM nodes around the cursor until the composition is finished. So that’s bad—you see the text styled in the wrong way as long as you are composing, if there is no cursor wrapper.
The experimental (and, on second thought, poorly named) no-cursor-wrapper branch removes the eager cursor wrapping, and replaces with a last-second on-demand approach that does the wrapping on the
compositionstart event. This should greatly help avoiding cursor-wrapper related bugs, while still neatly hiding visual issues caused by the browser not understanding our mark model.
Still, since this was a hack that could influence editing in all kinds of ways, and contenteditable behavior can be extremely unpredictable, I’d like to see some more serious testing happen before I release this change as a regular version. The new code is available as prosemirror-view version 1.9.14-prerelease3. If you have an automatic browser test routine, or are willing to run through some tests scripts, I’d very much appreciate if you could give it a spin and let me know if you run into any issues. (Or if everything works, I’d still like to know.) Thanks!