> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Types: editor: Editor

## `AddedCommand`

Command families kept in their own files, joined here to spare `types.ts` a line each.

Not exported by name. You get it from the API.

```ts theme={null}
type AddedCommand = DrawBordersCommand | WorkbookLookCommand | ChartSheetCommand | MoveChartCommand | PivotCalcItemCommand
```

## `CellWindow`

The window Shift+F2 or Ctrl+K opens over the active cell, with what the cell holds now.

Import from `@reductoai/xlsx-editor`.

```ts theme={null}
type CellWindow = { editing: boolean; kind: "note"; text: string } | { kind: "comment"; thread: CommentThread | null } | { address: string; kind: "link"; linked: boolean; text: string; tip: string } | { address: string; headers: boolean; kind: "table" } | { kind: "format"; start: CellFormat } | { kind: "find"; replace: boolean } | { guess: SortGuess; kind: "sort" } | { kind: "pasteSpecial" } | { [K in CellSizeKind]: { kind: K; value: string } }[CellSizeKind] | { kind: "goToSpecial" } | { kind: "goTo" } | { kind: "series"; start: Pick<FillSeries, "by" | "type"> } | { kind: "fillAcross" } | { kind: "newCellStyle" } | { kind: "mergeStyles" } | { kind: "copyPicture" } | { kind: "names" } | { editing: boolean; kind: "pasteName" } | { edit: NameRow | null; fromManager: boolean; kind: "defineName"; refersTo: string } | { kind: "createNames"; start: CreateNamesFrom } | { kind: "group"; ungroup: boolean } | { dialog: RuleDialog; guess: CfGuess; kind: "rule" } | { kind: "cfRules"; scope: CfScope } | { guess: SubtotalGuess; kind: "subtotal" } | { kind: "goalSeek" } | { kind: "protect"; target: "sheet" | "workbook"; unprotect: boolean } | { edit?: SparkGroupState; kind: "sparklines"; type: SparkKind } | { group: SparkGroupState; kind: "sparkSettings"; mode: SparkSettingsMode } | { kind: "selectData"; target: ChartTarget } | { kind: "moveChart"; target: ChartTarget } | { kind: "scenarios" } | { kind: "advancedFilter" } | { kind: "consolidate" } | { guess: RemoveDuplicatesGuess; kind: "removeDuplicates" } | { kind: "pageSetup"; tab?: "Page" | "Margins" | "Header/Footer" | "Sheet" } | { kind: "dataTable" } | { kind: "textColumns"; rows: string[] } | { kind: "slicerSettings"; settings: SlicerSettings } | { kind: "slicerConnections"; name: string; rows: SlicerConnection[] } | { kind: "valueField"; settings: ValueFieldSettings } | { kind: "axisField"; settings: AxisFieldSettings } | { kind: "pivotGroup"; settings: PivotGroupingSettings } | { kind: "pivotSource"; settings: PivotSourceSettings } | { kind: "pivotMove"; settings: PivotMoveSettings } | { kind: "pivotOptions"; settings: PivotOptionsSettings } | { kind: "pivotCalcField"; settings: PivotCalcFieldSettings } | { kind: "pivotCalcItem"; settings: PivotCalcItemSettings } | { kind: "pivotSolveOrder"; settings: PivotSolveOrderSettings } | { edit: CfRuleRow | null; kind: "cfRule"; scope: CfScope | null } | { kind: "validation"; spec: ValidationSpec } | { call: FunctionCall | null; kind: "function" }
```

## `CellWindowKind`

Format Cells, Insert Hyperlink, a note, a comment, Create Table, Sort and the cell size dialogs.

Import from `@reductoai/xlsx/editor`.

```ts theme={null}
type CellWindowKind = "rowHeight" | "columnWidth" | "standardWidth" | "renameSheet" | "valueField" | "axisField" | "pivotGroup" | "pivotSource" | "pivotMove" | "pivotOptions" | "pivotCalcField" | "pivotCalcItem" | "pivotSolveOrder" | "format" | "link" | "note" | "comment" | "table" | "sort" | "pasteSpecial"
```

## `EditorSelection`

The selected block of one sheet and the active cell in it; `areas` lists every area, this block last, when Ctrl+click selected several.

Import from `@reductoai/xlsx/editor`.

```ts theme={null}
type EditorSelection = CellBlock & { active: CellAt; areas?: CellArea[]; sheets?: number[] }
```

## `EditorSlot`

