Trying to understand a weird behavior with replace decorations. I have a document with a selection that spans multiple lines; edits to the document cause any content hidden a replace decoration to get lost.
Starting content:
Some text
next line [replace decoration] more text
If I select the whitespace (including the newline) from text
all the way to next
, then press Space, for example:
After:
Some text next line more text
Any keyboard input causes the content under the replace decoration to be entirely removed from the document.
The issue only seems to exist if the selection contains a newline and replace decorations appear anywhere on the last selected line.
Tracing the code and it looks like codemirror is resolving the document state with a mutation observer and trying to diff the new text in the document with the old state. But the DOMChange
doesn’t seem to see any content hidden by Decorations.