> ## 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.

# Review, find and navigation models

Side models on `EditorModel` (`model.review`, `model.find`, `model.nav`, `model.spell`, `model.ui.contextMenu`, `model.ui.palette`) and the observable they share.

## `ReviewModel`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`. Extends [`Observable`](https://docs.reducto.ai/office/docx/api/editor-panels#observable).

### ReviewModel properties

| Name | Type | Description |
| - | - | - |
| `anchors` | `ReviewAnchor[]` | |
| `cardHeights` | `Record<string, number>` | Balloon heights the margin measured, by `ReviewAnchor.slot`; a host margin reports its own. |
| `comments` | `ReviewComment[]` | |
| `composing` | `boolean` | The comment composer popover is showing. |
| `decorate` | `MarkDecorator \| null` | Restyles each mark's box; see `MarkDecorator`. |
| `draft` | `string` | Text in the composer; the popover lives in a component that cannot own runes. |
| `frames` | `PageFrame[]` | |
| `gutterMetrics` | `GutterMetrics` | Comment icon geometry `gutter` places with. |
| `hiddenReviewers` | `string[]` | Show Markup > Reviewers: authors whose comments and revisions are hidden. |
| `inks` | `InkChoice \| null` | Reviewer colours for the text, the balloons and the marks; null keeps Word's. |
| `items` | `Readonly<Record<string, readonly ReviewItem[]>>` | A host's records by kind, as `setItems` gave them. |
| `markKinds` | `readonly ReviewMarkKind[]` | Which ranges get a box over the text; Word marks comments only, the canvas inks revisions. |
| `metrics` | `MarginMetrics` | Balloon column geometry `layout` stacks with. |
| `narrow` | `boolean` | Opening the margin would shrink the page, so comments float over it instead. |
| `open` | `boolean` | |
| `peek` | `string \| null` | Thread whose card floats over the page while the margin is closed. |
| `picked` | `string \| null` | Balloon the user clicked; it stays active while the caret is in its record. |
| `placedItems` | `PlacedItem[]` | `items` where they sit now: a bookmark's range read after every edit. |
| `replyTo` | `string \| null` | Thread whose reply composer is open in the pane; the context menu opens it too. |
| `revisions` | `ReviewRevision[]` | |
| `show` | `MarkupKinds` | Show Markup's per-kind filter; a kind switched off loses its balloons and marks. |
| `showResolved` | `boolean` | Resolved threads keep a balloon; off by default so open work stands out. |
| `version` | `number` | Bumps on every change of this object or an adopted child. |
| `viewport` | `{ bottom: number; top: number }` | Scroller band worth building balloons for, in content px; a viewport each side. |
| `activeId` | `string \| null` | read-only |
| `activeKey` | `string \| null` | read-only |
| `canComment` | `boolean` | read-only |
| `floating` | `boolean` | read-only Comments float over the page rather than open a margin that has no room. |
| `gutter` | `GutterLayout` | read-only Simple Markup's comment icons while the margin is closed, in scroller px. |
| `layout` | `MarginLayout` | read-only Where every balloon of the open margin sits, in scroller px; the built-in margin draws this. |
| `marks` | `ReviewMark[]` | read-only The ranges painted over the text: `markKinds` picks which, `decorate` restyles them. |
| `markupCount` | `number` | read-only |
| `replacements` | `Map<string, string>` | read-only |
| `reviewers` | `string[]` | read-only Every author of a comment or a revision, in first-seen order. |
| `shownThreads` | `CommentThread[]` | read-only Threads the margin shows and the caret can pick. |
| `threads` | `CommentThread[]` | read-only |

### `ReviewModel.accept()`

```ts theme={null}
accept(scope: ReviewScope): void
```

### `ReviewModel.addComment()`

```ts theme={null}
addComment(): void
```

### `ReviewModel.cancelComment()`

```ts theme={null}
cancelComment(): void
```

### `ReviewModel.closePeek()`

```ts theme={null}
closePeek(): void
```

### `ReviewModel.closeReply()`

```ts theme={null}
closeReply(): void
```

### `ReviewModel.edit()`

```ts theme={null}
edit(id: string, text: string): void
```

### `ReviewModel.measureCard()`

```ts theme={null}
measureCard(slot: string, height: number): void
```

A balloon's rendered height; the stack moves to fit it.

### `ReviewModel.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `ReviewModel.openPin()`

```ts theme={null}
openPin(pin: GutterPin): void
```

A click on a gutter icon: its card closes when open, else its first thread shows.

### `ReviewModel.paint()`

```ts theme={null}
paint(
  ir: LayoutDocument,
  pxPerHmm: number,
  layerOf: (page: number) => HTMLElement | undefined,
): void
```

