Skip to content

API reference / Common / UDocSelection

Type Alias: UDocSelection ​

ts
type UDocSelection = 
  | {
  image: ImageSelection;
}
  | {
  portable: PortableSelection;
}
  | {
  presentation: PresentationSelection;
}
  | {
  spreadsheet: SpreadsheetSelection;
}
  | {
  wordprocessing: WordprocessingSelection;
};

Top-level selection for a loaded document — a format-agnostic enum over the per-doc-type selections, mirroring [UDocCommand]. Presence state beside the document: setting it is not a command and not undoable (see Editor::set_selection).

Serialize/Deserialize make it the host-facing wire form, externally tagged by doc type like [UDocCommand] — e.g. {"portable":{"objects":["7-0","7-1"]}}, or {"portable":"none"} for the empty selection. A host hands this JSON to UDocSession::set_selection and reads it back from UDocSession::selection, so the agnostic seam replaces per-doc-type select verbs.