Hello,
I have a use case where I’m maintaining two versions of a document that is being edited with CodeMirror. To do this, I have created a translation layer using ChangeSets. Generally this is working great, except when the specific translated text is deleted.
Let’s call the two versions of the document A and B. The user only interacts directly with A.
A starts off like this:
Hello
![[image.jpg]]
world
The translation layer is the ChangeSet named AToBChanges
which will transform the document into this:
Hello
![[changed]]
world
Now, if the user deletes the entire line containing the image, the resulting A document is like this:
Hello
world
and CodeMirror gives us the expected update.changes
reflecting that change.
In order to update document B, I am calling update.changes.map(AToBChanges)
, and expect that the result would be a ChangeSet that deletes ![[changed]]\n
, however the result is a ChangeSet which deletes ![[
and ]]\n
.
This is unexpected. Why is it removing only the characters which were not changed by AToBChanges
? Could you point me towards what I should be calling instead please?
Thank you!