The store implements one workflow that every annotation UI built on it shares. It is designed around one rule: users never create or change something they didn’t mean to.
The rules
- Normal mode is selection. Reading, selecting text and scrolling never create anything. A text selection only opens the
SelectionMenu; the menu or a shortcut (H, U, S, C, 1–9) creates the markup. - Every creation is pending. A new annotation becomes
store.pendingIdand its note opens for typing. Enter keeps it, Esc discards it without leaving an undo step, clicking elsewhere keeps it. - Tools are one-shot. After drawing a box, an arrow or a note, the tool returns to select. Hold Shift while creating to keep the tool once, or set
stickyToolsfor highlighting sessions. - No double markups. In highlighter mode, a double-click followed by a triple-click (word, then line) extends one markup instead of stacking a second.
- Editing is deliberate. Existing annotations are selected with a double-click (
selectOn: 'dblclick', the default;'click'is available). A selected annotation shows its popover; Delete removes it, Enter or F2 edits its note, arrows nudge shapes, corners resize (Shift keeps proportions). - One keymap. Every shortcut comes from
defaultKeymap, merged with yourkeymapprop.comboLabel(store.keymap, action)prints a combo for tooltips. See Keyboard shortcuts.
Store API
Copy to clipboard
Showing notes
Annotations.Marginstacks notes beside the page without overlaps (narrower when room is short, over the page’s blank margin if needed, markers belowminWidth);Annotations.LineMarkersdraws gutter bars;Annotations.HoverCardshows a note on hover (not for a box whose label is all it has, nor over a side note that already shows it).store.notesVisible = falsehides margin notes and markers in one go.forceMount+ thechildsnippet’sopenflag let you animate your own hover card (see Floating parts).
Persisting
The library stores nothing itself. Save inonAnnotationsChange(list, ops), keyed by viewer.document.fingerprint (stable across mirrors of the same file), and restore with store.load(list) — which resets undo history.