revert method

  1. @override
void revert(
  1. FluentDocument document
)
override

Revert this delta (undo). Replaces affected nodes with their pre-mutation state and restores the pre-mutation cursor.

Implementation

@override
void revert(FluentDocument document) {
  if (index < 0 || index > document.content.nodes.length) {
    print('[UNDO_WARN] NodeDeleteDelta.revert index $index out of bounds');
    return;
  }
  document.content.nodes.insert(index, _deserializeNode(deletedNodeJson));
  document.invalidateNodeIndex();
  oldCursor.restore(document);
}