Fills a region the editor reserves; returns the cleanup to run when the region unmounts.

Import from `@reductoai/xlsx-editor`.

```ts theme={null}
type EditorSlot = (host: HTMLElement, model: XlsxEditorModel) => (() => void) | void
```

## `Freeze`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `leftCol` | `number` | |
| `topRow` | `number` | |

## `FreezeHow`

Import from `@reductoai/xlsx/editor`.

```ts theme={null}
type FreezeHow = "panes" | "topRow" | "firstColumn" | "unfreeze"
```

## `Frozen`

The rows and columns frozen at the sheet's top left; zero for none.

Import from `@reductoai/xlsx/editor`.

| Name | Type | Description |
| - | - | - |
| `cols` | `number` | |
| `rows` | `number` | |

## `GridMenuTarget`

Where a right-click landed: on cells, on row or column headers, or on a sheet tab.

Import from `@reductoai/xlsx/view`.

```ts theme={null}
type GridMenuTarget = { kind: "cells" } | { kind: "rows" } | { kind: "cols" } | { kind: "tab"; sheet: number } | { kind: "chartTab"; name: string }
```

## `Keybinding`

Import from `@reductoai/xlsx-editor`.

| Name | Type | Description |
| - | - | - |
| `args?` | `unknown` | |
| `command` | `string` | "-format.bold" removes the earlier bindings of that command (of `key` only, when given). |
| `hidden?` | `boolean` | Works, but is not shown or offered as the command's key. |
| `key?` | `string` | "mod+shift+k"; a chord is two presses: "mod+k mod+c". |
| `platform?` | `Platform` | |
| `when?` | `string` | |

## `KeybindingStore`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `load()` | `() => UserKeybindings \| Promise<UserKeybindings \| null> \| null` | |
| `save()` | `(value: UserKeybindings) => void \| Promise<void>` | |
| `subscribe()?` | `(listener: (value: UserKeybindings \| null) => void) => () => void` | Changes made elsewhere: another tab, another device. |

## `MenuEntry`

One row of a right-click menu, as data a UI draws: an item runs its command through
`XlsxEditor.apply`, a prompt asks for `value` first. `shortcut` names keys as `Mod+X`.

Import from `@reductoai/xlsx/editor`.

```ts theme={null}
type MenuEntry = { command: XlsxCommand; disabled?: boolean; id: string; kind: "item"; label: string; shortcut?: string } | { command: (answer: string) => XlsxCommand | null; disabled?: boolean; id: string; kind: "prompt"; label: string; title: string; value: string } | { disabled?: boolean; id: string; kind: "window"; label: string; shortcut?: string; window: CellWindowKind } | { id: string; kind: "separator" } | { disabled?: boolean; id: string; items: MenuEntry[]; kind: "submenu"; label: string }
```

## `Platform`

Key names for bindings: parse, read from an event, and label per platform.

Not exported by name. You get it from the API.

```ts theme={null}
type Platform = "mac" | "win"
```

## `PreviewerState`

Import from `@reductoai/xlsx/view`.

| Name | Type | Description |
| - | - | - |
| `activeCell` | `{ c: number; r: number }` | |
| `activeSheetIndex` | `number` | |
| `drawing` | `DrawingSelection \| null` | The drawing object the user selected last on the active sheet, if any. |
| `drawings` | `DrawingSelection[]` | Every selected drawing object, the last one clicked last. |
| `selection` | `Selection` | |
| `zoom` | `number` | |

## `SavedView`

Where Excel left the sheet: the scrolling pane's first cell, the selection and the zoom.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `active?` | `{ c: number; r: number }` | |
| `layoutView?` | `boolean` | The sheet opens in Page Layout view. |
| `layoutZoom?` | `number` | Page Layout view's own zoom. |
| `pageView?` | `boolean` | The sheet opens in Page Break Preview. |
| `pageZoom?` | `number` | Page Break Preview's own zoom. |
| `selection?` | `Merge[]` | |
| `split?` | `SavedSplit` | View > Split as saved: the window splits there. |
| `topLeft?` | `{ c: number; r: number }` | |
| `zoom?` | `number` | |

## `Selection`

Import from `@reductoai/xlsx/view`.

| Name | Type | Description |
| - | - | - |
| `c1` | `number` | |
| `c2` | `number` | |
| `r1` | `number` | |
| `r2` | `number` | |

## `UserKeybindings`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `bindings` | `Keybinding[]` | |
| `version` | `1` | |

