Looking at the example on decorations, I see that ranges are mapped in two places:
- When creating the
StateEffect
(usingmapPos
):const addUnderline = StateEffect.define<{from: number, to: number}>({ map: ({from, to}, change) => ({from: change.mapPos(from), to: change.mapPos(to)}) })
- When applying the
StateEffect
:update(underlines, tr) { underlines = underlines.map(tr.changes)`
This seems redundant – what am I missing? I (think) I understand why the second mapping occurs, but the first mapping seems unnecessary, since I assume dispatching this transactions will cause the second mapping to be performed.
Thanks!
Bryan