Skip to content

API reference / Common / Engine types / TableCommand

Type Alias: TableCommand ​

ts
type TableCommand = 
  | {
  setTableProperties: {
     properties: TableProperties;
  };
}
  | {
  insertRows: {
     index: number;
     rows: TableRegularRow[];
  };
}
  | {
  deleteRows: {
     rows: TableRowId[];
  };
}
  | {
  setRowProperties: {
     rows: TableRowId[];
     properties: TableRowProperties;
  };
}
  | {
  insertColumns: {
     index: number;
     columns: TableColumn[];
     cells: TableRegularCell[][];
  };
}
  | {
  deleteColumns: {
     columns: TableColumnId[];
  };
}
  | {
  setColumnWidth: {
     column: TableColumnId;
     width: number;
  };
}
  | {
  mergeCells: {
     anchor: TableCellRef;
     focus: TableCellRef;
  };
}
  | {
  unmergeCells: {
     anchor: TableCellRef;
     focus: TableCellRef;
  };
}
  | {
  setCellProperties: {
     cells: TableCellRef[];
     properties: TableCellProperties;
  };
}
  | {
  setCellBodyProperties: {
     cells: TableCellRef[];
     properties: TextBodyProperties;
     listStyle: TextListStyle | null;
  };
}
  | {
  editCellText: {
     cell: TableCellRef;
     command: TextCommand;
  };
}
  | {
  pasteCells: {
     anchor: TableCellRef;
     fragment: TableFragment;
  };
};

An edit intent for a table. The embedding doc type's editor turns one into container writes (via execute); it never touches the model directly.

Serialize/Deserialize make a command a stable wire form — externally tagged by variant name — so a host can issue an edit as JSON, the same seam [TextCommand] offers.