MoveBlocks Op
The operation that places a contiguous run of blocks under a parent after a reference position, using RGA op ids so concurrent moves converge and the latest move of a block wins.

Extends · closed

type
Operation tag, always `MoveBlocks`.
MoveBlocks
parent
Id of the block the run goes under; empty means the document root.
optional
blocks
Ids of the sibling blocks to place, in order.
of
ref
Op id to insert after: `[ts, idx, actor]`, or `[idx]` for an earlier op in this Change; empty means the start.
of optional

MoveBlocks gives blocks their place in the tree. A Change that creates a paragraph uses ReplaceBlock for its content and MoveBlocks to say where it goes. A Change that reorders a list or indents a block uses MoveBlocks alone.

This page defines the change/op/move-blocks operation inside a Change body. Its formal schema is attached as the schemaDefinition in this document's metadata, so the app can show it.

parent is the id of the block the run goes under; empty means the document root. blocks is a contiguous run of sibling ids in order. ref is the position to insert after. Empty means the start of the parent's list. [ts, idx, actor] names the op that placed the block to the left. A single [idx] names an earlier op of this same Change, which is how one op points at a position another op in the same Change created. Inside one op, each block after the first is placed after the block before it, with no ref of its own. Each parent's children form a replicated growable array (RGA): concurrent inserts at the same ref are ordered by op id with the newer op nearer the ref, so every node ends with the same order. When a block has several moves in its history the latest by op id wins and earlier positions become invisible. A move that would make a block its own ancestor is ignored. Inside one op the counter advances by the element index (the second block gets idx + 1, the third idx + 2 more, and so on), a quirk that is now part of the wire format. See Documents.

See also

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime