Skip to content

API reference / Common / PortableCommand

Type Alias: PortableCommand ​

ts
type PortableCommand = 
  | {
  insertPage: {
     index: number;
  };
}
  | {
  deletePage: {
     index: number;
  };
}
  | {
  reorderPage: {
     from: number;
     to: number;
  };
}
  | {
  rotatePage: {
     index: number;
     clockwise: boolean;
  };
}
  | {
  resizePage: {
     index: number;
     size: Size;
  };
}
  | {
  editObject: {
     page: PageId;
     command: ObjectCommand;
  };
}
  | {
  editAnnotation: {
     page: PageId;
     command: AnnotationCommand;
  };
}
  | {
  addStandardFont: {
     id: FontId;
     font: StandardFont;
  };
}
  | {
  fillAcroFormFields: {
     fields: AcroFormFieldFill[];
  };
}
  | {
  updateAcroFormFields: {
     fields: AcroFormField[];
  };
};

An edit intent for a portable document. The editor turns a command into a CRDT modification; it never touches the model directly.

Serialize/Deserialize make the command a stable wire form — externally tagged by variant name ({"insertPage":{"index":1}}) — so a host can issue an edit as JSON through UDocSession::execute, and the same shape can be logged or replayed. Page ops address by index (they are about position); object/content ops address by id (a stable name).