## `ViewRow`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `heightPx?` | `number` | |
| `hidden` | `boolean` | |
| `outlineLevel` | `number` | |
| `styleIndex?` | `number` | |

## `WindowKind`

Windows a key or menu opens; Replace is the Find window on its Replace tab.

Import from `@reductoai/xlsx-editor`.

```ts theme={null}
type WindowKind = Exclude<CellWindow["kind"], "function" | "rule" | "cfRules" | "subtotal" | "goalSeek" | "protect" | "sparklines" | "sparkSettings" | "selectData" | "moveChart" | "scenarios" | "advancedFilter" | "consolidate" | "removeDuplicates" | "pageSetup" | "dataTable" | "textColumns" | "slicerSettings" | "slicerConnections" | "pasteName" | "cfRule" | "validation" | "group" | "series" | "fillAcross" | "newCellStyle" | "mergeStyles" | "copyPicture" | "names" | "defineName" | "createNames"> | "renameSheet" | "replace"
```

## `WorkbookLookCommand`

Workbook-wide looks: cell styles and the theme.

Not exported by name. You get it from the API.

```ts theme={null}
type WorkbookLookCommand = CellStyleCommand | ThemeCommand
```

## `XlsxCommand`

Every edit is one of these, so a test, a script and the toolbar drive the editor the same way.
Toggles read the active cell, as Excel's ribbon does, and set the whole selection.

Import from `@reductoai/xlsx/editor`.

