ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.56k stars 337 forks source link

Marks are not applied to content that comes after an excluded nested mark #907

Open ben-brott opened 5 years ago

ben-brott commented 5 years ago

Steps to reproduce

Reproduced on glitch

Investigation

It seems that the issue is happening because in prosemirror-model, top.activeMarks contains Mark1, but when Mark2 is being added to the set, since the marks exclude each other, Mark1 is being removed. When it is time to apply marks to more Mark1 content, top.activeMarks is empty.

Removing the exclude from the marks definition solves the removal problem, but then, there is no way (that I have found) to ensure the ordering of the nesting is preserved. What makes the above case work would not work if Mark2 was wrapping around Mark1. <mark2>Mark2 content<mark1>Mark1 content</mark1>more Mark2 content</mark2>

Affected platforms

NOT browser specific.

marijnh commented 5 years ago

This is indeed not great behavior. But on the other hand, in a document output by ProseMirror itself, mutually exclusive marks will never nest, so it's only going to show up for (somewhat strange) external input.

As such, I'd be happy with a patch that works around this, but fixing this is not a priority for me.