Collab editor: selections that survive edits

Both panels edit the same live.doc text; only the selection layer differs. The Offset panel declares selections: 'offset': raw { start, end } numbers stamped on the presence roster. The CRDT panel declares selections: 'crdt' and binds the room to the document via room.bindDoc(doc), so a published range travels as a position anchor inside the CRDT. The selection rows under each panel are the proof: after an edit lands in front of a published range, the Offset panel's rows slide onto the wrong characters and say so, while the CRDT panel's rows stay glued to the original text. (Each panel is its own room, so a selection only shows up in the matching panel of the other tab.)

Editing as Wacky Mango

  1. Open this page in a second tab.
  2. Here, select a word in both textareas - each panel publishes its own range.
  3. In the other tab, type in front of that word: the Offset row drifts and flags the mismatch, the CRDT row stays glued.
0 chars syncing...

Offset selections (drift) selections: 'offset'

0 others in this room

Select text in the box above - or open a second tab and select there - and the range lands here as a row.

CRDT selections (glued) selections: 'crdt'

0 others in this room

Select text in the box above - or open a second tab and select there - and the range lands here as a row.