```ts theme={null}
type XlsxCommand = { active?: CellAt; areas?: CellArea[]; c1: number; c2?: number; r1: number; r2?: number; sheet?: number; sheets?: number[]; type: "select" } | { font: FontChange; type: "font" } | { mark: Mark; type: "toggle" } | { step: 1 | -1; type: "growFont" } | { color: string | null; type: "fill" } | { horizontal?: HorizontalAlign; type: "align"; vertical?: VerticalAlign } | { on?: boolean; type: "wrap" } | { step: 1 | -1; type: "indent" } | { degrees: number; type: "orientation" } | { how: MergeHow; type: "merge" } | { code: string; type: "numberFormat" } | { step: 1 | -1; type: "decimals" } | { color?: string; preset: BorderPreset; type: "borders" } | AddedCommand | { type: "clear"; what: ClearWhat } | { shift: InsertShift; type: "insert" } | { shift: DeleteShift; type: "delete" } | { fn?: AutoSumFn; type: "autoSum" } | { type: "copy" } | { type: "cut" } | { text?: string; type: "paste"; values?: boolean } | { special: PasteSpecial; type: "pasteSpecial" } | { from: CellBlock; type: "paintFormats" } | { axis: Axis; hidden: boolean; type: "hide" } | { comment?: string; name: string; refersTo: string; scope: NameScope; type: "addName" } | { name: string; scope: NameScope; to: { comment?: string; name: string; refersTo: string }; type: "editName" } | { names: { name: string; scope: NameScope }[]; type: "deleteNames" } | { from: CreateNamesFrom; type: "createNames" } | { type: "pasteNameList" } | { direction: FillDirection; type: "fillCells" } | { series: FillSeries; type: "fillSeries" } | { type: "flashFill" } | { type: "fillJustify" } | { how: FillAcrossHow; type: "fillAcross" } | { special: GoToSpecial; type: "goToSpecial" } | { reference: string; type: "goTo" } | { kind: TraceKind; type: "traceArrows" } | { kind?: TraceKind; type: "removeArrows" } | { axis?: Axis; type: "group" } | { axis?: Axis; type: "ungroup" } | { lines?: Axis | null; show: boolean; type: "groupDetail" } | { axis: Axis; level: number; type: "outlineLevel" } | { axis: Axis; points: number; type: "lineSize" } | { chars: number; type: "columnChars" } | { chars: number; type: "standardWidth" } | { at?: number; name?: string; type: "insertSheet" } | { sheet: number; type: "deleteSheet" } | { name: string; sheet: number; type: "renameSheet" } | { sheet: number; to: number; type: "moveSheet" } | { hidden: boolean; sheet: number; type: "hideSheet" } | ProtectCommand | { result?: string; sheet: number; type: "scenarioSummary" } | { type: "filter" } | { text: string; type: "note" } | { shown: boolean; type: "noteShow" } | { text: string; type: "comment" } | { id: string; text: string; type: "commentEdit" } | { id?: string; type: "commentDelete" } | { resolved: boolean; type: "commentResolve" } | { address: string; text?: string; tip?: string; type: "link" } | { address: string; headers: boolean; type: "table" } | { set: CellFormatPatch; type: "formatCells" } | { chart: ChartTarget; group?: string; part: string; set: ChartFormatPatch; type: "chartFormat" } | { chart: ChartTarget; set: ChartDesignPatch; type: "chartDesign" } | { chart: ChartTarget; edit: ChartDataEdit; group?: string; type: "chartData" } | { all?: boolean; query: FindQuery; type: "replace"; with: string } | { at?: { left: number; top: number }; bytes: Uint8Array; inCell?: boolean; type: "addPicture" } | { bytes: Uint8Array | null; type: "sheetBackground" } | { center?: { left: number; top: number }; chartType: string; combo?: { chartType: string; secondary?: boolean }; type: "insertChart" } | { order: "ascending" | "descending"; type: "sort" } | { address?: string; headers: boolean; leftToRight?: boolean; levels: SortLevel[]; matchCase?: boolean; type: "customSort" } | { type: "clearFilter" } | { type: "reapplyFilter" } | { at?: { c: number; r: number }; how: FreezeHow; type: "freeze" } | { show: boolean; type: "gridlines" } | { show: boolean; type: "headings" } | { rule: CfRuleSpec; type: "conditionalFormat" } | { appliesTo?: string; index: number; keepFormat?: boolean; rule?: CfRuleSpec; stopIfTrue?: boolean; type: "cfRuleEdit" } | { index: number; type: "cfRuleDelete" } | { index: number; to: number; type: "cfRuleMove" } | { index: number; type: "cfRuleDuplicate" } | { below?: boolean; by: number; columns: number[]; fn: SubtotalFn; pageBreaks?: boolean; replace?: boolean; type: "subtotal" } | { changing: string; set: string; to: number; type: "goalSeek" } | { columnInput?: string; rowInput?: string; type: "dataTable" } | { changing: string; comment?: string; hidden?: boolean; locked?: boolean; name: string; type: "addScenario"; user?: string; values: string[] } | { changing: string; comment?: string; hidden?: boolean; locked?: boolean; name: string; newName?: string; type: "editScenario"; user?: string; values: string[] } | { name: string; type: "deleteScenario" } | { reference: string; type: "addWatch" } | { type: "deleteWatch"; watches: { c: number; r: number; sheet: string }[] } | { action: "convertNumber" | "year19" | "year20" | "copyFormula" | "includeCells" | "ignore"; type: "errorAction" } | { function: ConsolidationFunction; leftColumn: boolean; sources: string[]; topRow: boolean; type: "consolidate" } | { address: string; columns: number[]; headers: boolean; type: "removeDuplicates" } | { copy: boolean; copyTo: string; criteria: string; list: string; type: "advancedFilter"; unique: boolean } | { set: Partial<PageSetup>; type: "pageSetup" } | { action: "insert" | "remove" | "reset"; type: "pageBreak" } | { name: string; type: "showScenario" } | { name: string; set: SlicerPatch; type: "slicer" } | { name: string; pivotTables: string[]; type: "slicerConnections" } | { field: string; pivot: string; set: ValueFieldPatch; type: "pivotValueField" } | { field: string; pivot: string; set: AxisFieldPatch; type: "pivotAxisField" } | { field: string; group: PivotGroupOptions | null; items?: string[]; pivot: string; type: "pivotGroup" } | { expand: boolean; field: string; item: string | null; pivot: string; type: "pivotExpand" } | { pivot: string; source: string; type: "pivotSource" } | { pivot: string; to: string; type: "pivotMove" } | { pivot: string; set: PivotOptionsPatch; type: "pivotOptions" } | { formula: string | null; name: string; pivot: string; type: "pivotCalcField" } | { destination?: string; formats?: TextColumnFormat[]; split: TextSplit; type: "textToColumns" } | { type: "removeSubtotals" } | { scope: "selection" | "table" | "sheet"; type: "clearRules" } | { data: string; group?: boolean; kind: SparkKind; location: string; type: "insertSparklines" } | { set: SparkSet; type: "sparklineGroup" } | { groups: boolean; type: "clearSparklines" } | { type: "groupSparklines"; ungroup: boolean } | { set: ValidationSpec | null; type: "dataValidation" } | { type: "undo" } | { type: "redo" } | { type: "repeat" }
```