### `ReviewModel.pick()`

```ts theme={null}
pick(anchor: Pick<ReviewAnchor, "kind" | "id" | "key" | "page">): void
```

Same as a click on the balloon: the record is picked, so it pins and shows.

### `ReviewModel.placePages()`

```ts theme={null}
placePages(
  ir: LayoutDocument,
  pxPerHmm: number,
  cardOf: (index: number) => HTMLElement | undefined,
  room?: number,
): void
```

Where each page card sits in the scroller; the margin positions balloons off this.

### `ReviewModel.rectsOf()`

```ts theme={null}
rectsOf(key: string): Rect[]
```

The text a balloon marks, in page hmm: a comment's range, a change with the
insertion that replaced it, the composer's selection. A header change gives
rects on every page that repeats it.

### `ReviewModel.refresh()`

```ts theme={null}
refresh(): void
```

Pull the fresh snapshot after open and after every applied command.

### `ReviewModel.reject()`

```ts theme={null}
reject(scope: ReviewScope): void
```

### `ReviewModel.remove()`

```ts theme={null}
remove(id: string): void
```

### `ReviewModel.reply()`

```ts theme={null}
reply(id: string, text: string): void
```

### `ReviewModel.reset()`

```ts theme={null}
reset(): void
```

### `ReviewModel.resolve()`

```ts theme={null}
resolve(id: string, resolved: boolean): void
```

### `ReviewModel.reveal()`

```ts theme={null}
reveal(range: ReviewRange | undefined, page?: number, key?: string): void
```

Clicking a record moves the caret only: no command, no history entry. A
header range opens its story on the page the balloon was clicked on.

### `ReviewModel.setItems()`

```ts theme={null}
setItems(kind: string, items: readonly ReviewItem[]): void
```

A host's records of one kind; they replace that kind's last ones, `[]` clears it.
They anchor, stack and mark as comments do; draw them with the `balloon` slot.

### `ReviewModel.setReviewerShown()`

```ts theme={null}
setReviewerShown(author: string | undefined, on: boolean): void
```

Show Markup > Reviewers: one author on or off; `undefined` turns All Reviewers on or off.

### `ReviewModel.setShown()`

```ts theme={null}
setShown(kind: keyof MarkupKinds, on: boolean): void
```

Show Markup > Comments, Insertions and Deletions, Formatting.

### `ReviewModel.setViewport()`

```ts theme={null}
setViewport(scrollTop: number, height: number): void
```

Coarse on purpose: a scroll only rebuilds balloons when it crosses a band edge.

### `ReviewModel.showThread()`

```ts theme={null}
showThread(id: string, reply?: boolean): void
```

Opens a thread where it fits: the margin when there is room, else a card over the page.

### `ReviewModel.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `ReviewModel.startComment()`

```ts theme={null}
startComment(): void
```

### `ReviewModel.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

### `ReviewModel.threadAtCaret()`

```ts theme={null}
threadAtCaret(): string | null
```

Thread under the caret, hidden resolved ones too, so the context menu can reopen it.

### `ReviewModel.toggle()`

```ts theme={null}
toggle(): void
```

### `ReviewModel.toggleResolved()`

```ts theme={null}
toggleResolved(): void
```

## `FindModel`

What the results view reads and calls; both editors' find models satisfy it.

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`. Extends [`Observable`](https://docs.reducto.ai/office/docx/api/editor-panels#observable).

### FindModel properties

| Name | Type | Description |
| - | - | - |
| `hits` | `ReviewRange[]` | |
| `index` | `number` | |
| `matchCase` | `boolean` | |
| `query` | `string` | |
| `replacement` | `string` | |
| `version` | `number` | Bumps on every change of this object or an adopted child. |
| `label` | `string` | read-only |
| `open` | `boolean` | read-only The panel is the navigation pane's results view; find owns no visibility of its own. |
| `rows` | `FindRow[]` | read-only The list page around the current hit; rendering every hit would hang the page. |
| `rowStart` | `number` | read-only First hit of the list page that holds the current one. |

### `FindModel.claims()`

```ts theme={null}
claims(selection: Selection): boolean
```

The current hit is the selection: its wash stands in for the blue one.

### `FindModel.go()`

```ts theme={null}
go(index: number): Promise<void>
```

A click on one result row.

### `FindModel.hide()`

```ts theme={null}
hide(): void
```

### `FindModel.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `FindModel.paint()`

```ts theme={null}
paint(
  ir: LayoutDocument,
  pxPerHmm: number,
  layerOf: (page: number) => HTMLElement | undefined,
): void
```

