Skip to content

invertOps

function invertOps(ops, before): TransactionOp[] | null;

Defined in: invert.ts:172

Sequentially invert a transaction’s ops. Walks forward capturing the pre-op state S_i before each ops[i], then folds invertOp(ops[i], S_i) in reverse order. The concatenated result, applied to the post-transaction state, reproduces the original before-state.

Returns null if any op is non-invertible — the caller should then fall back to a full snapshot restore.

ParameterType
opsTransactionOp[]
beforeEditorState

TransactionOp[] | null