addMark inside handleTextInput effectively closes history?

Is this expected? I’m not quite sure why it would happen.

With the irrelevant portions of our code left out, it looks like this. Is there any way we can avoid this besides having to move to appendTransaction? And would that even work to avoid this? I’m not sure why it occurs in the first place and I’d like to understand before taking a stab at fixing it again.

handleTextInput(view, from, to, text) {
  // ... setup code
  tr.insertText(text, from, to);
  tr.addMark(
    posBeforeLink,
    from + text.length,
    linkMarkType.create(newAttrs)
  );
  // @TODO -- Our approach causes a closeHistory-like behavior where all updates trigger a new history checkpoint.
  dispatch(tr);
}

That wasn’t intentional. This patch should help.

1 Like

Thank you so much @marijn! Your work is really something and I’m so thankful for it!