Mark vs inline decoration mapping

I noticed an inconsistency between how marks and inline decorations are updated in response to document changes. If I have a mark with inclusive: false and an inline decoration both with the same start and end positions, and I select that whole range, then type something, the text I typed is not marked, but it’s decorated.

I’ve setup a demo that illustrates this: ProseMirror mapping: decorations vs marks

mark-deco-inconsistent

Is this a bug or is it intended behavior? I’m using Chrome on Windows.

You explicitly set inclusive: false on the mark and inclusiveEnd: true on the decoration, right? And you’re expecting them to both be non-inclusive?

For the mark with inclusive: true, the decoration spec is { inclusiveEnd: true }. But for the mark with inclusive: false, the decoration spec is {}. I’m expecting the latter decoration to be non-inclusive.

Ah, that’s the part you meant. Indeed, due to the way mapping works for replacements (keeping the position at the same side of the replacement), replacements will preserve non-inclusive decorations. This is intended behavior.

1 Like

Thanks for confirming, and for a great library!