Word's yellow wash on every hit; the current one sits under the selection.

### `FindModel.refresh()`

```ts theme={null}
refresh(): Promise<void>
```

After an edit: hits move but the caret stays where the user put it.

### `FindModel.replace()`

```ts theme={null}
replace(): Promise<void>
```

### `FindModel.replaceAll()`

```ts theme={null}
replaceAll(): Promise<void>
```

One Undo step, as Word's Replace All.

### `FindModel.reset()`

```ts theme={null}
reset(): void
```

### `FindModel.search()`

```ts theme={null}
search(): Promise<void>
```

### `FindModel.show()`

```ts theme={null}
show(): void
```

### `FindModel.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `FindModel.step()`

```ts theme={null}
step(direction: -1 | 1): Promise<void>
```

### `FindModel.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

## `NavModel`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`. Extends [`Observable`](https://docs.reducto.ai/office/docx/api/editor-panels#observable).

### NavModel properties

| Name | Type | Description |
| - | - | - |
| `folded` | `ReadonlySet<number>` | Body indexes of headings whose subtree is folded away. |
| `open` | `boolean` | |
| `tab` | `NavTab` | |
| `version` | `number` | Bumps on every change of this object or an adopted child. |
| `filtering` | `boolean` | read-only |
| `headings` | `OutlineEntry[]` | read-only |
| `rows` | `NavRow[]` | read-only The rows to draw: the filter's matches, else the unfolded tree. |

### `NavModel.fold()`

```ts theme={null}
fold(entry: OutlineEntry): void
```

### `NavModel.go()`

```ts theme={null}
go(entry: OutlineEntry): void
```

A click on a heading: the caret goes to its first character, as in Word.

### `NavModel.hide()`

```ts theme={null}
hide(): void
```

### `NavModel.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `NavModel.reset()`

```ts theme={null}
reset(): void
```

### `NavModel.setTab()`

```ts theme={null}
setTab(tab: NavTab): void
```

### `NavModel.show()`

```ts theme={null}
show(tab: NavTab): void
```

### `NavModel.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `NavModel.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

### `NavModel.toggle()`

```ts theme={null}
toggle(tab: NavTab): void
```

### `NavModel.type()`

```ts theme={null}
type(query: string): void
```

The shared query box: it filters headings, and drives the search on the results tab.

## `Observable`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.

### Observable properties

| Name | Type | Description |
| - | - | - |
| `version` | `number` | Bumps on every change of this object or an adopted child. |

### `Observable.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `Observable.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `Observable.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

## `Unsubscribe`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.

```ts theme={null}
type Unsubscribe = () => void
```

## `ContextMenuStore`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`. Extends [`Observable`](https://docs.reducto.ai/office/docx/api/editor-panels#observable).

### ContextMenuStore properties

| Name | Type | Description |
| - | - | - |
| `active` | `number` | |
| `open` | `boolean` | |
| `sub` | `number` | Index of the row whose flyout is open, or -1. |
| `subActive` | `number` | |
| `version` | `number` | Bumps on every change of this object or an adopted child. |
| `x` | `number` | |
| `y` | `number` | |
| `items` | `MenuItem[]` | read-only |
| `subItems` | `MenuItem[]` | read-only |

### `ContextMenuStore.close()`

```ts theme={null}
close(): void
```

### `ContextMenuStore.closeSub()`

```ts theme={null}
closeSub(): void
```

### `ContextMenuStore.move()`

```ts theme={null}
move(step: number): void
```

### `ContextMenuStore.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `ContextMenuStore.openSub()`

```ts theme={null}
openSub(index: number, focusFirst: boolean): void
```

### `ContextMenuStore.runActive()`

```ts theme={null}
runActive(): void
```

### `ContextMenuStore.show()`

```ts theme={null}
show(build: MenuBuilder, x: number, y: number): void
```

### `ContextMenuStore.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `ContextMenuStore.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

## `MenuItem`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.

```ts theme={null}
type MenuItem = MenuAction | { id: string; kind: "separator" } | { id: string; items: MenuItem[]; kind: "submenu"; label: string }
```

## `PaletteStore`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`. Extends [`Observable`](https://docs.reducto.ai/office/docx/api/editor-panels#observable).

### PaletteStore properties

