Pressing backspace introducing odd ReplaceStep

I have the same issue: Transaction steps work very strange Unfortunately can’t figure out how to deal with this.

For example, there is a content Some text<span> some mark</span>. Where span is any custom Mark. Removing the “t” to the left of the space that comes first inside the span will call step containing the text inside the Mark, but without the Mark and insert it again. It turns out that this Mark simply disappears.

Comparing changes with

  let changes = ChangeSet.create(oldState.doc);
  changes = changes.addSteps(tr.doc, tr.mapping.maps, undefined);

gives only deleted “t” and does not have information about reinserted marked text.