| Name | Type | Description |
| - | - | - |
| `open` | `boolean` | |
| `placeholder` | `string` | |
| `providers` | `readonly PaletteProvider<Group>[]` | The registered providers; use `register`. |
| `query` | `string` | |
| `restoreFocus` | `boolean` | False while a focus-owning command runs, so the dialog leaves focus alone on close. |
| `steps` | `readonly PaletteStep<Group>[]` | |
| `usage` | `PaletteUsage \| undefined` | read-only |
| `version` | `number` | Bumps on every change of this object or an adopted child. |
| `commands` | `PaletteItem<Group>[]` | read-only |
| `promptResult` | `PalettePrompt<Group> \| null` | read-only The typed argument, unless a fixed child already says the same thing. |
| `step` | `PaletteStep<Group> \| null` | read-only |

### `PaletteStore.exitStep()`

```ts theme={null}
exitStep(): void
```

Back out one step without closing the palette.

### `PaletteStore.hide()`

```ts theme={null}
hide(): void
```

### `PaletteStore.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `PaletteStore.register()`

```ts theme={null}
register(provider: PaletteProvider<Group>): () => void
```

### `PaletteStore.run()`

```ts theme={null}
run(command: PaletteItem<Group>): void
```

### `PaletteStore.show()`

```ts theme={null}
show(): void
```

### `PaletteStore.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `PaletteStore.submitPrompt()`

```ts theme={null}
submitPrompt(): void
```

### `PaletteStore.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

### `PaletteStore.toggle()`

```ts theme={null}
toggle(): void
```

## `PaletteItem`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.

| Name | Type | Description |
| - | - | - |
| `detail?` | `string` | Dim right-hand line: the current value, a unit, a path. |
| `group` | `Group` | |
| `icon?` | `unknown` | Raw SVG markup, or a component for a brand mark. |
| `id` | `string` | Stable across renders: the filter key and the list key. |
| `keys?` | `string` | The keys that run the same command, already labelled ("⌘B"). |
| `keywords?` | `string[]` | Extra match terms; the label always matches on its own. |
| `label` | `string` | |
| `run?` | `() => void \| Promise<void>` | Omit when `step` is set: the step owns the action. |
| `score?` | `number` | Provider-ranked match in (0, 1]; the palette keeps it instead of fuzzy-scoring the label. |
| `step?` | `PaletteStep<Group>` | |
| `takesFocus?` | `boolean` | The action opens its own input, so the palette must not take focus back. |
| `transient?` | `boolean` | The id encodes an argument (`page:57`), so it earns no usage weight. |

## `SpellModel`

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`. Extends [`Observable`](https://docs.reducto.ai/office/docx/api/editor-panels#observable).

### SpellModel properties

| Name | Type | Description |
| - | - | - |
| `on` | `boolean` | |
| `revision` | `number` | Bumps when a verdict, the user's words or the ignores change. |
| `version` | `number` | Bumps on every change of this object or an adopted child. |

### `SpellModel.add()`

```ts theme={null}
add(word: string): void
```

### `SpellModel.at()`

```ts theme={null}
at(selection: Selection | null): Misspelling | undefined
```

The flagged word under a collapsed caret.

### `SpellModel.ignore()`

```ts theme={null}
ignore(word: string): void
```

### `SpellModel.misses()`

```ts theme={null}
misses(ir: LayoutDocument): Misspelling[]
```

Misspellings on the pages around the one in view.

### `SpellModel.observes()`

```ts theme={null}
observes(key: string): boolean
```

### `SpellModel.paint()`

```ts theme={null}
paint(
  ir: LayoutDocument,
  pxPerHmm: number,
  layerOf: (page: number) => HTMLElement | undefined,
): void
```

### `SpellModel.replace()`

```ts theme={null}
replace(miss: Misspelling, text: string): Promise<void>
```

Types `text` over the word: an ordinary edit and one undo step.

### `SpellModel.reset()`

```ts theme={null}
reset(): void
```

A new document: this session's ignores end with the old one.

### `SpellModel.stampOf()`

```ts theme={null}
stampOf(key: string): number
```

### `SpellModel.subscribe()`

```ts theme={null}
subscribe(listener: Listener, key?: string): Unsubscribe
```

Listen to one key, or to every change (including adopted children) when `key` is omitted.

### `SpellModel.suggest()`

```ts theme={null}
suggest(word: string): Promise<string[]>
```

### `SpellModel.toggle()`

```ts theme={null}
toggle(): void
```

## `localDictionary()`

```ts theme={null}
function localDictionary(storage?: Storage | undefined, key?: string): SpellDictionary
```

The user's words in localStorage: shared by every document this browser opens.

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.

## `workerSpeller()`

```ts theme={null}
function workerSpeller(): Speller
```

nspell with en\_US in a worker, spawned on the first question. A worker that cannot load (a dev
server that pre-bundles this package moves its URL) hands the dictionary to the page instead.

Import from `@reductoai/docx-editor`, `@reductoai/docx-editor/model`.
