@docx-editor.dev/core/editor
@docx-editor.dev/core/editor — the editor facade and its chrome vocabulary.
createDocxEditor implements the full Editor contract over a paginated surface, and the chrome registry (CHROME_GROUPS, ChromeSlotId) is the toolbar taxonomy both adapters derive their default arrangement from. Enabled state has exactly one source — toolbarCommandState, which asks the engine — so a control and the engine can never disagree.
Functions (179)
alignmentAfterDirectionChangefunctionSource ↗
The physical alignment a paragraph shows after its direction flips, with its stored w:jc unchanged: leading and trailing edges trade sides. A dialog applies this to its Alignment field when Direction changes, so the field shows what OK will produce, the same result as the toolbar's direction buttons.
declare function alignmentAfterDirectionChange(alignment: ParagraphDialogFields['alignment']): ParagraphDialogFields['alignment'];applyTableChromePickfunctionSource ↗
Build the engine command for one table chrome pick and the draft state after it. Target picks apply the current complete spec; none clears the active target only.
declare function applyTableChromePick(draft: TableChromeDraft, slot: TableChromeSlotId, value: unknown): TableChromePick | null;applyThemeShadefunctionSource ↗
Blend toward black. keep is the fraction of the base colour retained (OOXML themeShade byte).
declare function applyThemeShade(hex: string, keep: number): string;applyThemeTintfunctionSource ↗
Blend toward white. keep is the fraction of the base colour retained (OOXML themeTint byte).
declare function applyThemeTint(hex: string, keep: number): string;bindHistoryGroupfunctionSource ↗
Bind native gesture events. Framework change handlers apply values; this binding ends groups. Native color change means value commitment, not portable popup closure. Controls without a terminal change event end on the next activation, Escape, blur, or disposal. Range/repeat controls end on pointer release/cancel or keyup, including outside releases. Terminal events close after propagation so the final value can use the same handle.
declare function bindHistoryGroup(editor: Editor, element: HTMLElement, config: HistoryGroupBindingOptions): HistoryGroupBinding;blankDocumentBytesfunctionSource ↗
A blank document, freshly zipped per call (the caller may hand the bytes to a loader that takes ownership). Calibri 11pt and Word's Normal paragraph spacing are authored in w:docDefaults, Word's built-in style gallery in styles.xml, and US Letter geometry in the section. Word opens the saved file.
A right-to-left interface usually wants { direction: 'rtl', bidiLanguage: 'ar-SA' } (or the reader's own language), so the first paragraph is ready for right-to-left typing.
declare function blankDocumentBytes(options?: BlankDocumentOptions): Uint8Array;bookmarkDialogInitialNamefunctionSource ↗
The name the dialog starts with: the visible bookmark the selection is in, or an empty name.
declare function bookmarkDialogInitialName(bookmarks: readonly BookmarkSummary[]): string;bookmarkDialogNameStatefunctionSource ↗
Evaluate the name typed in the Bookmark dialog against the document's bookmarks. writable is whether the document accepts edits; Go To works either way.
declare function bookmarkDialogNameState(bookmarks: readonly BookmarkSummary[], name: string, writable: boolean): BookmarkDialogNameState;bookmarkDialogRowsfunctionSource ↗
The bookmarks the dialog lists. Hidden bookmarks show only when asked for. Names sort without case and with numbers in order, and location sorts by document order.
declare function bookmarkDialogRows(bookmarks: readonly BookmarkSummary[], options: {
readonly sortBy: BookmarkSortOrder;
readonly showHidden: boolean;
}): readonly BookmarkSummary[];calendarDateForKeyfunctionSource ↗
Calendar keyboard destination. Shift+PageUp/PageDown moves one year.
declare function calendarDateForKey(iso: string, key: string, locale?: string, shift?: boolean): string | null;calendarDateFromTextfunctionSource ↗
Parse a complete ISO or regional numeric date; ambiguous two-digit years are refused.
declare function calendarDateFromText(text: string, locale?: string): string | null;calendarDateTextfunctionSource ↗
Format an ISO date for numeric entry in the editor locale.
declare function calendarDateText(iso: string, locale?: string): string;calendarMonthfunctionSource ↗
Build the six-week grid for one month.
Bounded by construction: 42 cells whatever the month, and every value is derived from the year and month numbers, never from document text.
declare function calendarMonth(year: number, month: number, options?: CalendarMonthOptions): CalendarMonth;calendarMonthNamesfunctionSource ↗
The twelve Gregorian month names for a month selector.
declare function calendarMonthNames(locale?: string): readonly string[];calendarMonthTitlefunctionSource ↗
Month-and-year title for a grid, formatted in the calendar locale.
declare function calendarMonthTitle(year: number, month: number, locale?: string): string;calendarWeekdaysfunctionSource ↗
Seven weekday labels starting on the locale's first weekday.
declare function calendarWeekdays(locale?: string): readonly string[];canExecuteImageCommandfunctionSource ↗
Whether an insert or replace would be accepted — the can half of the can-before-exec pair.
Refuses in suggesting mode, since an image property edit has no tracked-change representation.
declare function canExecuteImageCommand(command: Extract<EditorCommand, {
type: 'insertImage' | 'replaceImage';
}>, surface: PaginatedSurface | null): CanResult;captureImageMutationPreconditionsfunctionSource ↗
Snapshot the state an image mutation was planned against: mount generation, package revision, and the selection anchor.
Taken at the START of a drag so the commit can be checked against it with [isStaleImageInteractionCommit](isStaleImageInteractionCommit). A pointer gesture spans many frames, and a document that moved underneath it must not have the gesture's final coordinates applied to it.
declare function captureImageMutationPreconditions(editor: Pick<DocxEditorInstance, 'surface' | 'mountGeneration'>): ImageMutationPreconditions | null;changedFieldsfunctionSource ↗
The submission: ONLY the fields that moved since the dialog opened.
Sending the whole form would flatten every setting the selection disagrees about. A mixed keepNext would become off on every paragraph, and a mixed left indent would become an explicit zero — which is worse than wrong, because a zero BLOCKS the style cascade where leaving the setting alone would let the style keep supplying it. An untouched field is not a decision, so it is not written.
Returns null when nothing moved, which the caller treats as "just close": an empty write would still push an undo entry that restores nothing.
declare function changedFields(seed: ParagraphDialogFields, current: ParagraphDialogFields,
seedMixed?: ParagraphDialogMixed,
currentMixed?: ParagraphDialogMixed): ParagraphFormatUpdate | null;chromeControlCountfunctionSource ↗
Total controls, so a parity test can assert none were dropped.
declare function chromeControlCount(): number;chromeMenuSlotsfunctionSource ↗
Every slot a menu places, in menu order, submenus flattened. What a parity test asserts against, and what a host enumerates to know which capabilities the menu bar reaches.
declare function chromeMenuSlots(): readonly ChromeSlotId[];chromeProbeForSlotfunctionSource ↗
The probe a slot uses to ask "would the engine honour this right now?" when its real command needs an argument the slot itself cannot supply.
text.link is the case: whether this selection could become a link is the engine's question, but WHICH link is a URL field's. toolbarCommandState answers the slot from this probe and from whether a link UI is registered, and runToolbarCommand opens that UI, so chrome reads the slot like any other.
declare function chromeProbeForSlot(slotId: ChromeSlotId): EditorCommand | null;chromeSlotIdfunctionSource ↗
The slot id of one control within its group. Only meaningful for entries of CHROME_GROUPS — the cast is sound because every group/control pair in the registry is, by construction, a member of the ChromeSlotId union.
declare function chromeSlotId(group: {
readonly id: string;
}, control: {
readonly id: string;
}): ChromeSlotId;chromeSlotIsTogglefunctionSource ↗
Whether a slot's control renders as a TOGGLE — pressed or not — so it carries aria-pressed.
Shared rather than derived per adapter, because it is not derivable from the command table alone: the format painter has no fixed command (a press captures, arms, locks or stands down, which no single EditorCommand describes), so a rule that only read commandForSlot left it announcing nothing at all to a screen reader while it was armed.
declare function chromeSlotIsToggle(slotId: ChromeSlotId): boolean;commandExecOptionsfunctionSource ↗
Ignore framework events passed to a command used directly as an event handler.
declare function commandExecOptions(value: unknown): EditorExecOptions | undefined;commandForSlotfunctionSource ↗
The public editor command behind one chrome slot, or null when the slot is not wired to a command yet (parity-only chrome, or save — which is not a command). The single source of command truth for both adapters.
declare function commandForSlot(slotId: ChromeSlotId): EditorCommand | null;commandForSlotValuefunctionSource ↗
The engine command for a VALUE-TYPED slot carrying the picked value, or null for a slot that does not take a value.
Two families: the run-property pickers (font.family, font.size, text.color, text.highlight) resolve to setMarkAttr, and styles.style resolves to setParagraphStyle — a paragraph styleId, not a mark. Either way the value is validated by the engine's own gate (can refuses a malformed one with invalidArgs; a styleId the document does not define is refused at exec), so a host can pass user input through unmodified.
declare function commandForSlotValue(slotId: ChromeSlotId, value: unknown): EditorCommand | null;commandForTableChromeSlotValuefunctionSource ↗
Build an engine command for one table chrome slot using the caller's draft state.
declare function commandForTableChromeSlotValue(slotId: TableChromeSlotId, value: unknown, draft: TableChromeDraft): EditorCommand | null;compareDocumentsErrorKeyfunctionSource ↗
The @docx-editor.dev/i18n key of the message for a refused compare: compareDocuments.reasons.<reason> when the refusal names a reason, else compareDocuments.errors.<code>.
declare function compareDocumentsErrorKey(refusal: {
readonly code: CompareDocumentsErrorCode;
readonly reason?: CompareDocumentsRefusalReason;
}): `compareDocuments.errors.${CompareDocumentsErrorCode}` | `compareDocuments.reasons.${CompareDocumentsRefusalReason}`;```ts
const outcome = await session.apply({ revised });
if (!outcome.ok) showError(t(compareDocumentsErrorKey(outcome)));
```composeFontConfigurationfunctionSource ↗
Merge a base and any number of fragments into one frozen FontConfiguration.
A bare fragment IS a valid base, so the single-origin case is one argument: composeFontConfiguration(await loadDefaultFonts()). Pass extra fragments to layer origins, and set epoch/maxFontBytes/defaultFont on the base only when you need something other than the documented defaults.
- Sources dedupe first-wins by (family, weight, style), in argument order — base before fragments, earlier fragments before later ones. - Substitutions dedupe first-wins by their from face, in the same order, and every substitution whose from face has a direct source anywhere in the composition is dropped: a real face always beats a stand-in. - The result is frozen (arrays included); the byte arrays themselves are the callers' and are not copied here — the resource snapshot takes its own defensive copy.
declare function composeFontConfiguration(base: FontConfigurationBase, ...fragments: readonly FontConfigurationFragment[]): FontConfiguration;composeFontOriginsfunctionSource ↗
Resolve a list of [FontOrigin](FontOrigin)s against one document's needs and merge them, first-wins in list order.
Origins resolve IN ORDER, one after another, and each is told which faces the ones before it can already paint ([FontResolutionRequest.resolvedFaces](FontResolutionRequest.resolvedFaces)). Sequential rather than a Promise.all, and that is a real cost — one extra origin's latency on the critical path — bought deliberately: composition is first-wins, so a later origin's copy of a face an earlier one supplied can never be used, and fetching it anyway spends the bytes twice and tells a font host which families the document uses for a result that gets thrown away. Order origins cheapest-first.
A resolver that ignores resolvedFaces still composes correctly; it just spends more.
ONE ORIGIN CANNOT SINK THE REST. An origin that throws, answers null, or answers something malformed is reported and skipped whole, and the origins around it still compose — an app that listed a flaky network origin behind a bundled one keeps the bundled faces. Skipped WHOLE: an answer is read completely before any of it is committed, so a half-ingested origin can never reach composition.
The result carries NO epoch: it is a fragment for the engine to stamp with the load sequence. A fixed epoch from here would label every document's byte set as the same one. undefined means no origin contributed anything, which is a normal answer — the document stays on the fixed measurer.
declare function composeFontOrigins(origins: readonly FontOrigin[], request: FontResolutionRequest, options?: ComposeFontOriginsOptions): Promise<FontConfigurationFragment | undefined>;computeImageResizeResultfunctionSource ↗
Resolve one resize frame from the pointer's current position.
Handles rotation and flips by mapping the SCREEN-space handle back to the drawing's local axes first: dragging the visually-right handle of a 90°-rotated image must change its stored height, and a flipped image's handles move in the opposite direction from where they appear.
declare function computeImageResizeResult(options: {
readonly handle: ImageResizeHandle;
readonly startWidthEmu: number;
readonly startHeightEmu: number;
readonly startBounds: {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
};
readonly startPosition: DrawingPositionInput | null;
readonly anchorFrameOrigin?: AnchorFrameOrigin | null;
readonly deltaXPt: number;
readonly deltaYPt: number;
readonly transform: DrawingTransform;
readonly preserveAspect: boolean;
readonly kind: 'inline' | 'anchored';
}): ImageResizeResult;computeMovedImagePositionfunctionSource ↗
The position a move drag produces, preserving the anchoring the file already used.
A frame-mode position keeps its relativeToH/relativeToV bases and only shifts the offsets it actually had — writing an offset the file omitted would re-anchor the drawing to a different reference and move it somewhere the drag never pointed.
declare function computeMovedImagePosition(start: DrawingPositionInput, deltaXPt: number, deltaYPt: number): DrawingPositionInput;computeResizedImageExtentEmufunctionSource ↗
The extent a resize drag produces, in EMU.
Computed from the drag's START extent rather than the previous frame's, so a drag that reverses direction lands exactly where it began instead of accumulating rounding error.
preserveAspect behaves the way Word's handles do: a corner handle scales by whichever axis moved further, while an edge handle drives the other axis from the original ratio. Both axes are floored at one point, so a drag past the opposite edge cannot invert the image.
declare function computeResizedImageExtentEmu(startWidthEmu: number, startHeightEmu: number, handle: ImageResizeHandle, deltaWidthPt: number, deltaHeightPt: number, preserveAspect: boolean): {
readonly cx: number;
readonly cy: number;
};contentControlPopupKeyDownfunctionSource ↗
Keep keyboard input inside a popup; Escape cancels and Tab wraps visible controls.
declare function contentControlPopupKeyDown(panel: HTMLElement, event: KeyboardEvent, cancel: () => void): void;contentControlPopupOpenerfunctionSource ↗
Capture a popup's opener, with the editable pages as fallback when no control had focus.
declare function contentControlPopupOpener(anchor: HTMLElement | null): HTMLElement | null;copyEditorStylesfunctionSource ↗
Copy every stylesheet of from into to, and keep copying the ones from adds later.
Covers <link rel="stylesheet"> and <style> elements added, changed or removed at any time; rules inserted into a same-origin <style> through the CSSOM (CSS-in-JS libraries in production), checked every 250 ms on the pop-out's own clock while it is open; constructed adoptedStyleSheets, checked the same way; and the theme attributes on <html> such as class and data-theme. Rules inserted into a <link> sheet, or any sheet of another origin, are not copied. Returns a function that stops the mirroring.
declare function copyEditorStyles(from: Document, to: Document): () => void;```ts
const stop = copyEditorStyles(document, popup.document);
// Later, when the pop-out closes:
stop();
```createBrowserAutomationHostfunctionSource ↗
An automation host over a live editor.
The editor keeps its own lifetime: dispose() on the returned host releases the change subscription this adapter took and leaves the editor mounted and editable.
save() validates pending form input. Invalid values and saves during an active edit return transaction-refused. For autosaving from change callbacks, use the asynchronous editor.save(), which waits for the active edit to finish.
declare function createBrowserAutomationHost(editor: DocxEditorInstance): BrowserAutomationHost;createContentControlListNavigationfunctionSource ↗
Create bounded, locale-aware typeahead and roving focus for a popup's options.
declare function createContentControlListNavigation(locale?: string): ContentControlListNavigation;createDocumentRefreshfunctionSource ↗
Get the engine-owned controller for updated DOCX files. React and Vue use the same controller. Transport and processor jobs belong to your application. This is a host API, not an Office.js document member.
declare function createDocumentRefresh(editor: DocxEditorInstance): DocumentRefresh;createDocumentSearchfunctionSource ↗
The shared search session of an editor. Every call for the same editor returns the same session, so the Find pane and your code read and drive one search.
declare function createDocumentSearch(editor: Editor): DocumentSearch;```ts
const search = createDocumentSearch(editor);
const stop = search.showHighlights('all');
search.find('Supplier', { wholeWord: true });
search.next();
```createDocxEditorfunctionSource ↗
Build an editor: the full Editor contract over a paginated surface.
Construction is separate from mounting. Pass a container and the document mounts immediately; omit it and nothing touches the DOM until attach(el) — the provider-first shape. detach() parks the live document and a later attach(el) moves it in, with undo, selection and collaboration intact, even into another window (a pop-out or an iframe).
snapshot() is version-cached: the same reference until state actually moves, with reference-stable sub-objects, so it is safe as a useSyncExternalStore source.
declare function createDocxEditor(config: DocxEditorConfig): DocxEditorInstance;```ts
const editor = createDocxEditor({ document: bytes, modules: [reviewModule()] });
editor.attach(element);
editor.on('change', () => setDirty(true));
```createFontSourcefunctionSource ↗
Turn font bytes you ALREADY hold into a FontSource — a file input, IndexedDB, a bundler import. loadFonts covers URLs; this covers everything else, so no caller has to hand-assemble the record or reach for a hashing helper.
Returns a typed failure instead of throwing when the descriptor or the bytes are unusable, matching loadFonts: one bad face degrades itself, never its neighbours.
declare function createFontSource(bytes: Uint8Array, request: FontFaceRequest & {
readonly faceIndex?: number;
}, options?: {
readonly id?: string;
readonly maxFontBytes?: number;
}): {
readonly source: FontSource;
} | {
readonly failure: FontLoadFailure;
};createImageOverlayScrollPortfunctionSource ↗
An [ImageOverlayScrollPort](ImageOverlayScrollPort) over a real scroll container.
Reports the delta the element ACTUALLY scrolled, converted back to points — at the end of the document that is less than asked for, and the overlay must not move the image further than the page travelled.
declare function createImageOverlayScrollPort(scroller: HTMLElement, paintScale: number): {
scrollBy(deltaYPoints: number): number;
};createLayoutShapingfunctionSource ↗
declare function createLayoutShaping(configuration: FontConfiguration, instrumentation?: LayoutShapingInstrumentation, execution?: FontShapingOptions): Promise<LayoutShapingOptions>;cropPercentFromCropPermillefunctionSource ↗
Permille crop → UI percent.
declare function cropPercentFromCropPermille(crop: ImageCropPermille): ImageCropPercent;cropPercentFromPermillefunctionSource ↗
OOXML permille → UI percent.
declare function cropPercentFromPermille(permille: number): number;cropPercentFromSourceCropfunctionSource ↗
Projection fraction (0–1) → UI percent (0–100).
declare function cropPercentFromSourceCrop(crop: SourceCrop): ImageCropPercent;cropPermilleFromCropPercentfunctionSource ↗
UI percent crop → permille for tree ops / a:srcRect.
declare function cropPermilleFromCropPercent(crop: ImageCropPercent): ImageCropPermille;cropPermilleFromPercentfunctionSource ↗
UI percent → OOXML permille.
declare function cropPermilleFromPercent(percent: number): number;cssPixelsToLayoutPointsfunctionSource ↗
CSS pixels back to layout points — what a pointer event's coordinates must go through.
declare function cssPixelsToLayoutPoints(pixels: number, paintScale: number): number;customFontsfunctionSource ↗
Supply application fonts without manual resolver wiring.
Loads all listed faces when the editor resolves fonts, including families the document does not use yet. This makes company fonts available in the font picker for new documents. Faces supplied by earlier origins are skipped by family, weight, and style; family matching ignores case. URLs always come from sources, never from document text.
Uses [loadFonts](loadFonts) for validation, optional hash checks, and browser caching. The editor registers the returned bytes under private aliases. This function does not change the document's selected fonts or register page-wide family names.
Constructing the resolver does not fetch. Cancellation of the document load rejects with signal.reason, without warnings or onFailure calls. Other face failures are reported once per resolution, and successful faces remain available to the editor.
ts
const fonts = useFonts(
customFonts({ sources: companyFontFiles, onFailure: reportFontFailure }),
packagedFonts(),
googleFonts(),
);
Use [loadFonts](loadFonts) directly to load every listed face eagerly.
declare function customFonts(options: CustomFontsOptions): CustomFontsResolver;defaultChromeGroupsfunctionSource ↗
The groups of the DEFAULT toolbar arrangement, in bar order: every group that is not contextual. This is the registry's default bar — undo/redo through the editing-mode picker — and what both adapters render when the host composes nothing. Contextual slots (image.*, table.insert, file.save) remain available for explicit composition.
declare function defaultChromeGroups(): readonly ChromeGroup[];defaultTableLabelfunctionSource ↗
The English label for a furniture-insertion control.
The FALLBACK, for a host that has not wired its own translator — adapters pass their useTranslation result instead so the control follows the app's locale.
declare function defaultTableLabel(key: TableInteractionLabelKey): string;deferFontsfunctionSource ↗
Load an origin's faces after the document first paints, instead of before.
The editor opens the document with the faces the other origins supply, then lays it out again when these arrive. Use it for faces that are large or slow to fetch. Leave an origin unwrapped to install its faces with the document's other waiting fonts: a large document (over about 512 KB of uncompressed content) waits up to 2 seconds for them before its first paint.
ts
const fonts = [packagedFonts(), deferFonts(myBrandFonts())];
A document export that receives this origin waits for its faces, so exported pages use them. The faces never change the configuration settings, such as defaultFont or maxFontBytes: those come from the origins that answer at once, so the document does not change its default font after it paints.
declare function deferFonts(origin: FontOrigin): MarkedFontResolver;defineFontResolverfunctionSource ↗
Mark a function as an on-demand [FontResolver](FontResolver).
Wrap every resolver you put in a fonts list — useFonts(...), useDocxSource's fonts option, composeFontOrigins. The fonts PROP needs no marking, because a function there is always a resolver; a list also accepts the older zero-argument loader form ({ fonts: defaultFonts }), and this is what keeps the two apart.
Returns the same function object, mutated, so the mark survives being passed around and a marked resolver stays === to itself. It does NOT survive .bind() or being wrapped: both make a new function object. Re-mark the result.
ts
const brandFonts = defineFontResolver(async ({ families }) => ({
sources: await loadMine(families),
}));
Throws a TypeError on a frozen or sealed function, which cannot take the mark. That is deliberate: returning it unmarked would compile — the return TYPE says marked — and then lose every font at runtime.
declare function defineFontResolver<T extends FontResolver>(resolve: T): MarkedFontResolver<T>;disposeLayoutShapingfunctionSource ↗
Release native resources held by a shaping environment.
declare function disposeLayoutShaping(shaping: LayoutShapingOptions): void;dragIndentfunctionSource ↗
The indent a drag of handle to positionTwips produces.
Clamps differ from the MARGIN drags this ruler also carries, and deliberately:
- Indents may go NEGATIVE, pulling text into the margin, which Word allows. The floor is the sheet edge, not the margin. - There is no minimum text width. The 720-twip floor the margin drags use mirrors an engine refusal that does not exist for indents, and enforcing one here would make a narrow pull-quote unreachable. Left and right markers may MEET; they may not cross. - The left box needs a first-line clamp of its own. It does not move firstLine, so on a hanging paragraph dragging the box left can push the first-line marker off the sheet while the box itself is still in range. The drag stops when the LEADING marker lands.
declare function dragIndent(handle: RulerIndentHandle, positionTwips: number, indent: RulerIndent, page: RulerPageMetrics, options?: RulerDragOptions): RulerIndent;drawingPreviewDocxfunctionSource ↗
A small DOCX that holds one drawing from the editor's current document, including unsaved edits, for an external renderer. It equals createDrawingPreviewPackage on the document as a save would write it now; see that function for the page and renderer rules.
Pass an occurrence that an UnsupportedElement component receives, and the editor from useDocxEditor(), returning early on null. The call is synchronous and serializes the drawing's parts: make it in an effect keyed on element.source, not during render, and spread out or queue the calls when there are many drawings. By default a package copies at most 64 parts and 64 MiB; pass limits to change that.
declare function drawingPreviewDocx(editor: DocxEditorInstance, element: Pick<UnsupportedElement, 'ownerPartName' | 'nodeId'>, limits?: DrawingPreviewPackageLimits): DrawingPreviewPackageResult;editorHostDocumentfunctionSource ↗
The document editor is mounted in: a pop-out window's or an iframe's when it is attached there. While the editor is detached, the script's own document.
Use it in custom chrome that is not inside the editor's own DOM, such as a toolbar popover, to add document listeners and to read focus.
declare function editorHostDocument(editor: Editor): Document;```ts
const doc = editorHostDocument(editor);
doc.addEventListener('keydown', onShortcut);
```editorHostElementfunctionSource ↗
The element editor is mounted in, or null while it is detached or headless.
Use it to tell which editor an event belongs to when several share a window.
declare function editorHostElement(editor: Editor): Element | null;```ts
const mine = editorHostElement(editor)?.contains(event.target as Node) ?? false;
```editorHostWindowfunctionSource ↗
The window editor is mounted in: its timers, frames, viewport size and clipboard. While the editor is detached, the script's own window.
declare function editorHostWindow(editor: Editor): HostWindow;```ts
const win = editorHostWindow(editor);
await win.navigator.clipboard.writeText(text);
```emuToOverlayPointsfunctionSource ↗
EMU to points. Unrounded, so overlay geometry keeps sub-point precision during a drag.
declare function emuToOverlayPoints(emu: number): number;equationAtPositionfunctionSource ↗
Boundary-inclusive lookup, matching the hyperlink and field atom popovers.
declare function equationAtPosition(equations: readonly SurfaceEquation[], position: SemanticPosition): SurfaceEquation | null;executeImageCommandfunctionSource ↗
Run an insert or replace, re-checking the same gates [canExecuteImageCommand](canExecuteImageCommand) applies.
Async because image bytes must be decoded to derive their natural extent before the drawing can be projected — the one editor command that cannot complete synchronously. It runs outside exec, so it reports a refusal to the editor's diagnostics itself.
declare function executeImageCommand(editor: DocxEditorInstance, command: Extract<EditorCommand, {
type: 'insertImage' | 'replaceImage';
}>): Promise<ExecResult>;finalizeImageOverlayInteractionfunctionSource ↗
Recompute the committed overlay result from release pointer coordinates.
declare function finalizeImageOverlayInteraction(options: {
readonly session: ImageInteractionSession;
readonly deltaXPt: number;
readonly deltaYPt: number;
readonly accumulatedScrollPt: number;
readonly aspectLocked: boolean;
readonly shiftKey: boolean;
readonly textbox?: boolean;
readonly anchorFrameOrigin: AnchorFrameOrigin | null;
}): FinalizedImageOverlayInteraction;firstDayOfWeekfunctionSource ↗
First day of the week for a locale, as Date#getDay counts it (0 = Sunday).
Asks the runtime's week data when it has any, and otherwise falls back to a region table so a server without ICU week info still starts a US calendar on Sunday.
declare function firstDayOfWeek(locale?: string): number;focusCompareDocumentsControlfunctionSource ↗
Move focus to the control that is useful at moment in a Compare documents dialog:
- busy: a compare started and Compare is disabled. Cancel when it stays enabled (a background compare), else the busy status, else the dialog itself. - refused: a compare was refused, or the file could not be read. The file input. - unchanged: the documents have no differences. Compare, else the file input.
The dialog's controls carry data-docx-part markers (cancel, apply) and the file field data-docx-field="revised". Focus never moves out of dialog.
declare function focusCompareDocumentsControl(dialog: HTMLElement | null | undefined, moment: 'busy' | 'refused' | 'unchanged'): void;formatInchesfunctionSource ↗
Inches for DISPLAY, in the BROWSER's number format.
0.5 and 0,5 are the same measurement, and roughly half the locales this ships with write the second one. Interpolating a raw Number into a string picks the first for everyone. The catalogue supplies the surrounding words; this supplies the number.
Not the editor's locale: nothing in the i18n layer exposes one to read, so a German editor in an American browser still renders 0.5. The browser's guess beats a hardcoded . for every reader whose browser matches their language, which is most of them.
formatInches: (twips: number) => stringformattingBarChromeGroupsfunctionSource ↗
The formatting-bar groups for one editor snapshot: the default bar, the contextual image group when a drawing is selected, and the direction group when options.direction asks. Insertion without a selection lives in the packaged Insert menu (CHROME_MENUS), not in the bar — a host that wants a bar button places DocxEditor.Toolbar.ImageInsert itself.
declare function formattingBarChromeGroups(image: ImageContext | null, options?: FormattingBarOptions): readonly ChromeGroup[];generateRulerTicksfunctionSource ↗
Ticks across one page dimension, matching the legacy cadence: eighth-inch minors with labelled inches, or millimetre minors with labelled centimetres.
declare function generateRulerTicks(lengthPx: number, unit: RulerUnit): RulerTick[];goToBookmarkGroupsfunctionSource ↗
The rows of a Go To list grouped by place: the main text, then headers, footers, footnotes and endnotes. Places with no row are left out. Rows keep their order within a place.
declare function goToBookmarkGroups(rows: readonly BookmarkSummary[]): readonly GoToBookmarkGroup[];goToBookmarkMatchfunctionSource ↗
Where the typed text sits in a bookmark name, compared without case, for showing the match. Null when the text is empty or the name does not contain it.
declare function goToBookmarkMatch(name: string, query: string): {
readonly start: number;
readonly end: number;
} | null;goToBookmarkRowsfunctionSource ↗
The bookmarks a Go To name box offers for what was typed: those whose name contains it, compared without case, in the dialog's order. Names that start with it come first. An empty query offers every row. Sorted by location, the rows are in the order [goToBookmarkGroups](goToBookmarkGroups) shows them: by place first, so moving through the list follows the screen.
declare function goToBookmarkRows(bookmarks: readonly BookmarkSummary[], options: {
readonly query: string;
readonly sortBy: BookmarkSortOrder;
readonly showHidden: boolean;
}): readonly BookmarkSummary[];goToBookmarkTargetfunctionSource ↗
The bookmark a Go To name box means: the one whose name equals what was typed, compared without case, hidden or not; else the first row offered. Null when there is none.
declare function goToBookmarkTarget(bookmarks: readonly BookmarkSummary[], query: string, offered: readonly BookmarkSummary[]): BookmarkSummary | null;handlePositionfunctionSource ↗
Where a handle sits, in twips from the page's LEFT SHEET EDGE (not the margin).
With indent.rtl, indent.left is the leading indent and sits on the right margin.
declare function handlePosition(handle: RulerIndentHandle, indent: RulerIndent, page: RulerPageMetrics): number;historyShortcutOffunctionSource ↗
Which history step a keydown asks for, or null for any other key.
Ctrl+Y is the Windows redo; Ctrl/Cmd+Shift+Z is the macOS one. Both are accepted on every platform. Focused chrome, such as the picture selection overlay, calls this so history keys reach the editor instead of stopping at the control that holds focus.
declare function historyShortcutOf(event: HistoryShortcutKeys): 'undo' | 'redo' | null;hostDocumentOffunctionSource ↗
The document that owns node, or the script's own document when node is absent. Without a DOM (server rendering) and without a node, this is undefined despite its type: call it from effects and event handlers, not during render.
Use it to add document-level listeners (selectionchange, pointerup, keydown) and to read activeElement for an editor that may live in another window.
declare function hostDocumentOf(node: Node | null | undefined): Document;```ts
const doc = hostDocumentOf(menuElement);
doc.addEventListener('pointerdown', onOutsidePress, true);
```hostTimersfunctionSource ↗
[HostTimers](HostTimers) bound to whatever window node() lives in when each call runs.
Use it for debounces and frames in chrome that can end up in a pop-out window: the opener's timers are throttled while it is hidden, and a pop-out's never run once it closes.
declare function hostTimers(node: () => Node | null | undefined): HostTimers;```ts
const timers = hostTimers(() => panelElement);
let pending: number | null = null;
function schedule() {
timers.clearTimeout(pending);
pending = timers.setTimeout(refresh, 150);
}
```
A window that goes away (a pop-out the user closes) never runs what is pending in it, and a dropped commit, notification or search is worse than a late one. So each window with pending work is watched for `pagehide`, and its pending timers and frames move to the window the node lives in by then, or to the script's own window.hostWindowOffunctionSource ↗
The window that owns node: its timers, animation frames, observers and viewport size.
Falls back to the script's own window when the node's document has no window (an inert document from DOMParser, or a window that closed), and to globalThis without a DOM.
declare function hostWindowOf(node: Node | null | undefined): HostWindow;```ts
const win = hostWindowOf(anchorElement);
const handle = win.setTimeout(close, 300);
const maxX = win.innerWidth - menuWidth;
```inchesToTwipsfunctionSource ↗
inchesToTwips: (inches: number) => numberinitialChromePrintSettingsfunctionSource ↗
The settings a print form starts with: the editor's current display mode, with comments shown, as the PDF converter does by default. All Markup prints comments in a pane beside each page. The other modes print them as PDF annotations on the commented text.
declare function initialChromePrintSettings(snapshot: Pick<EditorSnapshot, 'reviewDisplayMode'> | null | undefined): ResolvedChromePrintSettings;initialSplitCellCountsfunctionSource ↗
The counts a Split cells dialog opens with: two columns, else two rows, else as many rows as a merged cell spans, whichever the engine honours first.
declare function initialSplitCellCounts(limits: SplitCellLimits | null, can: (command: Extract<EditorCommand, {
type: 'splitCell';
}>) => CanResult): {
readonly columns: string;
readonly rows: string;
};isChromePrintShortcutfunctionSource ↗
True for the print shortcut: Cmd+P on Apple platforms, Ctrl+P elsewhere. On macOS, Ctrl+P moves the caret to the previous line, so it is not a print shortcut there. The P key matches by code too when it types no Latin letter, as on Cyrillic or Hebrew layouts.
declare function isChromePrintShortcut(event: KeyboardEvent): boolean;isDomNodefunctionSource ↗
Whether value is a DOM node of any window.
declare function isDomNode(value: unknown): value is Node;```ts
if (isDomNode(event.target) && panel.contains(event.target)) return;
```isElementNodefunctionSource ↗
Whether value is a DOM element of any window. Use it instead of instanceof Element, which is false for an element of a pop-out window or an iframe.
declare function isElementNode(value: unknown): value is Element;```ts
if (isElementNode(event.target)) event.target.closest('[data-docx-hf]');
```isFontResolverfunctionSource ↗
Whether a value is a function marked by [defineFontResolver](defineFontResolver).
False for an unmarked function, which callers read as a zero-argument loader. Calling a resolver that way reads request.defaultFamily off undefined and throws, so the callers that make this choice say so rather than swallowing it — and the type-level mark on [MarkedFontResolver](MarkedFontResolver) is there to stop it reaching runtime at all.
declare function isFontResolver(value: unknown): value is MarkedFontResolver;isGoToChordfunctionSource ↗
The Go To chord: Ctrl+G, or Cmd+Option+G on Apple platforms. F5 is not used: browsers reload on it. Cmd+G alone is left to the browser's find-next on macOS.
declare function isGoToChord(event: KeyboardEvent, apple?: boolean): boolean;isHTMLElementNodefunctionSource ↗
Whether value is an HTML (not SVG or MathML) element of any window.
declare function isHTMLElementNode(value: unknown): value is HTMLElement;```ts
if (isHTMLElementNode(event.target)) event.target.focus();
```isInputEventfunctionSource ↗
Whether event is an input or beforeinput event, from any window.
declare function isInputEvent(event: Event): event is InputEvent;```ts
if (isInputEvent(event) && event.inputType === 'insertText') track(event.data);
```isKeyboardEventfunctionSource ↗
Whether event is a keyboard event, from any window.
declare function isKeyboardEvent(event: Event): event is KeyboardEvent;```ts
if (isKeyboardEvent(event) && event.key === 'Escape') close();
```isMouseEventfunctionSource ↗
Whether event is a mouse (or pointer) event, from any window.
declare function isMouseEvent(event: Event): event is MouseEvent;```ts
const point = isMouseEvent(event) ? { x: event.clientX, y: event.clientY } : null;
```isoDateOffunctionSource ↗
Format a local date as YYYY-MM-DD.
declare function isoDateOf(date: Date): string;isPointerEventfunctionSource ↗
Whether event is a pointer event, from any window.
declare function isPointerEvent(event: Event): event is PointerEvent;```ts
if (isPointerEvent(event) && event.button !== 0) return;
```isStaleImageInteractionCommitfunctionSource ↗
Whether a drag's commit should be refused because the document moved under it — the refusal to return, or null when the commit is still valid.
Checks the mount generation and both revisions captured by [captureImageMutationPreconditions](captureImageMutationPreconditions). A gesture spans many frames, so this is the one place that decides its coordinates still describe the document they were measured against.
declare function isStaleImageInteractionCommit(editor: Pick<DocxEditorInstance, 'surface' | 'mountGeneration'>, session: ImageInteractionSession): ExecResult | null;isTableChromeSlotfunctionSource ↗
Whether a chrome slot is one of the table-only ones. Narrows the type.
declare function isTableChromeSlot(slot: ChromeSlotId): slot is TableChromeSlotId;isTextNodefunctionSource ↗
Whether value is a DOM text node of any window.
declare function isTextNode(value: unknown): value is Text;```ts
const anchor = selection.anchorNode;
const element = isTextNode(anchor) ? anchor.parentElement : anchor;
```layoutPointsToCssPixelsfunctionSource ↗
Layout points to CSS pixels. Pair with [surfacePaintScale](surfacePaintScale) for the current zoom.
declare function layoutPointsToCssPixels(points: number, paintScale: number): number;lineSpacingMenuRowLabelfunctionSource ↗
A row's visible label, with its number in locale's format (1,5 in German).
label resolves an i18n key without interpolation, as a toolbar's host translation does, so the {value} placeholder is filled here. Without a locale the number reads as text does.
declare function lineSpacingMenuRowLabel(row: LineSpacingMenuRow, label: (key: string) => string, locale?: string): string;lineSpacingMenuRowsfunctionSource ↗
The line-spacing menu rows for the spacing in force.
A current multiple that is not a preset joins the list in order, ticked; a current exact or atLeast leads the list as its own ticked row. A selection whose paragraphs disagree (current null) ticks nothing, because no one row is true of all of it.
declare function lineSpacingMenuRows(current: SurfaceFormatting['lineSpacing']): readonly LineSpacingMenuRow[];loadFontsfunctionSource ↗
Fetch app-specified font URLs into verified, cache-backed FontSources.
Fetches ONLY the URLs listed — never a default host or engine-chosen CDN — and never rejects for a per-source failure: the result carries every admitted source and a typed entry for every drop. Cancellation instead rejects with signal.reason. Compose the result with composeFontConfiguration.
declare function loadFonts(request: LoadFontsRequest): Promise<LoadFontsResult>;lowerColorValueForBorderfunctionSource ↗
Lower a public colour for table border ops. Theme colours require a resolved literal for paint; auto preserves OOXML automatic semantics with a black render fallback.
declare function lowerColorValueForBorder(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;lowerColorValueForFillfunctionSource ↗
Lower a public colour for cell fill. auto refuses because the cascade literal cannot be named honestly at commit time.
declare function lowerColorValueForFill(color: ColorValue, themeColors: readonly DocumentThemeColorEntry[]): ColorLowerResult;mixedFieldsOffunctionSource ↗
A checkbox over a setting the selection disagrees about is INDETERMINATE, not unchecked — unchecked would claim the paragraphs agree it is off. The read reports null for exactly this, and a control that collapses it to a boolean throws the distinction away.
declare function mixedFieldsOf(format: ParagraphFormatRead): ParagraphDialogMixed;mountPaginatedSurfacefunctionSource ↗
Mount a paginated surface over DOCX bytes.
Returns a typed rejection rather than throwing: a failure here is a property of the file, and a host must be able to tell "not a package" from "no body" without parsing an error message.
declare function mountPaginatedSurface(container: HTMLElement, bytes: Uint8Array, options?: PaginatedSurfaceOptions): OpenPaginatedResult;observeContentControlPopupfunctionSource ↗
Follow scrolling, zoom, and size changes. Call the returned cleanup when the popup closes.
declare function observeContentControlPopup(panel: HTMLElement, anchor: HTMLElement): () => void;observeUnsupportedElementsfunctionSource ↗
Observe placeholder mounts across repaint, pagination, and document replacement. The returned function disconnects the observer. Component mutations do not publish another list unless the engine's mount points change.
declare function observeUnsupportedElements(container: HTMLElement, listener: (hosts: readonly UnsupportedElementHost[]) => void): () => void;openEditorWindowfunctionSource ↗
Open a pop-out window ready for the editor: same origin, styled like this page, with an empty mount point that fills it.
Resolves to null when the browser blocks the window, so call it from a user gesture such as a button click. The React DocxEditor.Window and Vue DocxEditorWindow components use it; call it directly when you mount the editor without an adapter.
declare function openEditorWindow(options?: OpenEditorWindowOptions): Promise<EditorWindow | null>;```ts
const popup = await openEditorWindow({ title: 'Contract' });
if (popup) {
editor.attach(popup.element);
popup.onClose(() => editor.attach(homeElement));
}
```overlayFrameToSheetCssPixelsfunctionSource ↗
Page-content frame → sheet-space CSS pixels (matches paintSelectionOverlay).
declare function overlayFrameToSheetCssPixels(layout: SemanticLayout, frame: OverlayFrameRect, coordinates: SurfaceOverlayCoordinates): {
readonly left: number;
readonly top: number;
readonly width: number;
readonly height: number;
};overlayHostOriginfunctionSource ↗
Where the painted surface's box begins inside overlay chrome's containing block, in CSS pixels.
[overlayFrameToSheetCssPixels](overlayFrameToSheetCssPixels) produces coordinates relative to the surface element — the box the pages paint into — but overlay chrome portals OUTSIDE that element, and its absolutely positioned pieces resolve against the nearest positioned ancestor. The surface centres itself inside that ancestor with a stylesheet margin, so a frame placed without this origin lands at the far left of the viewport, one full centring margin off the image it rings. offsetLeft/offsetTop measure against the same positioned ancestor the chrome resolves against — every element between the two is static — which is what makes the two spaces agree.
declare function overlayHostOrigin(surfaceElement: HTMLElement | null): {
readonly left: number;
readonly top: number;
};parseIsoDatefunctionSource ↗
Parse the leading YYYY-MM-DD of an ISO value as a LOCAL date, or null.
A control's w:fullDate is YYYY-MM-DDT00:00:00Z; only its calendar date matters here, and reading it through Date in a western time zone would show the previous day.
declare function parseIsoDate(value: string): Date | null;partOfNodeIdfunctionSource ↗
The part a NODE lives in, WITHOUT opening a story store.
session.partFor(scope) resolves a scope by opening that story's store, and an open store is retained for as long as its part is in the package. The cap is 64. So routing a pure READ — "is this control locked", "what is its tab index" — through partFor spent a permanent slot per part touched, and an id naming no node at all still spent one, because the part name is matched from the id's prefix before anything is looked up. Sixty-four such reads and no further header could be opened for the rest of the session, silently.
Read straight from the live package instead. Ids carry the canonical part name, so this is a map lookup.
A collaboration session names the nodes it creates by logical id, which carries no part name. Those ids are looked up in each story part's node index, which opens no story store either. A view without storyParts has no session ids, so it answers null for them.
declare function partOfNodeId(session: Pick<TreeDocxSessionView, 'currentPackage' | 'part'> & Partial<Pick<TreeDocxSessionView, 'storyParts'>>, nodeId: string | undefined): OoxmlPart | null;pointsToEmufunctionSource ↗
Points to EMU, rounded — EMUs are integral in the file.
declare function pointsToEmu(points: number): number;positionContentControlPopupfunctionSource ↗
Place a popup against an anchor, within the viewport or its visible sheet.
declare function positionContentControlPopup(panel: HTMLElement, anchor: HTMLElement): void;positionInputFromPropertiesCommandfunctionSource ↗
Extract the position input from an image-properties command, or null when it carries none.
declare function positionInputFromPropertiesCommand(command: {
readonly horizontalEmu?: number;
readonly verticalEmu?: number;
readonly relativeToH?: string;
readonly relativeToV?: string;
}, selected: {
readonly position?: DrawingPositionInput | null;
} | null): DrawingPositionInput;probeTableChromeCommandfunctionSource ↗
Probe command for Editor.can — uses the draft's active target and a well-formed value.
declare function probeTableChromeCommand(slot: TableChromeSlotId, draft?: TableChromeDraft): EditorCommand | null;propertiesCommandHasPositionFieldsfunctionSource ↗
Whether an image-properties command carries any positioning fields at all.
declare function propertiesCommandHasPositionFields(command: {
readonly horizontalEmu?: number;
readonly verticalEmu?: number;
readonly relativeToH?: string;
readonly relativeToV?: string;
}): boolean;readSplitCellCountsfunctionSource ↗
Read the typed column and row counts of a Split cells dialog.
declare function readSplitCellCounts(columns: string, rows: string, limits: SplitCellLimits | null): SplitCellCounts;reportAutomationExceptionfunctionSource ↗
Report an editing API batch that threw an engine error, not a refusal, into the diagnostics of the editor it ran on: edit.internal-invariant with the error's class, never its message. Does nothing for an object that is not an editor.
declare function reportAutomationException(editor: object, error: unknown, tracked: boolean): void;reportAutomationRefusalfunctionSource ↗
Report a refused editing API batch into the diagnostics of the editor it ran on. A runtime from DocxEditor.createBrowser calls this, so its refusals reach the editor's telemetry. Does nothing for an object that is not an editor. cause is the engine reason behind the refusal; a value the engine does not know is left out of the diagnostic.
declare function reportAutomationRefusal(editor: object, code: EditDiagnosticCode, tracked: boolean, cause?: string): void;reportAutomationReviewSkipfunctionSource ↗
Report a tracked-change decision an editing API batch refused into the diagnostics of the editor it ran on, as one review.skipped event. cause is the structure behind the skip; a value the engine does not know is left out. Does nothing for an object that is not an editor.
declare function reportAutomationReviewSkip(editor: object, code: ReviewDiagnosticCode, operation?: ReviewOperation, cause?: string): void;resizePreservesAspectfunctionSource ↗
Whether this handle drag should preserve aspect ratio.
declare function resizePreservesAspect(handle: ImageResizeHandle, aspectLocked: boolean, shiftKey: boolean, textbox?: boolean): boolean;resolveColorValueToCssfunctionSource ↗
Resolve any public colour to a CSS #RRGGBB string for chrome display.
declare function resolveColorValueToCss(color: ColorValue | undefined | null, themeColors: readonly DocumentThemeColorEntry[], defaultHex?: string): string;resolveEditorModulesfunctionSource ↗
Resolve construction-time modules into the registry the instance dispatches over.
declare function resolveEditorModules(modules: readonly EditorModule[] | undefined): EditorModuleRegistry;resolveImageResourceLimitsfunctionSource ↗
Resolve caller overrides into frozen image limits; hard ceilings cannot be raised.
declare function resolveImageResourceLimits(overrides?: Partial<ImageResourceLimits>): ImageResourceLimits;resolveReviewPanefunctionSource ↗
Merge options over base. Throws a TypeError for an unknown field or value, so a misspelled setting fails loudly instead of being ignored. Returns base itself when nothing changes, so the snapshot keeps its reference.
declare function resolveReviewPane(options: ReviewPaneOptions | undefined, base?: ResolvedReviewPane): ResolvedReviewPane;resolveRevisionMarkupfunctionSource ↗
Validate and merge preferences without modifying the input.
declare function resolveRevisionMarkup(input?: RevisionMarkupOptions, previous?: ResolvedRevisionMarkup): ResolvedRevisionMarkup;resolveSvgIntrinsicSizefunctionSource ↗
Intrinsic size of an SVG, resolved the way a browser sizes one: absolute width/height first, then viewBox for the missing axis or ratio, then the CSS 300x150 default.
This is metadata for insert and reset-to-natural-size only. Layout uses the authored wp:extent and the browser rasterizes into that box, so nothing here sizes an allocation and an out-of-range value is clamped rather than refused.
declare function resolveSvgIntrinsicSize(bytes: Uint8Array, limits: ImageResourceLimits): ValidatedRasterHeader | null;resolveThemeColorHexfunctionSource ↗
Resolve a theme colour to literal hex. When both tint and shade are present, ECMA-376 §17.3.2.6 / §17.3.4 / §17.3.5 require tint precedence — shade is ignored for paint.
declare function resolveThemeColorHex(color: Extract<ColorValue, {
kind: 'theme';
}>, themeColors: readonly DocumentThemeColorEntry[]): {
ok: true;
hex: string;
} | {
ok: false;
reason: string;
};resolveZoomModefunctionSource ↗
Normalize the 'auto' shorthand a host may pass anywhere a [ZoomMode](ZoomMode) is accepted.
Returns null for a value that is neither, so callers refuse rather than silently substituting a mode the caller did not ask for.
declare function resolveZoomMode(mode: ZoomMode | 'auto'): ZoomMode | null;reviewPaneListsItemfunctionSource ↗
Whether the review pane lists a card for item under revisionsIn.
With 'balloons', a balloon at the text shows every tracked change and every comment that replies to a tracked change, so the pane lists neither. Give the item as an unfiltered getReviewItems() read returns it: a query that excludes revision kinds removes parentRevisionId from replies to the changes it drops.
The engine applies this rule to every review item when it decides whether the pane opens by itself or closes after a settings change. A review pane must apply the same rule before its own filters, such as a hidden kind or a host filter. Those filters can hide every card, and then the pane that the engine opens is empty.
declare function reviewPaneListsItem(revisionsIn: RevisionDisplay, item: ReviewPaneItemFields): boolean;rulerMarginTicksfunctionSource ↗
Horizontal ruler ticks counted from the margin the paragraph starts at: the left margin, or the right margin when indent.rtl is set. Labels count whole units outward on both sides, so the margin zone also reads 1, 2, and so on toward the sheet edge.
declare function rulerMarginTicks(page: RulerPageMetrics, indent: Pick<RulerIndent, 'rtl'>, unit: RulerUnit): RulerMarginTick[];rulerPageBoxfunctionSource ↗
The first page's box, which the rulers measure against.
declare function rulerPageBox(pages: readonly {
readonly index: number;
readonly box: {
width: number;
height: number;
};
}[]): {
width: number;
height: number;
} | null;rulerTabPositionfunctionSource ↗
Where a tab stop sits, in twips from the page's left sheet edge. tabTwips counts from the paragraph's leading margin, as w:tab/@w:pos does: leftward from the right margin when indent.rtl is set.
declare function rulerTabPosition(tabTwips: number, page: RulerPageMetrics, indent: Pick<RulerIndent, 'rtl'>): number;runChromeExportfunctionSource ↗
Saves the current document and converts those bytes through the configured handler. Missing handlers fail before saving. Conversion never changes the editor document. settings overrides the captured view for PDF conversion, such as print settings.
declare function runChromeExport(editor: Pick<Editor, 'save'> & Partial<Pick<DocxEditorInstance, 'snapshot' | 'getReviewAuthors'>>, format: ChromeExportFormat, handlers?: ChromeExportHandlers, settings?: ChromePrintSettings): Promise<ChromeExportResult>;runChromePrintfunctionSource ↗
Saves the current document, converts it with the configured PDF handler, and prepares the result for printing. Uses the same handler and checks as File Export PDF, so a missing handler rejects with ChromeExportError before the document is saved. Saving commits pending form input and can refresh field results with an undo step. container receives the hidden print frame. For an editor inside a modal dialog, pass an element inside that dialog. settings carries the user's print settings, such as the display mode and whether comments print. Omitted settings keep the current view.
declare function runChromePrint(editor: Pick<Editor, 'save'> & Partial<Pick<DocxEditorInstance, 'snapshot' | 'getReviewAuthors'>>, handlers?: ChromeExportHandlers, container?: Document | Element, settings?: ChromePrintSettings): Promise<ChromePrintJob>;runSavefunctionSource ↗
Save goes straight to Editor.save() — it is not a command.
declare function runSave(editor: Editor | null): Promise<ArrayBuffer>;runTableChromeCommandfunctionSource ↗
Run one table chrome pick with explicit draft state; returns the post-pick draft on success.
declare function runTableChromeCommand(editor: Editor | null, slot: TableChromeSlotId, value: unknown, draft: TableChromeDraft): RunTableChromeCommandResult;runTableCommandfunctionSource ↗
Run a table command: planner-backed can first, then exec only when allowed.
declare function runTableCommand(editor: Editor | null, command: EditorCommand, options?: EditorExecOptions): ExecResult;runToolbarCommandfunctionSource ↗
Run a toolbar control: can first, then exec only if it said yes. Returns the engine's refusal untouched when it said no, so a caller cannot mistake a declined command for a no-op.
declare function runToolbarCommand(editor: Editor | null, id: ChromeSlotId): ExecResult;runToolbarCommandfunctionSource ↗
declare function runToolbarCommand(editor: Editor | null, id: Exclude<ChromeSlotId, ToolbarValueSlot>, options: EditorExecOptions): ExecResult;runToolbarCommandfunctionSource ↗
declare function runToolbarCommand<K extends keyof ToolbarValueMap>(editor: Editor | null, id: K, value: ToolbarValueMap[NoInfer<K>], options?: EditorExecOptions): ExecResult;runToolbarCommandfunctionSource ↗
declare function runToolbarCommand(editor: Editor | null, id: TableChromeSlotId, value: unknown, options?: EditorExecOptions): ExecResult;runToolbarCommandfunctionSource ↗
declare function runToolbarCommand(editor: Editor | null, id: ChromeSlotId, value: undefined, options: EditorExecOptions): ExecResult;sameTabStopsfunctionSource ↗
Whether two stop lists say the same thing. A list needs more than reference equality. *
declare function sameTabStops(a: readonly ParagraphTabStop[], b: readonly ParagraphTabStop[]): boolean;sameZoomModefunctionSource ↗
Whether two modes say the same thing.
snapshotsEqual compares zoomMode by IDENTITY, and a host's zoomMode prop is an object — <DocxEditor zoomMode={{ type: 'fit', fit: 'pageWidth' }} /> is a fresh literal on every render, which is the spelling the docs show. Without a value comparison somewhere, each of those renders reinstalled the observer, refitted, bumped the tick, and re-rendered every useEditorState consumer in the tree — including the page selector that the slice memoization exists to keep asleep. The lane holds its object and compares by value here.
declare function sameZoomMode(a: ZoomMode, b: ZoomMode): boolean;seedFieldsfunctionSource ↗
Open the form on the selection.
A null field means the selection DISAGREES about that setting. There is no third checkbox state to show it with, so the control opens on the least surprising value and [changedFields](changedFields) keeps the disagreement alive by not writing what the user did not touch. widowControl opens ON because that is the Word default a document inherits when nothing says otherwise.
declare function seedFields(format: ParagraphFormatRead): ParagraphDialogFields;selectedDrawingOverlayTargetOffunctionSource ↗
The painted geometry of the selected drawing, for the resize/move overlay — or null.
Stricter than [selectedImageStateOf](selectedImageStateOf): it also requires a COLLAPSED selection, because a range that merely contains a drawing is a text selection, and drawing handles over it would claim an object the user did not single out.
declare function selectedDrawingOverlayTargetOf(surface: PaginatedSurface | null): SelectedDrawingOverlayTarget | null;selectedImageStateOffunctionSource ↗
The selected image and what may be done to it, or null when nothing image-like is selected.
Unsupported placeholders, hidden drawings, and select-locked drawings cannot be selected.
declare function selectedImageStateOf(surface: PaginatedSurface | null): SelectedImageState | null;shiftMonthfunctionSource ↗
The month after or before (year, month), wrapping the year.
declare function shiftMonth(year: number, month: number, delta: 1 | -1): {
readonly year: number;
readonly month: number;
};signedFirstLineOffunctionSource ↗
Fold the "Special" pair back into the ONE signed value the engine takes. *
signedFirstLineOf: (kind: SpecialIndent, magnitudeTwips: number) => numbersnapTwipsfunctionSource ↗
Round to the ruler's grid, or to the twip when the drag is precise.
declare function snapTwips(value: number, unit: RulerUnit, precise: boolean): number;sniffImageMimefunctionSource ↗
Signature sniffing — authoritative over declared content type.
declare function sniffImageMime(bytes: Uint8Array): RenderableImageMime | PreservedImageMime | 'unknown';sourceCropFromCropPercentfunctionSource ↗
UI percent (0–100) → projection fraction (0–1).
declare function sourceCropFromCropPercent(crop: ImageCropPercent): SourceCrop;specialOffunctionSource ↗
specialOf: (signedTwips: number | null) => SpecialIndentstoryLabelTopfunctionSource ↗
Where to place the label bar of an open header, footer, or note, in viewport pixels.
The bar sits just above its story. A story with no room above it on its sheet, such as a header that starts at the paper edge, takes the bar just below it instead, so the bar never covers the gap between sheets or the ruler.
declare function storyLabelTop(storyRect: {
readonly top: number;
readonly bottom: number;
}, sheetTop: number | undefined, barHeight: number, clearance: number): number;```ts
const top = storyLabelTop(band.getBoundingClientRect(), sheet.getBoundingClientRect().top, 28, 6);
```surfaceExtentfunctionSource ↗
declare function surfaceExtent(layout: SemanticLayout, materialize: ReadonlySet<number> | undefined): SurfaceExtent;surfacePaintScalefunctionSource ↗
Points → CSS pixels at the given zoom (matches mountPaginatedSurface / semantic paint).
declare function surfacePaintScale(zoom: number): number;tableChromeIconPathsfunctionSource ↗
Material Symbol paths for one table chrome icon name.
declare function tableChromeIconPaths(name: keyof typeof GENERATED_ICON_PATHS): readonly string[];tableChromeLabelKeyForTargetfunctionSource ↗
The i18n key naming one border target, for a trigger that shows the active scope.
Falls back to the "all" key rather than throwing: a label is chrome, and a missing one should not take the toolbar down.
declare function tableChromeLabelKeyForTarget(target: TableBorderEdgeTarget): string;tableChromeToolbarStatefunctionSource ↗
Enabled state for one table chrome slot using explicit draft state.
declare function tableChromeToolbarState(editor: Editor | null, slot: TableChromeSlotId, draft?: TableChromeDraft): ToolbarCommandState;tableChromeVisiblefunctionSource ↗
Contextual table chrome is visible when the engine reports table context.
declare function tableChromeVisible(table: TableContext | null | undefined): boolean;tableCommandStatefunctionSource ↗
Planner-backed can/plan pair — production gate for table commands. Task 9 maps chrome slots.
declare function tableCommandState(command: EditorCommand, surface: PaginatedSurface): {
readonly can: CanResult;
readonly plan: TableCommandPlan;
};tableCommandToolbarStatefunctionSource ↗
Enabled state for a table command when the caller holds the paginated surface.
Uses the same planner-backed tableCommandState as Editor.can/gateTableCommand. Chrome slot mapping for table controls is Task 9 — this helper is the shared can-before-exec seam for arbitrary table commands.
declare function tableCommandToolbarState(surface: PaginatedSurface | null, command: EditorCommand): Pick<ToolbarCommandState, 'enabled' | 'disabledReason'>;textboxFrameReasonfunctionSource ↗
The message key saying why a selected text box frame takes no caret or offers no handles, or null when it does both. Not in viewing mode: viewing refuses the edit itself, so the box is not what stops it.
declare function textboxFrameReason(target: {
readonly textbox?: boolean;
readonly textEditable?: boolean;
readonly canMove: boolean;
readonly canResize: boolean;
}, editingMode: string): 'imageOverlay.textLocked' | 'imageOverlay.locked' | null;```ts
const key = textboxFrameReason(target, editor.surface!.editingMode());
const title = key ? t(key) : undefined;
```toEditorFontErrorfunctionSource ↗
declare function toEditorFontError(error: unknown): EditorFontError;toolbarCommandStatefunctionSource ↗
Ask the engine whether one control should be enabled.
declare function toolbarCommandState(editor: Editor | null, id: ChromeSlotId): ToolbarCommandState;toolbarCommandStatesfunctionSource ↗
Enabled state for several controls in one pass.
declare function toolbarCommandStates(editor: Editor | null, ids: readonly ChromeSlotId[]): readonly ToolbarCommandState[];trapTabWithinfunctionSource ↗
Keep Tab inside the dialog.
aria-modal tells assistive tech the rest of the page is inert; it does not stop Tab, so without this the third Tab lands on the document behind the dialog — which is the editable surface, so the next keystroke types into the paragraph being formatted.
Returns true when the event was handled, so a caller only has to call preventDefault.
declare function trapTabWithin(panel: HTMLElement, event: KeyboardEvent): boolean;twipsToInchesfunctionSource ↗
twipsToInches: (twips: number) => numberunsupportedElementRuleMatchesfunctionSource ↗
Whether a rule claims an occurrence. Adapters use it to pick the first matching declaration; hosts with their own registration can use it the same way.
declare function unsupportedElementRuleMatches(rule: UnsupportedElementRule, element: UnsupportedElement): boolean;validateDrawingPositionInputfunctionSource ↗
Validate a position input, refusing offsets or bases outside what OOXML allows.
declare function validateDrawingPositionInput(position: DrawingPositionInput): boolean;validateImageCropPercentfunctionSource ↗
Whether a crop is expressible: every edge finite and in range, and opposite edges not overlapping.
Opposite edges matter — a left plus right crop summing past 100% describes a negative width, which DrawingML has no way to store.
declare function validateImageCropPercent(crop: ImageCropPercent): boolean;validateRasterHeaderfunctionSource ↗
Validate a raster image's header structurally and report its real MIME type and extent.
Content type is a CLAIM; this is what makes it a fact. A file declaring image/png over JPEG bytes is caught here rather than at decode.
declare function validateRasterHeader(bytes: Uint8Array, mime: SupportedImageMime): ValidatedRasterHeader | null;validateSetImagePositionCommandfunctionSource ↗
Validate a set-position command before it reaches the store.
declare function validateSetImagePositionCommand(command: {
readonly horizontalEmu?: number;
readonly verticalEmu?: number;
readonly relativeToH?: string;
readonly relativeToV?: string;
}, mode: 'frame' | 'simple'): boolean;validateThemeModifierfunctionSource ↗
Clamp and validate an OOXML theme modifier fraction (0, 1].
declare function validateThemeModifier(value: unknown): value is number;watchHighlightsfunctionSource ↗
Highlight a named set and keep it current as the document changes.
declare function watchHighlights(editor: Editor, name: string, source: HighlightSource, options?: WatchHighlightsOptions): HighlightWatch;```ts
const glossary = watchHighlights(editor, 'glossary', (editor) =>
editor.findMatches(terms, { wholeWord: true }).flat()
);
// Later:
glossary.stop();
```watermarkShapeBoxfunctionSource ↗
The shape box, in points, that setWatermark writes for watermark on a page whose text area (page size less margins) is area. The box is centered on the text area, and a diagonal text box turns 45 degrees counterclockwise about its center. Null when the options name no text and no readable picture. Pass a measurer for the exact text advance; without one the advance is an estimate.
declare function watermarkShapeBox(watermark: Watermark, area: WatermarkSize, measurer?: TextMeasurer): WatermarkSize | null;```ts
const box = watermarkShapeBox({ text: 'DRAFT' }, { width: 468, height: 648 });
```withTabStopfunctionSource ↗
Add one stop, replacing any stop already at that position, and keep the list sorted. *
declare function withTabStop(stops: readonly ParagraphTabStop[], stop: ParagraphTabStop): readonly ParagraphTabStop[];Classes (3)
ChromeExportErrorclassSource ↗
An export has no configured converter.
declare class ChromeExportError extends Error| Member | Type | Summary |
|---|---|---|
| (constructor) | | Constructs a new instance of the `ChromeExportError` class |
| code | | |
| format | ChromeExportFormat |
ChromePrintErrorclassSource ↗
The browser could not print the converted PDF. The PDF at ChromePrintJob.url is still available, so the user can open it and print from the PDF viewer.
declare class ChromePrintError extends Error| Member | Type | Summary |
|---|---|---|
| (constructor) | | Constructs a new instance of the `ChromePrintError` class |
| code | ChromePrintErrorCode | Why the browser could not print. |
DocumentRefreshErrorclassSource ↗
A capture failure with a stable code. applyUpdate() failures use RefreshResult instead.
declare class DocumentRefreshError extends Error| Member | Type | Summary |
|---|---|---|
| (constructor) | | Constructs a new instance of the `DocumentRefreshError` class |
| code | RefreshFailureCode | Machine-readable reason. |
Interfaces (182)
AnchorFrameOrigininterfaceSource ↗
Where an anchored drawing's positioning frame begins, in layout points.
An anchored drawing's offsets are relative to a base the file names (page, margin, column, …), so a move drag needs that base's origin to turn a pointer delta into a stored offset.
interface AnchorFrameOrigin| Member | Type | Summary |
|---|---|---|
| x | number | |
| y | number |
AnchorHighlightAnimationinterfaceSource ↗
Opacity fade settings. Reduced motion limits fades to 125 milliseconds.
interface AnchorHighlightAnimation| Member | Type | Summary |
|---|---|---|
| durationMs? | number | Fade duration in milliseconds. Default: 180. Must be finite and between 0 and 10000. |
| easing? | string | CSS timing function for both fades. Defaults to --doc-motion-ease-out. This option does not accept CSS variables. |
| exitDurationMs? | number | Automatic and explicit exit fade duration. Defaults to durationMs. Range: 0 through 10000. |
AnchorHighlightOptionsinterfaceSource ↗
Presentation for temporary paragraph highlights. Each call starts from these defaults. Document refresh RefreshHighlightOptions extends this type, so one style object serves both.
interface AnchorHighlightOptions| Member | Type | Summary |
|---|---|---|
| animation? | boolean | AnchorHighlightAnimation | Default: true, a 180-millisecond fade. False disables motion. Repeated calls for the same paragraph do not restart the fade. |
| borderColor? | string | CSS border color. Defaults to color. Use an alpha color for a translucent border; opacity controls only the fill. |
| borderRadius? | number | Corner radius in CSS pixels at 100% zoom. Default: 6. Must be finite and nonnegative. |
| borderStyle? | 'solid' | 'dashed' | 'dotted' | Border pattern. Default: solid. |
| borderWidth? | number | Border width in CSS pixels at 100% zoom. Default: 0. Finite and nonnegative. |
| className? | string | Optional CSS classes for shadows or patterns. The editor controls highlight placement and size. |
| color? | string | CSS color, including var(). Default: a light blue theme token, var(--doc-anchor-highlight-color) for anchors and var(--doc-refresh-highlight-color) for refresh. |
| opacity? | number | Fill opacity, from 0 to 1. Default: 0.14. Does not change document text opacity. |
| padding? | number | Extra space on each edge, in CSS pixels at 100% zoom. Default: 4. Must be finite and nonnegative. |
| timeoutMs? | number | null | Milliseconds before dismissal starts. Default: 3000. Set `null` to keep highlights until you dismiss them. Maximum: 2147483647. |
AttachOptionsinterfaceSource ↗
How [DocxEditorInstance.attach](DocxEditorInstance.attach) moves an open document.
interface AttachOptions```ts
// Bring the editor home from a pop-out and keep typing there.
editor.attach(mainSlot, { focus: true });
```| Member | Type | Summary |
|---|---|---|
| focus? | boolean | Focus the pages after the move, so the caret shows and typing continues. Default: focus returns only when the pages had it before the move or the `detach()`. A first mount from bytes does not take focus. |
BlankDocumentOptionsinterfaceSource ↗
How a blank document starts.
interface BlankDocumentOptions| Member | Type | Summary |
|---|---|---|
| bidiLanguage? | string | The language of right-to-left and complex-script text, as a BCP 47 tag such as `ar-SA` or `he-IL`, written as the run defaults' `w:lang/@w:bidi`. Layout follows it: European digits in an Arabic-script language draw in the Latin face. A value that is not a language tag is ignored. |
| direction? | 'ltr' | 'rtl' | `'rtl'` starts the document right to left: its paragraphs (`w:bidi` in the paragraph defaults) and its section (`w:sectPr/w:bidi`) read right to left, as a new document does when a right-to-left editing language is the default. `'ltr'` is the default. |
BookmarkChromeHandlersinterfaceSource ↗
Host chrome for bookmarks.
interface BookmarkChromeHandlers| Member | Type | Summary |
|---|---|---|
| onRequest? | () => void | Open the Bookmark dialog for the selection: the `openBookmarkDialog` command, which the Insert menu row and Ctrl/Cmd+Shift+F5 send. |
BookmarkDialogNameStateinterfaceSource ↗
What the typed name allows in the Bookmark dialog.
interface BookmarkDialogNameState| Member | Type | Summary |
|---|---|---|
| canAdd | boolean | Add bookmarks the selection under the name; an existing bookmark moves. |
| canDelete | boolean | Delete and Go To act on an existing bookmark. |
| canGoTo | boolean | |
| existing | BookmarkSummary | null | The bookmark the name already belongs to, compared without case, or null. |
| problem | BookmarkNameProblem | null | Why Add cannot use the name, or null when it can. Hidden names cannot be added. |
BookmarkMarkInfointerfaceSource ↗
One painted bookmark mark, as BookmarkMarkOptions callbacks see it.
interface BookmarkMarkInfo| Member | Type | Summary |
|---|---|---|
| edge | 'start' | 'end' | 'point' | Which mark this is: the start bracket, the end bracket, or a point bookmark's I-beam. |
| name | string | The bookmark's name as the document writes it. |
| story | BookmarkStory | The story the bookmark is in. |
BookmarkMarkOptionsinterfaceSource ↗
How Show bookmarks paints its marks. Register with setBookmarkMarks.
interface BookmarkMarkOptions| Member | Type | Summary |
|---|---|---|
| decorate? | (element: HTMLElement, mark: BookmarkMarkInfo) => HTMLElement | void | Adjust each mark before it is placed: add a class, a `title` tooltip, or attributes. Return another element to replace the mark. The editor positions whatever comes back. Marks ignore the pointer; set `pointer-events: auto` on a mark that shows a tooltip. |
| include? | 'visible' | 'all' | ((bookmark: Omit<BookmarkMarkInfo, 'edge'>) => boolean) | Which bookmarks get marks: `'visible'` (the default) skips hidden bookmarks, `'all'` includes them, and a function decides per bookmark. |
| print? | boolean | Keep the marks when the browser prints the page. Exports never include them. |
BookmarkMarkOptionsSourceinterfaceSource ↗
The surface's view of the mark options.
interface BookmarkMarkOptionsSource| Member | Type | Summary |
|---|---|---|
| current | () => BookmarkMarkOptions | |
| onChange | (repaint: (() => void) | null) => void | Name the repaint to run when the options change. One slot: a remount replaces it. |
| reportError | (error: unknown) => void | Report an error a host callback threw while marks were painted. |
BrowserAutomationHostinterfaceSource ↗
An automation host over a live editor.
interface BrowserAutomationHost extends AutomationHostCalendarDayinterfaceSource ↗
One cell of a month grid.
interface CalendarDay| Member | Type | Summary |
|---|---|---|
| day | number | Day of the month, 1-based. |
| iso | string | Local calendar date as `YYYY-MM-DD`. |
| label | string | Accessible name, spelled out in the calendar locale. |
| otherMonth | boolean | The cell pads the grid from the previous or next month. |
| selected | boolean | The cell is the control's current value. |
| today | boolean | The cell is the current local date. |
CalendarMonthinterfaceSource ↗
A six-week month grid plus its labels.
interface CalendarMonth| Member | Type | Summary |
|---|---|---|
| days | readonly CalendarDay[] | Exactly 42 cells, so the pop-up keeps one height across months. |
| month | number | Zero-based, like `Date#getMonth`. |
| title | string | Month and year, formatted in the calendar locale. |
| weekdays | readonly string[] | Seven weekday labels, starting on the locale's first day of the week. |
| year | number |
CalendarMonthOptionsinterfaceSource ↗
Inputs for [calendarMonth](calendarMonth).
interface CalendarMonthOptions| Member | Type | Summary |
|---|---|---|
| locale? | string | BCP 47 tag; an unsupported tag falls back to `en-US`. |
| selected? | string | null | The control's current value as `YYYY-MM-DD`, or empty. |
| today? | Date | The reference "today"; defaults to the current local date. |
ChromeControlinterfaceSource ↗
One toolbar control as the registry describes it — what it renders as, never whether it is enabled.
Enabled state has exactly ONE source, toolbarCommandState, which asks the engine. A descriptor carrying its own disabled flag would be a second answer that goes stale the moment the engine wires the slot.
interface ChromeControl<Id extends string = string>| Member | Type | Summary |
|---|---|---|
| defaultToolbar? | false | `false` keeps this public slot composable but omits it from the default toolbar. |
| id | Id | Stable control id, unique WITHIN its group. Public API; renames are breaking. |
| labelKey | string | i18n key for the accessible name and tooltip. Never hardcoded English. |
| paths | readonly string[] | null | Material Symbols path data, or null for a non-icon control (a picker). |
| shape? | ChromeControlShape | How it renders. Defaults to `icon`. |
| state | ChromeControlState | |
| swatch? | string | Swatch colour for a `colorSplit` control. |
| valueKey? | string | For pickers: the i18n key of the placeholder value shown. |
| valueText? | string | Displayed value for a stepper or dropdown (an i18n key, or a literal for numbers). |
ChromeExportHandlersinterfaceSource ↗
Conversion handlers for File Export. Install the corresponding converter package. Use exportMarkdown for Markdown. PDF requires exportPdf on a Node.js server. Browser hosts supply a PDF handler that calls that server after the user selects Export.
interface ChromeExportHandlers| Member | Type | Summary |
|---|---|---|
| markdown? | (source: Uint8Array) => Promise<{
readonly markdown: string;
}> | Returns continuous document Markdown. Page output is not downloaded. |
| pdf? | (source: Uint8Array, view?: ChromeExportView) => Promise<{
readonly bytes: Uint8Array;
}> | Returns PDF bytes from `@docx-editor.dev/docx-to-pdf` on Node.js. |
ChromeExportResultinterfaceSource ↗
Download data from a completed conversion.
interface ChromeExportResult| Member | Type | Summary |
|---|---|---|
| bytes | Uint8Array | |
| extension | 'md' | 'pdf' | |
| mimeType | string |
ChromeExportViewinterfaceSource ↗
Viewer settings captured before PDF conversion.
interface ChromeExportView| Member | Type | Summary |
|---|---|---|
| comments? | boolean | Whether the PDF shows comments. Set from the print settings the user chose. Pass it to `exportPdf` as `comments`. Absent means the converter default, which shows comments. |
| displayMode | ReviewDisplayMode | |
| revisionAuthorSlots? | Readonly<Record<string, number>> | Stable session slots, including gaps left by removed authors. |
| revisionMarkup | ResolvedRevisionMarkup |
ChromeGroupinterfaceSource ↗
One toolbar group: the taxonomy both adapters derive their default arrangement FROM.
Never hand-list controls in an adapter — a default toolbar is built by walking CHROME_GROUPS, so a slot added here appears in React and Vue without either being edited.
interface ChromeGroup<Id extends string = string, ControlId extends string = string>| Member | Type | Summary |
|---|---|---|
| contextual? | true | Not part of the DEFAULT toolbar arrangement. The chrome spec shows these controls only in a context the engine does not model yet (an image or table selection), or not at all (save belongs in the host's File menu, never in the bar). Their slots stay public for composition — a host can still place `image.insert` or `file.save` explicitly — but the default chrome is the registry's default bar, which ends at the editing-mode picker. |
| controls | readonly ChromeControl<ControlId>[] | |
| id | Id | Stable group id. Public API; renames are breaking. |
| labelKey | string |
ChromeMenuinterfaceSource ↗
One menu of the menu bar.
interface ChromeMenu| Member | Type | Summary |
|---|---|---|
| entries | readonly ChromeMenuEntry[] | |
| id | ChromeMenuId | |
| labelKey | string |
ChromeMenuItemEntryinterfaceSource ↗
A row that runs one chrome slot.
interface ChromeMenuItemEntry| Member | Type | Summary |
|---|---|---|
| kind | 'item' | |
| labelKey? | string | Plain-label override for this row. |
| picker? | 'tableGrid' | The row opens a size PICKER instead of firing on click — Word's insert-table grid. The slot still owns the label, the icon and the enabled state; only the dispatch differs, and the picked size is what the host sends. |
| shortcutKey? | string | i18n key of the shortcut shown right-aligned on the row (`toolbar.saveShortcut`). |
| slot | ChromeSlotId |
ChromeMenuSeparatorEntryinterfaceSource ↗
A horizontal rule between groups of rows.
interface ChromeMenuSeparatorEntry| Member | Type | Summary |
|---|---|---|
| kind | 'separator' |
ChromeMenuSubmenuEntryinterfaceSource ↗
A row that opens a nested panel of rows (Insert › Break).
It carries its own label and icon rather than a slot, because a submenu PARENT has no command: clicking it opens the panel. Giving it a slot would mint a public id for a control that can never be enabled, and toolbarCommandState would have to invent an answer about it.
interface ChromeMenuSubmenuEntry| Member | Type | Summary |
|---|---|---|
| items | readonly ChromeMenuEntry[] | |
| kind | 'submenu' | |
| labelKey | string | |
| paths | readonly string[] | null |
ChromePrintJobinterfaceSource ↗
A converted PDF, ready for the browser print dialog. Call dispose() when the job ends: it removes the print frame and revokes url.
interface ChromePrintJob| Member | Type | Summary |
|---|---|---|
| dispose | | Removes the print frame and revokes `url`. Later `print()` calls reject. |
| Opens the browser print dialog for the PDF from a hidden frame. Rejects with `ChromePrintError` when the browser has no PDF viewer, the frame cannot load the PDF, or the job has ended. A browser without a PDF viewer would download the PDF instead of loading it, so the frame is not created in that case. | |
| url | string | An object URL for the PDF. It stays valid until `dispose()`. |
ChromePrintOptionsinterfaceSource ↗
Options for ChromePrintJob.print.
interface ChromePrintOptions| Member | Type | Summary |
|---|---|---|
| beforePrint? | () => void | Promise<void> | Runs after the PDF loads and before the print dialog opens. Close any modal dialog here: a modal dialog makes the rest of the page, including the print frame, inert. |
ChromePrintSettingsinterfaceSource ↗
Settings the user picks before printing. Each omitted setting keeps the editor's current view: the review display mode, and comments shown.
interface ChromePrintSettings| Member | Type | Summary |
|---|---|---|
| comments? | boolean | Whether the PDF shows comments. All Markup prints them in a pane beside each page; the other modes print them as annotations on the commented text. |
| displayMode? | ReviewDisplayMode | Which markup prints, as on the Review tab. |
ClearAnchorHighlightOptionsinterfaceSource ↗
Explicit highlight dismissal.
interface ClearAnchorHighlightOptions| Member | Type | Summary |
|---|---|---|
| animation? | boolean | AnchorHighlightAnimation | Defaults to the last highlight call's exit animation. False removes highlights immediately. |
CollaborationModuleContributioninterfaceSource ↗
What a collaboration module contributes: the replica the surface attaches.
interface CollaborationModuleContribution| Member | Type | Summary |
|---|---|---|
| session | EditorCollaborationSession | A ready session. The host creates the Yjs room, then wraps it with `collaborationModule({ session })`. |
CommentDraftChromeHandlersinterfaceSource ↗
Host chrome for comment drafts: the review rail, or the host's own comment UI.
interface CommentDraftChromeHandlers| Member | Type | Summary |
|---|---|---|
| onRequest? | () => void | Open a comment draft on the selection: the `review.addComment` control's press. The handler takes no arguments. It reads the selection with `getSelectionPlacement`, and can pin it with `retainSelection` while the draft is open. The most recent registration receives each request. |
CompareDocumentsChromeHandlersinterfaceSource ↗
Host rendering for the Compare documents dialog.
interface CompareDocumentsChromeHandlers| Member | Type | Summary |
|---|---|---|
| onRequest? | (session: CompareDocumentsDialogSession) => void |
CompareDocumentsDialoginterfaceSource ↗
Compare documents dialog supplied by the review module.
interface CompareDocumentsDialog| Member | Type | Summary |
|---|---|---|
| destroy | | |
| open | |
CompareDocumentsDialogHostinterfaceSource ↗
What the Compare documents dialog may use: its session, mount, and strings.
interface CompareDocumentsDialogHost extends CompareDocumentsDialogSession| Member | Type | Summary |
|---|---|---|
| container | HTMLElement | |
| translate? | (key: string) => string | undefined |
CompareDocumentsDialogSessioninterfaceSource ↗
One open Compare documents dialog. The editor owns it: the session aborts when the dialog closes, is replaced, or the document, mount, or editor goes away.
interface CompareDocumentsDialogSession| Member | Type | Summary |
|---|---|---|
| apply | | Compare the open document with the revised DOCX and record the differences in it as tracked changes, as one undoable step. Closes the session when the document changes. With no differences (`changed` false) or a refusal, the session stays open with a message to show. |
| canApply | | Whether a compare can run now. |
| cancel | | Close the dialog. A running background compare stops, and nothing changes. |
| cancelable | boolean | Whether `cancel()` can stop a running compare: true when compares run in the background. A compare that falls back to the main thread, because the worker never started, cannot stop. |
| defaultAuthor | string | The author name the dialog offers first: the editor's author, or an empty string. |
| originalHasTrackedChanges | boolean | Whether the open document has tracked changes when the dialog opens. The compare treats them as accepted, so a dialog says so before the user compares. |
| signal | AbortSignal | Aborts on close, replacement, load, detach, or destroy. |
CompareDocumentsEngineOptionsinterfaceSource ↗
Options of one document compare.
interface CompareDocumentsEngineOptions| Member | Type | Summary |
|---|---|---|
| authorName? | string | Author recorded on every revision. The engine picks a default when absent, empty, or only white space. |
| detectFormatChanges? | boolean | Record formatting differences as formatting revisions. Default `true`. |
| removeDateAndTime? | boolean | Omit the revision timestamps. Default `false`. |
CompareDocumentsProgressinterfaceSource ↗
How far a background compare is.
interface CompareDocumentsProgress| Member | Type | Summary |
|---|---|---|
| fraction | number | The share of the work done, from 0 to 1. It never decreases. |
| phase | CompareDocumentsPhase | The step that runs now. |
CompareDocumentsRequestinterfaceSource ↗
What one compare request carries: the revised DOCX and its options.
interface CompareDocumentsRequest| Member | Type | Summary |
|---|---|---|
| authorName? | string | Author recorded on every revision. When absent or blank, the editor's author. Without an editor author, the revised document's last author, then its creator, then `Comparison`. |
| detectFormatChanges? | boolean | Record formatting differences as formatting revisions. Default `true`. |
| removeDateAndTime? | boolean | Write the revisions without dates. Default `false`. |
| revised | Uint8Array | The revised document's DOCX bytes. The open document is the original. |
ComposeFontOriginsOptionsinterfaceSource ↗
Diagnostics hook for ordered font-origin composition.
interface ComposeFontOriginsOptions| Member | Type | Summary |
|---|---|---|
| onOriginFailure? | (failure: FontOriginFailure) => void | Fire-and-forget diagnostics; returned promises are observed but do not delay resolution. |
ContentControlListNavigationinterfaceSource ↗
The stateful keyboard behavior used by all value lists.
interface ContentControlListNavigation| Member | Type | Summary |
|---|---|---|
| keyDown | | Handle list keys on a popup root. Input editing keys remain native. |
| reset | | Reset typeahead when opening a different session. |
ContentControlWidgetChromeHandlersinterfaceSource ↗
Framework rendering for content-control value widgets.
interface ContentControlWidgetChromeHandlers| Member | Type | Summary |
|---|---|---|
| kinds? | readonly ContentControlWidgetSession['kind'][] | Session kinds this renderer takes. Defaults to `dropdown`, `comboBox`, `date` and `buildingBlockGallery` (the list-shaped sessions), so a renderer written for the pop-ups never receives a checkbox or picture press it does not expect. Include `'checkbox'` to take those presses too; the engine then leaves the toggle to `apply`, and a press nobody takes toggles the box as before. Include `'picture'` to own the image pick; a press nobody takes opens the engine's own file picker. |
| onRequest? | (session: ContentControlWidgetSession) => void |
ContentControlWidgetSessioninterfaceSource ↗
A core-owned content-control value edit.
kind names the widget that was pressed. A checkbox session carries the current state as 'true' / 'false' and expects the opposite (or the same) back through apply; the packaged pop-ups apply the toggle at once, so a host only sees it when it renders the widget itself. A buildingBlockGallery session is a list session: items are the glossary's blocks for the control's gallery, named by w:docPartPr/w:name, and apply takes a name. A picture session carries the control's drawing node id as value and takes new image bytes through replaceImage; apply refuses, since no text stands for an image.
interface ContentControlWidgetSession| Member | Type | Summary |
|---|---|---|
| anchor | HTMLElement | null | |
| apply | | |
| canApply | | |
| cancel | | |
| controlId | string | |
| items | readonly {
readonly displayText: string;
readonly value: string;
}[] | |
| kind | 'dropdown' | 'comboBox' | 'date' | 'checkbox' | 'picture' | 'buildingBlockGallery' | |
| locale | string | The editor's regional locale, for a date picker's month, weekday and first-day rules. |
| replaceImage | | Picture sessions only: replace the control's image with these bytes. The engine sniffs the format (PNG, JPEG, GIF, BMP or WebP) and keeps the drawing's size. Resolves false when the bytes are not a supported image, the control no longer takes a write, or the document is open for viewing or suggesting. Cancellation during decoding prevents the commit; only one replacement may be pending for a session. |
| signal | AbortSignal | |
| value | string |
ContentLockPolicyinterfaceSource ↗
An opt-in relaxation of ST_Lock for hosts that protect WHAT a control says, not how it looks.
ECMA-376 contentLocked forbids editing the control's contents and Word reads formatting as part of that, which is the default here. A host that puts protected text in a control (a template placeholder the user must not retype) but lets authors style it sets allowFormattingInLockedContent: a run-property write (bold, colour, font, size, highlight …), on runs or on a paragraph mark, then passes the CONTENT half of the lock. The exception never admits a property that hides text (w:vanish, w:specVanish, w:webHidden), which the run-property vocabulary refuses today anyway. Text edits, deletion of the content, paragraph properties, removal of a sdtLocked wrapper and w:dataBinding refusals are unchanged.
interface ContentLockPolicy| Member | Type | Summary |
|---|---|---|
| allowFormattingInLockedContent? | boolean | Let run formatting pass a content lock; text and removal stay refused. Default `false`. |
CustomFontsOptionsinterfaceSource ↗
Options for loading application fonts when the editor resolves its font configuration.
interface CustomFontsOptions extends Omit<LoadFontsRequest, 'signal'>| Member | Type | Summary |
|---|---|---|
| onFailure? | (failure: FontLoadFailure) => void | Reports each failed face. Defaults to a console warning. Cancellation does not call this handler. |
DocumentRefreshinterfaceSource ↗
External file transport stays in your application. Reload resets selection and undo history.
interface DocumentRefresh| Member | Type | Summary |
|---|---|---|
| applyUpdate | | Accept cumulative output. Preserve a clamped scroll position without moving focus. |
| cancel | | Cancel pending processing. An accepted result stays loaded. |
| capture | | Finish pending input and capture bytes with their document revision. Supersedes earlier submissions. |
| clearHighlights | | Remove temporary paragraph highlights without changing document content or history. |
| finish | | End processing when no further output will arrive. |
| highlightChanges | | Highlight available changes and return their count, including offscreen locations. Zero means none. Always validates options. |
| navigateToChange | | Explicit navigation. Does not focus unless requested. Returns false for unavailable locations. |
| onResult | | Completion notification for every `applyUpdate()` call, including a refused result. |
| recover | | Retry recovery only while the failed document session is still active. |
| recoveryBytes | | Return a copy for download after recovery fails. |
| snapshot | | Cached state, suitable for framework external-store subscriptions. |
| subscribe | | Observe state changes. Returns an unsubscribe function. |
DocumentRefreshStateinterfaceSource ↗
Observable controller state. Document editing stays available during processing.
interface DocumentRefreshState| Member | Type | Summary |
|---|---|---|
| changes | readonly RefreshChange[] | |
| highlightsVisible | boolean | Whether highlights are requested for available locations. False when the whole set starts dismissal. |
| phase | 'idle' | 'capturing' | 'processing' | 'refreshing' | 'recovering' | 'complete' | 'failed' | |
| recoveryAvailable | boolean | Offer restore and download controls when true. |
| result | RefreshResult | null |
DocumentSearchinterfaceSource ↗
The shared search of one editor. Get it with [createDocumentSearch](createDocumentSearch).
interface DocumentSearch| Member | Type | Summary |
|---|---|---|
| clear | | Empty the query and drop the results, without changing the selection. |
| find | | Search now, without a debounce, and return the matches. Clears the active match unless `selectFirst` selects one. `highlight` highlights the results until `clear()`. |
| getState | | The current state. Returns the same object until the state changes. |
| goTo | | Select a match and scroll to it. Focus stays where it is, so a search box keeps it and Enter can move to the next match; pass `{ focus: true }` to move focus to the document. Returns false for an index without a match. |
| next | | Go to the next or previous match, wrapping at the ends. |
| previous | | |
| setMatchCase | | |
| setQuery | | Update the typed query. The search runs after [SEARCH_DEBOUNCE_MS](SEARCH_DEBOUNCE_MS) of quiet. |
| setWholeWord | | |
| showHighlights | | Highlight matches while the returned function is not called. With several requests, the widest wins: `'all'`, then `'active'`. Without a request, nothing is highlighted. The Find pane requests highlights while its Find tab is open. |
| subscribe | | Observe state changes. Returns an unsubscribe function. |
DocumentSearchFindOptionsinterfaceSource ↗
Options for [DocumentSearch.find](DocumentSearch.find).
interface DocumentSearchFindOptions extends DocumentSearchOptions| Member | Type | Summary |
|---|---|---|
| highlight? | DocumentSearchHighlight | Highlight the results until `clear()` or the next `find()`: `'all'`, `'active'`, or `'none'`. Default: no request of its own, so highlights follow the Find pane and hooks. |
| selectFirst? | boolean | Select the first match and scroll to it. Default: `false`. |
DocumentSearchNavigateOptionsinterfaceSource ↗
How a search moves to a match.
interface DocumentSearchNavigateOptions| Member | Type | Summary |
|---|---|---|
| focus? | boolean | Move focus to the document. Default: `false`. |
DocumentSearchOptionsinterfaceSource ↗
Search options that narrow a query.
interface DocumentSearchOptions| Member | Type | Summary |
|---|---|---|
| matchCase? | boolean | |
| wholeWord? | boolean |
DocumentSearchStateinterfaceSource ↗
A snapshot of the shared search. The same object until something changes.
interface DocumentSearchState| Member | Type | Summary |
|---|---|---|
| activeIndex | number | Index of the current match, or `-1` before any navigation. |
| activeMatch | TextMatch | null | The current match, or `null` before any navigation. |
| isPending | boolean | A typed query is waiting for its debounce. |
| matchCase | boolean | |
| matches | readonly TextMatch[] | Matches for the last searched query, in document order. |
| query | string | The query as typed. It can lead the searched query by one debounce. |
| truncated | boolean | The search stopped at [SEARCH_MATCH_LIMIT](SEARCH_MATCH_LIMIT) with matches still ahead. |
| wholeWord | boolean |
DocxEditorConfiginterfaceSource ↗
Everything [createDocxEditor](createDocxEditor) accepts. Every field is optional.
container is the one that changes the shape of the whole lifecycle: omitting it produces an instance that does no DOM work until attach(el), which is what lets a provider own the editor before any component has rendered a mount point.
interface DocxEditorConfig| Member | Type | Summary |
|---|---|---|
| author? | string | |
| container? | HTMLElement | The element the paginated surface mounts into. The surface owns this subtree. |
| contentLockPolicy? | ContentLockPolicy | Opt-in relaxation of content-control `w:lock`: with `allowFormattingInLockedContent`, `contentLocked` / `sdtContentLocked` controls refuse typing, pasting and deleting their text as always, but accept run formatting (toolbar, shortcuts, automation `setFont`) — for hosts that protect WHAT a control says and let authors style it. Default: Word's behaviour, where a content lock refuses every edit including formatting. |
| document? | DocumentSource | A document to load at construction: DOCX bytes, or `'blank'` for Word's blank template. A `DocumentHandle` cannot be re-opened (the handle is identity, not content), so passing one emits a typed `error` event rather than silently loading nothing. Omitting this mounts NO document, which is not the same as an empty one. |
| fieldResults? | FieldResultsMode | How the reader edits saved field results. |
| fonts? | FontConfiguration | FontConfigurationFragment | FontResolver | Font bytes for Word-accurate (HarfBuzz-shaped) line wrap and pagination. Omitted, layout falls back to a fixed-width estimate; fonts embedded in the document are wired in automatically either way. For Word's default faces (Calibri, Times New Roman, …) pass `await loadDefaultFonts()` from `@docx-editor.dev/fonts` — a bare fragment (`{ sources, substitutions }`) is accepted and composed with defaults, or merge several origins yourself with `composeFontConfiguration`. Sampled per load; failures degrade to the fixed measurer and report through `onFontError`. |
| fontShaping? | FontShapingOptions | Explicit shaping execution limits. Omitted, the per-face byte ceiling remains 16 MiB. |
| imageDecodePort? | ImageDecodePort | Override raster decode for insert/replace image commands; defaults to browser/headless. |
| locale? | string | BCP-47 locale for regional date input and generated labels; defaults to en-US. |
| lockedControlNavigation? | LockedControlNavigation | How the caret moves through an inline control with a content lock. `'atomic'` makes such a control one caret unit; `'characters'` (the default) walks through its characters, as Word does. Fixed for the instance. |
| mode? | 'edit' | 'view' | 'suggesting' | The mode the editor opens in — one prop, matching the toolbar's three-state pill. |
| modules? | readonly EditorModule[] | Capability modules to register — the seam `@docx-editor.dev/pro` plugs in through. Omitted, the editor runs the free tier: lossless round-trip, final-state revision rendering, review chrome disabled with the engine's reason. See [EditorModule](EditorModule). |
| onFontError? | (error: EditorFontError) => void | |
| reviewDisplayMode? | ReviewDisplayMode | Initial review projection. Markup modes require a review module. |
| revisionMarkup? | RevisionMarkupOptions | Initial local revision presentation and tracking preferences. |
| revisionStyles? | RevisionStyles | How painted tracked changes are coloured. Presentation only — nothing is serialised. |
| tableInteractionLabel? | (key: TableInteractionLabelKey) => string | Localized labels for table insertion furniture on the painted surface. |
| translate? | (key: string, params?: Record<string, string | number>) => string | Drawing and form-control UI labels; defaults to English when omitted. |
| unsupportedElementRules? | readonly UnsupportedElementRule[] | Ordered unsupported-content registrations; the first matching rule reserves a layout box. |
| zoom? | number | The scale to open at, as a fixed number. |
| zoomMode? | ZoomMode | 'auto' | Where the scale comes from. Defaults to `'auto'` — fit the page width, between 50% and 100% — unless [DocxEditorConfig.zoom](DocxEditorConfig.zoom) is supplied, which means fixed. |
DocxEditorInstanceinterfaceSource ↗
The concrete facade type: the full Editor contract plus the instance-only surface.
surface, stateVersion, attach and detach live HERE rather than on Editor: they are what a store binding and a mounting host need, not what document commands need. Production adapters program against Editor for everything else.
interface DocxEditorInstance extends Editor| Member | Type | Summary |
|---|---|---|
| attach | | Mount into `el`, which may belong to another document: a pop-out window opened with `window.open`, or a same-origin iframe. |
| collaborationSession | | The live collaboration replica, or null when this editor is not in a room. |
| detach | | Take the editor out of its element and keep it, with its undo history, selection and collaboration session, for a later `attach`. While detached the instance still saves, runs commands and receives remote edits; it paints when attached again. A `load` while detached replaces the kept document. `destroy()` releases everything. No-op when already detached or destroyed. |
| fontMeasurement | | Which measurer the current document's layout runs on, and whether shaped resolution is still in flight — the honest "are wrap points Word-accurate yet?" readout a host shows instead of guessing. `fixed` with `resolving: false` is the steady state for a document with no usable font source (the documented zero-config fallback); `shaped` means HarfBuzz measurement over real font bytes. Changes bump `stateVersion()`. |
| getReviewAuthors | | Every author the review surface DRAWS, in Word's slot order, with the colour the review chrome draws them in. The discovery surface a legend or colour picker builds on — authors depend on the loaded file, so they cannot be known at configuration time. |
| isReviewAuthorVisible | | Whether this author's revisions and comments are shown in the current review view. |
| mountGeneration | number | Bumps on mount, detach, destroy, and document reload — guards async image intents. |
| presenceColorFor | | The presence colour the engine paints for one display name — the answer the remote caret label takes, so chrome built on this cannot disagree with the painted caret. |
| setAllReviewAuthorsVisible | | Show or hide every reviewer in one layout pass. |
| setAuthor | | Set the author for runtime editor state. |
| setBookmarkChrome | | Wire the host's bookmark dialog to Ctrl/Cmd+Shift+F5. Returns an unsubscribe that restores whatever was registered before, like [DocxEditorInstance.setHyperlinkChrome](DocxEditorInstance.setHyperlinkChrome). |
| setBookmarkMarks | | Choose which bookmarks Show bookmarks marks and customize each mark. Returns an unsubscribe that restores the previous options. |
| setCommentDraftChrome | | Wire the host's comment draft UI to the `review.addComment` control. Returns an unsubscribe that restores whatever was registered before. While nothing is registered, the control is disabled, because nothing could open the draft. The review rail registers when it mounts. |
| setCompareDocumentsChrome | | Register Compare documents chrome. Disposal cancels its active sessions. Manual renderers take priority over fallback renderers. Pass null to use the review module's own dialog until disposal restores the previous registration. |
| setContentControlWidgetChrome | | Register typed content-control widget chrome. |
| setEquationChrome | | Wire the host equation popover to painted equation clicks. |
| setFonts | | Replace host font resources without replacing the document or its edit history. Old resolution is cancelled. Existing host faces are removed before the new resolver runs; no answer keeps the bounded fallback. Document-embedded faces remain independent of host fonts. Failures report through `onFontError`. |
| setGoToChrome | | Wire the host's Go To UI to the `openGoTo` command. Returns an unsubscribe that restores whatever was registered before. `DocxEditor.Navigation` registers its Go to tab. |
| setHyperlinkChrome | | Wire the host's hyperlink chrome to the engine's gestures — a click on an external link, and Ctrl/Cmd+K. Returns an unsubscribe that restores whatever was registered before, so a popover component can register in an effect and clean up in its teardown. |
| setInvalidTextFormFieldChrome | | Register invalid protected-field acknowledgement chrome. |
| setLocale | | Set regional date input and generated labels without rebuilding the editor. Stored dates are preserved; an in-progress field edit retains its starting locale. Omitted, invalid, and unsupported locales use en-US. Translation catalogues fall back by language. |
| setMode | | Set the host editing mode without rebuilding the editor. |
| setOpeningIndicatorHost | | Render the host's own loading indicator on the first page while a large document lays out its remaining pages, or restore the packaged spinner with `null`. The engine keeps owning the element and its place on the page; the host owns its content. |
| setRemoteCaretLabelHost | | Render the host's own component as the remote-caret label, or restore the default collaborator-name label with `null`. The engine keeps owning label geometry, class, and presence colour; the host owns the content of each published element. |
| setReviewAuthorVisible | | Show one author's markup, or render their revisions as accepted and hide their comments. This changes view state only. It does not apply tree operations or change saved bytes. |
| setReviewPaneOptions | | Change the review pane settings: every field of `ReviewPaneOptions`, such as when the pane opens by itself and what it does when its card column does not fit. An omitted field keeps its value. Read the settings in force from `snapshot().reviewPane`. They stay in force across `load()` and are never saved into the document. This sets how the pane behaves; to open or close the pane itself, use `useReview().setPaneOpen` or the `toggleReviewPane` command. |
| setRevisionMarkup | | Merge local preferences and emit revisionMarkupChange after a change. Invalid settings throw TypeError without changing the previous settings. |
| setRevisionMarkupChrome | | Register local revision settings chrome. Disposal cancels its active sessions. Manual renderers take priority over fallback renderers. Pass null to use native chrome until disposal restores the previous registration. |
| setRevisionStyles | | Replace how tracked changes are coloured, live. Paint-level: pages repaint without a layout pass, and the caret, selection and undo history stay where they are. Pass `'author'` to restore the default, or `'kind'` to opt out to the green/red rendering. Survives a document reload. |
| setTextFormFieldChrome | | Register Field Options chrome. Disposal closes sessions owned by this registration. |
| setTranslate | | Set the drawing and form-control label resolver without rebuilding the editor. Open dialogs preserve their controls and input; later surface mounts use the same resolver. |
| setUnsupportedElementRules | | Replace registrations while preserving document edits and undo history. |
| showAllReviewAuthors | | Restore every reviewer to the shown state. |
| stateVersion | | Monotonic version of the observable editor state. Bumps whenever anything `snapshot()` reports could have moved — a committed change, a selection move, zoom, load success or failure, attach/detach, destroy. An external store (React's `useSyncExternalStore`) uses it as a cheap "did anything change" signal; `snapshot()` itself is cached per version and returns a stable reference between bumps. |
| surface | PaginatedSurface | null | The underlying paginated surface for harnesses and tests that need capabilities the contract does not carry yet (select-all, node-id addressed selection). |
DrawingPositionInputinterfaceSource ↗
An anchored drawing's position: offsets, and the frames they are relative to.
The relative-to bases matter as much as the offsets. Writing an offset without preserving its base re-anchors the drawing against a different reference and moves it somewhere nobody asked.
interface DrawingPositionInput| Member | Type | Summary |
|---|---|---|
| horizontalEmu? | number | |
| mode? | 'frame' | 'simple' | `'simple'` when `@simplePos="1"`: `horizontalEmu` / `verticalEmu` are authoritative `wp:simplePos` x/y. `'frame'` (default) uses positionH/V relative frames. |
| relativeToH? | DrawingHorizontalReferenceFrame | |
| relativeToV? | DrawingVerticalReferenceFrame | |
| verticalEmu? | number |
DrawingPreviewPackageLimitsinterfaceSource ↗
Caps for [createDrawingPreviewPackage](createDrawingPreviewPackage).
interface DrawingPreviewPackageLimits| Member | Type | Summary |
|---|---|---|
| maxBytes? | number | Maximum number of copied bytes. Defaults to 64 MiB. |
| maxParts? | number | Maximum number of copied parts. Defaults to 64. |
DrawingSupportIssueinterfaceSource ↗
A drawing feature that the editor does not show as authored. Each code means:
- unsupported-effect: the editor ignores an explicit effect, such as a:blur, a:duotone, or a14:imgProps. The drawing renders without it. - renderer-required: an optional effect, such as a:glow, needs the drawing module: drawingModule() or installDrawing() from @docx-editor.dev/pro/drawing. It appears only while that module is not installed in the current process, for occurrences and reports alike. - unverified-3d: the drawing has 3-D properties (a:scene3d, a:sp3d), which render flat. - saved-fallback: the editor shows the saved mc:Fallback content, not the main content. - unplaced-drawing: the drawing has no layout position, so the editor does not show it. - inspection-limit: a scan budget stopped the check, so the result is incomplete. - projection-diagnostic: the source is malformed or partly unusable. detail holds the diagnostic code, such as invalid-geometry or resource-refused.
The check reads the drawing's own XML. It does not read chart or diagram parts, inherited theme effects, or image bytes, so an empty list does not prove full fidelity.
interface DrawingSupportIssue| Member | Type | Summary |
|---|---|---|
| code | 'unsupported-effect' | 'renderer-required' | 'unverified-3d' | 'saved-fallback' | 'unplaced-drawing' | 'inspection-limit' | 'projection-diagnostic' | The kind of limitation. The list in this type's description explains each code. |
| detail | string | The feature, such as `a:blur` or `mc:Fallback`, or the projection diagnostic code. |
| localName | string | The local name of the node with the feature, such as `blur`. |
| namespaceUri | string | The namespace of the node with the feature. |
| nodeId | string | The source node with the feature: in the inspected package for a report, or in the editor's current document for an occurrence's `drawingIssues`. |
EditorCommandExecuteinterfaceSource ↗
A command hook keeps its nullary event-handler form and accepts explicit options.
interface EditorCommandExecute| Member | Type | Summary |
|---|---|---|
| (member-0) | | |
| (member-1) | |
EditorModuleinterfaceSource ↗
One registered capability module. Registration is construction-time (createDocxEditor({ modules })) and immutable for the instance's lifetime.
interface EditorModule| Member | Type | Summary |
|---|---|---|
| collaboration? | CollaborationModuleContribution | Collaboration replica. Absent, the editor stays single-user: local undo stays the authority, and `snapshot().collaborationStatus` is `'inactive'`. |
| customNodePayloadNamespaces? | readonly string[] | customXml payload namespaces this module OWNS, swept for orphans when a document opens. |
| customNodes? | readonly unknown[] | Custom inline node definitions. Reserved: the definition shape lands with the custom-nodes lane; the registry carries them opaquely until then. |
| id | string | Diagnostic identity (`'review'`, `'custom-nodes'`); not a dispatch key. |
| onCustomNodeDiagnostic? | (diagnostic: unknown) => void | Told when the recognition pass finds something wrong with a node in THIS editor's document. |
| onDiagnostic? | (event: EditorDiagnostic) => void | Told about every anonymous diagnostic of this editor, from its first open on. |
| review? | ReviewModuleContribution | Review capability: queue derivation, commands gate, display modes. |
| wantsDiagnostic? | (kind: EditorDiagnosticKind) => boolean | Whether `onDiagnostic` wants events of `kind` now. Absent, it wants every kind. The editor asks before work that only a diagnostic needs, such as timing key presses for `performance`, and skips that work when no listener wants it. Read often: keep it cheap. |
EditorModuleRegistryinterfaceSource ↗
The resolved registry the editor instance holds: at most one review contribution and at most one collaboration contribution (first registration wins for each), all custom node definitions in registration order.
interface EditorModuleRegistry| Member | Type | Summary |
|---|---|---|
| collaboration | CollaborationModuleContribution | null | |
| customNodeDiagnostics | readonly ((diagnostic: unknown) => void)[] | Every registered diagnostic listener, in registration order. |
| customNodePayloadNamespaces | readonly string[] | Every claimed payload namespace, deduplicated, in registration order. |
| customNodes | readonly unknown[] | |
| diagnosticListeners | readonly ((event: EditorDiagnostic) => void)[] | Every registered `onDiagnostic` listener, in registration order. |
| review | ReviewModuleContribution | null | |
| wantsDiagnostic | (kind: EditorDiagnosticKind) => boolean | Whether any module with `onDiagnostic` wants events of `kind` now. |
EditorWindowinterfaceSource ↗
A pop-out window opened by [openEditorWindow](openEditorWindow).
interface EditorWindow| Member | Type | Summary |
|---|---|---|
| close | | Close the window. Runs the `onClose` listeners first. |
| element | HTMLElement | The mount point: attach the editor, or render the editor panel, here. |
| onClose | | Run `listener` once when the window goes away: the user closed it, or you called `close()`. It runs while the window's document still exists, so move the editor back from here. Returns a function that removes the listener. |
| window | Window | The pop-out window. |
EquationActivationinterfaceSource ↗
A user click on one painted equation.
interface EquationActivation| Member | Type | Summary |
|---|---|---|
| equation | SurfaceEquation | |
| rect | {
readonly left: number;
readonly top: number;
readonly right: number;
readonly bottom: number;
} |
EquationChromeHandlersinterfaceSource ↗
Host chrome that edits a clicked Office Math equation.
interface EquationChromeHandlers| Member | Type | Summary |
|---|---|---|
| onPopover? | (activation: EquationActivation) => void |
EquationOpsinterfaceSource ↗
Surface equation reads and atomic replace/remove writes.
interface EquationOps| Member | Type | Summary |
|---|---|---|
| applyEquation | | |
| can | | Whether equation chrome can run an action, with the engine-owned refusal reason. |
| equationAtCaret | | |
| equationById | | |
| equationsInCaretParagraph | | |
| removeEquation | |
FinalizedImageOverlayInteractioninterfaceSource ↗
The committed result of a whole drag, recomputed from the release coordinates.
Recomputed rather than accumulated from the per-frame previews, so rounding applied once per frame cannot add up into a final extent that differs from where the pointer actually stopped.
interface FinalizedImageOverlayInteraction extends ImageResizeResult| Member | Type | Summary |
|---|---|---|
| position | DrawingPositionInput | null |
FontConfigurationBaseinterfaceSource ↗
The base of a composition: everything a FontConfiguration carries, all optional. Omitted fields take the documented defaults (epoch 0, maxFontBytes at the engine hard maximum, defaultFont Calibri at 11pt — Word's own default face and size).
interface FontConfigurationBase extends FontConfigurationFragment| Member | Type | Summary |
|---|---|---|
| defaultFont? | FontConfiguration['defaultFont'] | The face used when a run names no font. Defaults to Word's own: Calibri at 11pt. |
| epoch? | number | Identity of this configuration's byte set. The engine uses it to tell one resolved font set from another; leave it unset and the editor supplies the load sequence. |
| language? | string | BCP-47 tag passed to the shaper for language-sensitive shaping. |
| maxFontBytes? | number | Per-face byte ceiling. Defaults to the engine hard maximum; lower it to tighten intake. |
FontConfigurationFragmentinterfaceSource ↗
A partial font configuration one origin contributes: sources, substitutions, or both. loadDefaultFonts() (the substitute package) and loadFonts() (the fetch helper) both return this shape, so every origin composes through composeFontConfiguration the same way.
interface FontConfigurationFragment| Member | Type | Summary |
|---|---|---|
| deferred? | Promise<FontConfigurationFragment | undefined> | Faces that arrive after the document first paints. The editor lays the document out with `sources` and `substitutions`, then lays it out again once this settles. Use it for large faces, such as CJK fonts, that would otherwise hold back the first paint. |
| sources? | readonly FontSource[] | |
| substitutions? | readonly FontSourceSubstitution[] | |
| supportedFamilies? | readonly string[] | Selectable provider families, independent of loaded bytes. Listing them performs no fetch. |
FontLoadFailureinterfaceSource ↗
One face that did not load, with whatever evidence the failure produced.
Non-fatal: [LoadFontsResult](LoadFontsResult) still carries every source that succeeded, and the affected family falls back to the engine's fixed measurement.
interface FontLoadFailure| Member | Type | Summary |
|---|---|---|
| actualHash? | string | |
| diagnostic? | string | |
| expectedHash? | string | |
| reason | FontLoadFailureReason | |
| request | FontFaceRequest | |
| status? | number | HTTP status for `httpError`; hashes for `hashMismatch`. |
| url | string |
FontMeasurementStateinterfaceSource ↗
Which measurer the current document's layout runs on, and whether shaped resolution is still in flight. Returned by [DocxEditorInstance.fontMeasurement](DocxEditorInstance.fontMeasurement).
interface FontMeasurementState| Member | Type | Summary |
|---|---|---|
| measurer | 'fixed' | 'shaped' | `fixed` estimates advance widths; `shaped` measures real font bytes with HarfBuzz. |
| producer? | string | The shaped measurer's identity (admitted face hashes); absent while fixed. |
| resolving | boolean | True while font resolution for the current document is still running. |
FontOriginFailureinterfaceSource ↗
A failed font origin or a partial failure in an otherwise usable fragment.
interface FontOriginFailure| Member | Type | Summary |
|---|---|---|
| cause | unknown | |
| originIndex | number | Zero-based position in the first-wins origin list. |
| originName? | string | Resolver function name when one is safely available. |
FontResolutionRequestinterfaceSource ↗
What the document turned out to need, handed to an on-demand resolver.
The families are the ones the file actually names — already name-validated and capped, so a resolver may treat them as a list to look up, never as URLs or paths to build.
interface FontResolutionRequest| Member | Type | Summary |
|---|---|---|
| defaultFamily | string | The face a run naming no font resolves to, so a resolver can cover it too. |
| families | readonly string[] | Families needed by the document, deduped and capped at [MAX_RESOLVER_FAMILIES](MAX_RESOLVER_FAMILIES). Order is deterministic but may express host priority; do not sort it before resolving. |
| resolvedFaces? | readonly FontFaceRequest[] | Faces an EARLIER origin in the same composition can already PAINT — either because it supplied the bytes, or because it mapped that face onto one it did supply. |
| signal? | AbortSignal | Cancels document-scoped resolution; network-backed resolvers should pass it to fetch. |
FontResolverMarkinterfaceSource ↗
The type-level half of the mark: what [defineFontResolver](defineFontResolver) adds to a function's type so a FontOrigin list can REQUIRE it.
Declared with a string key so @docx-editor.dev/fonts can declare an identical interface and have the two unify without importing anything from the engine. Set at runtime as well as in the type — non-enumerable, so it stays out of Object.keys and out of a host's own spread.
interface FontResolverMark| Member | Type | Summary |
|---|---|---|
| "docx-editor.dev/font-resolver" | true | Always `true`. Set non-enumerably by [defineFontResolver](defineFontResolver). |
FontShapingOptionsinterfaceSource ↗
Host-selected execution limits, separate from font admission limits.
interface FontShapingOptions| Member | Type | Summary |
|---|---|---|
| maxFontBytes? | number | Per-face shaping byte ceiling. Defaults to 16 MiB; the hard ceiling is 64 MiB. |
FontUrlSourceinterfaceSource ↗
One URL to fetch and the face it claims to be.
interface FontUrlSource| Member | Type | Summary |
|---|---|---|
| faceIndex? | number | |
| family | string | |
| hash? | string | Expected `sha256:` content hash. When present, mismatching bytes are REFUSED — pin this for any URL not under the app's sole control. |
| style | 'normal' | 'italic' | |
| url | string | |
| weight | number |
FormattingBarOptionsinterfaceSource ↗
Options for [formattingBarChromeGroups](formattingBarChromeGroups).
interface FormattingBarOptions| Member | Type | Summary |
|---|---|---|
| direction? | boolean | Show `direction.ltr` and `direction.rtl` after alignment, as for a right-to-left UI. |
GoToBookmarkGroupinterfaceSource ↗
One section of a Go To list sorted by location: the rows of one place, each with its index in the full list.
interface GoToBookmarkGroup| Member | Type | Summary |
|---|---|---|
| place | BookmarkPlace | The place every row of the section is in. |
| rows | readonly {
readonly row: BookmarkSummary;
readonly index: number;
}[] | The section's rows, each with its index in the full list (the one the highlight uses). |
GoToChromeHandlersinterfaceSource ↗
Host chrome for Go To: the Go to tab of DocxEditor.Navigation, or the host's own.
interface GoToChromeHandlers| Member | Type | Summary |
|---|---|---|
| onRequest? | () => void | Open the Go To UI: the `openGoTo` command, which its shortcut also sends. |
| shortcut? | boolean | Whether Ctrl+G (Cmd+Option+G on macOS) in the document opens this UI. Defaults to `true`. With `false` the chord is left to the browser; `openGoTo` still opens the UI. The most recent registration decides. It is read when the chord arrives, so a getter can follow a setting without registering again. |
HighlightHitinterfaceSource ↗
One painted mark under a point. R is your range type: pass ranges with extra fields, such as a glossary definition, and read them back from range.
interface HighlightHit<R extends HighlightRange = HighlightRange>| Member | Type | Summary |
|---|---|---|
| active | boolean | Whether this range is the set's active range. |
| index | number | Index of the range in the array passed to `setHighlights()`. |
| length | number | Current length of the highlighted text. |
| name | string | Set name passed to `setHighlights()`. |
| range | R | The range object exactly as it was passed, including your own fields. Its offsets are the ones you passed; `start` and `length` are where the text is now. |
| rect | HighlightRect | The marked line box under the point, in client coordinates. Anchor popovers to it. |
| start | number | Current start of the highlighted text in its paragraph, after edits moved it. |
HighlightOptionsinterfaceSource ↗
Presentation for one named highlight set. Every field is optional.
interface HighlightOptions| Member | Type | Summary |
|---|---|---|
| activeColor? | string | Fill for the active range. Default: `var(--doc-text-highlight-active-color)`, orange. |
| activeIndex? | number | Index of the active range, or `-1` for none. An index past the last range also means none. The active range takes `activeColor` and the `docx-text-highlight--active` class. Default: `-1`. |
| className? | string | Space-separated CSS classes added to every mark of this set. |
| color? | string | Fill for every range: a CSS color or `var()` expression. Default: `var(--doc-text-highlight-color)`, a translucent yellow. |
| priority? | number | Stacking order between sets, as an integer from -1000 to 1000. A higher value paints on top. Sets with equal priority stack in the order they were first set. Default: `0`. The built-in Find pane uses the set name `search` with priority `10`. |
HighlightRangeinterfaceSource ↗
One text range to mark. A TextMatch from findMatches() is a valid range, so search results pass straight through.
interface HighlightRange| Member | Type | Summary |
|---|---|---|
| blockId | string | Paragraph that holds the range: `TextMatch.blockId`. IDs belong to the open document. |
| expectedText? | string | Model text the range must cover to paint. Set it for ranges computed outside the editor, such as on a server, so a range that no longer matches the document never paints. When it is omitted, a range must keep covering the text it covered when it was first set. |
| length | number | Range length in the same units. A zero length marks nothing. |
| scope? | ViewScope | Story that holds the paragraph. Informational; `blockId` already names the paragraph. |
| start | number | UTF-16 offset in the paragraph's model text, as `TextMatch.start` counts it. |
HighlightRectinterfaceSource ↗
A client-space rectangle, compatible with DOMRect readers such as positioning libraries.
interface HighlightRect| Member | Type | Summary |
|---|---|---|
| bottom | number | |
| height | number | |
| left | number | |
| right | number | |
| top | number | |
| width | number | |
| x | number | |
| y | number |
HighlightResultinterfaceSource ↗
What setHighlights() resolved against the open document.
interface HighlightResult| Member | Type | Summary |
|---|---|---|
| applied | number | Ranges that resolve to their text in the open document and can paint. |
| unavailable | number | Ranges that do not resolve or cannot paint: an unknown paragraph, offsets past the paragraph end, a zero length, text that differs from `expectedText`, or a story without a layout position. |
HighlightWatchinterfaceSource ↗
A highlight set that [watchHighlights](watchHighlights) keeps current.
interface HighlightWatch| Member | Type | Summary |
|---|---|---|
| refresh | | Run the source again now. |
| result | HighlightResult | What the last application resolved. |
| stop | | Remove the set and stop watching. |
| update | | Replace the source or options. Applies at once and keeps the set's stacking position. |
HistoryGroupinterfaceSource ↗
interface HistoryGroup| Member | Type | Summary |
|---|---|---|
| [historyGroupBrand] | true | |
| end | | End this gesture without reverting any edits. Safe to call more than once. |
| lastOutcome | HistoryGroupOutcome | null | The outcome of the latest write that named this handle, or `null` before the first one. |
| state | 'open' | 'closed' | Closed after `end()`, document replacement, detach, or destruction. |
HistoryGroupBindinginterfaceSource ↗
Dispose when the element or editor changes.
interface HistoryGroupBinding| Member | Type | Summary |
|---|---|---|
| dispose | | Close the gesture and remove every listener; does not revert edits. |
| options | | Options for the next synchronous formatting command. |
HistoryGroupBindingOptionsinterfaceSource ↗
Native event policy for one continuous control gesture.
interface HistoryGroupBindingOptions| Member | Type | Summary |
|---|---|---|
| kind | 'native-color' | 'range' | 'repeat' | 'keyboard' |
HistoryGroupOptionsinterfaceSource ↗
Options for a review write that can join an explicit history group.
Every write that names one open handle becomes part of one undo step, across commands, review methods, and browser automation runs. A closed handle, or a handle from another editor, refuses the write with code: 'unsupported' and changes nothing.
interface HistoryGroupOptions```ts
const decision = editor.beginHistoryGroup();
// Reply first: the card's key no longer exists after the change is accepted.
const reply = editor.replyToReviewItem(key, 'Accepted with one change.', {
historyGroup: decision,
});
const accepted = editor.acceptReviewItem(key, { historyGroup: decision });
decision.end();
if (!reply.ok || !accepted.ok) throw new Error('the review card was refused');
editor.exec({ type: 'undo' }); // reverts both writes
```| Member | Type | Summary |
|---|---|---|
| historyGroup? | HistoryGroup | An open handle from [Editor.beginHistoryGroup](Editor.beginHistoryGroup) on this editor. |
HistoryShortcutKeysinterfaceSource ↗
Modifier and key state of one keydown, as both DOM and framework key events carry it.
interface HistoryShortcutKeys| Member | Type | Summary |
|---|---|---|
| ctrlKey | boolean | |
| key | string | |
| metaKey | boolean | |
| shiftKey | boolean |
HostTimersinterfaceSource ↗
Timers that run on the window node belongs to, resolved at each call.
A handle is cleared on the window that issued it, so a timer set before the editor moved to another window is still cancelled after the move. Handles are this object's own numbers: two windows count their native handles independently, so a native number alone could name a timer in either one. Clear them with this object, never with the global clearTimeout.
interface HostTimers| Member | Type | Summary |
|---|---|---|
| cancelAnimationFrame | | |
| clearTimeout | | |
| migrate | | Move pending work to the window the node lives in now. Every other call does this first; call it yourself where you only check whether something is pending. A hidden opener runs no frames and fires no `pagehide`, so work left there would wait until it is shown again. |
| requestAnimationFrame | | |
| setTimeout | |
HyperlinkActivationinterfaceSource ↗
A click on a painted link, after native navigation was refused.
interface HyperlinkActivation| Member | Type | Summary |
|---|---|---|
| link | SurfaceHyperlink | |
| rect | {
readonly left: number;
readonly top: number;
readonly bottom: number;
readonly right: number;
} | The clicked line fragment's viewport rect, so a popover can be placed under it. |
HyperlinkChromeHandlersinterfaceSource ↗
The host chrome that answers the engine's hyperlink gestures.
A CLICK on an external link and Ctrl/Cmd+K both mean "the user wants the link UI", and the engine deliberately does not know what that looks like. Registered rather than passed at construction because the chrome mounts after the editor does, and it survives a document reload — the surface is rebuilt, the handlers are not.
interface HyperlinkChromeHandlers| Member | Type | Summary |
|---|---|---|
| onPopover? | (activation: HyperlinkActivation) => void | A plain click on an external or inert link: show the popover at `activation.rect`. |
| onRequest? | () => void | Ctrl/Cmd+K: open insert-or-edit for the selection. |
HyperlinkOpsinterfaceSource ↗
Reading and writing hyperlinks on the surface.
Every href that leaves here has already been through sanitizeHref — targets come from files, so javascript:, data: and vbscript: are dropped at the parse boundary rather than trusted to be filtered by whoever renders them.
interface HyperlinkOps| Member | Type | Summary |
|---|---|---|
| applyHyperlink | | Apply a link to the selection, or retarget the one the caret is already in. |
| fieldLinkAtCaret | | The FIELD link whose painted atom the caret sits on, or null. |
| linkAtCaret | | The link the caret sits in, or null. |
| linkById | | The link with this node id, or null. |
| linksInCaretParagraph | | Every link in the paragraph the caret is in. |
| removeHyperlink | | Take the link off the one at the caret (or a named one). Returns whether it committed. |
| selectionIsPendingDeletion | | Whether every character the selection covers is a pending tracked deletion. |
| wordAtCaret | | The word a new link takes when the caret is collapsed inside it, or null. |
ImageCropPercentinterfaceSource ↗
Crop edge in UI percent (0–100).
interface ImageCropPercent| Member | Type | Summary |
|---|---|---|
| bottom | number | |
| left | number | |
| right | number | |
| top | number |
ImageCropPermilleinterfaceSource ↗
Crop edge in OOXML permille (0–100000).
interface ImageCropPermille| Member | Type | Summary |
|---|---|---|
| bottom | number | |
| left | number | |
| right | number | |
| top | number |
ImageDecodePortinterfaceSource ↗
The injected image decoder.
A port rather than a direct Image/createImageBitmap call, so a worker or server runtime supplies its own and the engine never reaches for a browser global.
interface ImageDecodePort| Member | Type | Summary |
|---|---|---|
| convertPreserved | | Optional conversion of media an `<img>` cannot render (EMF/WMF metafiles, TIFF) into a renderable raster. The returned bytes are untrusted and re-enter the full raster validation path (sniff, header, pixel caps, decode) before they can become a ready resource. A null return declines the format and keeps the labelled placeholder; so does a throw, as `decode-failed`. |
| decode | |
ImageInteractionSessioninterfaceSource ↗
One in-flight image drag: where it started, and everything needed to decide at commit time whether the document still describes what the gesture was planned against.
Both revisions are captured because they move independently — layout can re-flow without the package changing, and vice versa.
interface ImageInteractionSession| Member | Type | Summary |
|---|---|---|
| anchorFrameOrigin | {
readonly x: number;
readonly y: number;
} | null | |
| drawingNodeId | string | |
| handle | ImageResizeHandle | null | |
| kind | 'inline' | 'anchored' | |
| layoutRevision | number | |
| mode | 'move' | 'resize' | |
| packageRevision | number | |
| preconditions | ImageMutationPreconditions | |
| startBounds | {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
} | |
| startHeightEmu | number | |
| startPosition | DrawingPositionInput | null | |
| startWidthEmu | number | |
| transform | DrawingTransform |
ImageOverlayScrollPortinterfaceSource ↗
How an image drag scrolls the page when it reaches the viewport edge.
Returns the delta ACTUALLY applied rather than the one requested, because a drag at the end of the document cannot scroll further and the overlay must not move the image by a distance the page did not travel.
interface ImageOverlayScrollPort| Member | Type | Summary |
|---|---|---|
| scrollBy | | Scroll by a preview delta and return the actual applied document-space delta in points. |
ImageResizeResultinterfaceSource ↗
One resize frame: the extent to store, and the box to draw while the pointer is still down.
Both, because they are different spaces — the extent is EMU for the file, the preview is points for the overlay — and computing them separately would let the handle drift from the rectangle it is dragging.
interface ImageResizeResult| Member | Type | Summary |
|---|---|---|
| heightEmu | number | |
| position | DrawingPositionInput | null | |
| previewBounds | {
readonly x: number;
readonly y: number;
readonly width: number;
readonly height: number;
} | |
| widthEmu | number |
ImageResourceLimitsinterfaceSource ↗
Trust-boundary caps specific to image decoding and embedding.
interface ImageResourceLimits| Member | Type | Summary |
|---|---|---|
| maxDecodedBytes | number | |
| maxDimension | number | |
| maxEncodedBytes | number | |
| maxExternalRedirects | number | |
| maxPixels | number | |
| maxPolygonPoints | number |
InvalidTextFormFieldChromeHandlersinterfaceSource ↗
Framework rendering for invalid protected-field acknowledgements.
interface InvalidTextFormFieldChromeHandlers| Member | Type | Summary |
|---|---|---|
| onRequest? | (session: InvalidTextFormFieldSession) => void |
InvalidTextFormFieldSessioninterfaceSource ↗
An invalid protected-field acknowledgement.
interface InvalidTextFormFieldSession| Member | Type | Summary |
|---|---|---|
| acknowledge | | Clear the unchanged invalid value, if the target still permits it. |
| cancel | | Dismiss without clearing the authored value. |
| signal | AbortSignal | |
| type | 'number' | 'date' |
LineSpacingMenuRowinterfaceSource ↗
One row of the line-spacing menu.
interface LineSpacingMenuRow| Member | Type | Summary |
|---|---|---|
| command | Extract<EditorCommand, {
type: 'setLineSpacing';
}> | null | What picking the row executes, or null for the selected row: it already holds, and its value is the read rounded to two decimals, so writing it back would quietly move an authored `w:line="253"` to 252. Picking a null row only closes the menu. |
| labelKey | 'lineSpacing.exactlyPoints' | 'lineSpacing.atLeastPoints' | null | The i18n key whose `{value}` placeholder takes `text`, or null when `text` is the whole label (a multiple). |
| preset | boolean | False for the extra row that shows a current spacing no preset matches. |
| selected | boolean | Whether this is the spacing in force across the whole selection. |
| spacing | LineSpacingMenuValue | The spacing the row stands for. |
| text | string | The number as the row shows it: one decimal for a multiple unless it needs two (`1.0`, `1.15`), and the point value for `exact` and `atLeast`. |
LoadFontsRequestinterfaceSource ↗
What to fetch, and under what limits.
Only sources is required. Each carries its own expected hash, so bytes are trusted by CONTENT rather than by origin — a swapped asset fails admission even from a trusted host.
interface LoadFontsRequest| Member | Type | Summary |
|---|---|---|
| cacheName? | string | Cache API bucket name; default `docx-editor-fonts`. |
| fetcher? | typeof fetch | Injectable for tests and CSP-constrained hosts; defaults to global `fetch`. |
| maxFontBytes? | number | Per-font byte ceiling; defaults to the engine hard maximum. |
| signal? | AbortSignal | Cancels loading with `signal.reason`, without returning per-source failures. |
| sources | readonly FontUrlSource[] |
LoadFontsResultinterfaceSource ↗
What one loadFonts call produced: the faces that arrived, plus the ones that did not.
A FontConfigurationFragment, so it composes straight into composeFontConfiguration alongside other font sources. Partial success is the normal case — compose it even with failures present.
interface LoadFontsResult extends FontConfigurationFragment| Member | Type | Summary |
|---|---|---|
| failures | readonly FontLoadFailure[] | |
| sources | readonly FontSource[] |
NavigateToChangeOptionsinterfaceSource ↗
Explicit change navigation. Does not change the default scroll preservation during refresh.
interface NavigateToChangeOptions extends ScrollToAnchorOptions| Member | Type | Summary |
|---|---|---|
| block? | ScrollPlacement | Target alignment. Default: center. centerIfNeeded preserves scroll for an already visible target. |
| focus? | boolean | Move the caret and focus to the changed range start. Default: false. |
OpenEditorWindowOptionsinterfaceSource ↗
Options for [openEditorWindow](openEditorWindow).
interface OpenEditorWindowOptions| Member | Type | Summary |
|---|---|---|
| features? | string | The `window.open` features. Defaults to `popup,width=1000,height=900`. |
| name? | string | The window name passed to `window.open`. Defaults to `docx-editor`. Windows opened with the same name are one browser window, so give each editor its own name. |
| styles? | boolean | ((from: Document, to: Document) => () => void) | Copy the opener's stylesheets, and keep copying the ones it adds later. Defaults to `true`. Pass `false` to style the window yourself, or a function that copies and returns a stop. |
| title? | string | The pop-out's title. |
| url? | string | A same-origin page to open. Defaults to `about:blank`, which needs no file on your server. A served page (an empty HTML file) gives the window a real URL and lets it load its own scripts or fonts first. |
OpeningIndicatorHostinterfaceSource ↗
Receives the element that shows the loading indicator below the laid-out pages, while a large document lays out its remaining pages.
interface OpeningIndicatorHost```ts
editor.setOpeningIndicatorHost({
publish(element) {
// Render your indicator into `element`, or remove it when `element` is null.
},
});
```| Member | Type | Summary |
|---|---|---|
| publish | | Called with the indicator element when the first pages show, and with `null` when the remaining pages are laid out or the open is abandoned. The element is empty while a host is set: render the host's content into it. It is centered in a band below the last laid-out page, as wide as the page, and scrolls with the document. |
OverlayFrameRectinterfaceSource ↗
A rectangle in one page's content frame, in layout points.
interface OverlayFrameRect| Member | Type | Summary |
|---|---|---|
| height | number | |
| pageIndex | number | |
| width | number | |
| x | number | |
| y | number |
PaginatedSurfaceinterfaceSource ↗
The mounted, painted, editable document — the layer createDocxEditor builds its contract on.
The painted pages ARE the editable surface: they are contenteditable, but the DOM is a picture. Browser mutations are prevented and re-expressed as tree ops, and selection maps only through data-paragraph-id/data-start, never through DOM node identity.
Every write goes through the guarded mutation path on this object. Reaching past it into session to apply ops directly bypasses the layout invalidation and the caret bookkeeping.
interface PaginatedSurface extends SurfaceIndentAndListOps| Member | Type | Summary |
|---|---|---|
| activatedReviewKey | | The key [activateReview](activateReview) pinned, or null once its selection is no longer live. |
| activateReview | | Open THIS item, named by key, for as long as `selection` stays the live one. |
| activeReviewKey | | The comment, tracked change or carded custom node the caret is in, as the painted bands report it. A custom node without `reviewCard` is never the answer: it has no card. |
| activeScope | | Active editing view — body, or an open header/footer story by rId. |
| applyAutomationOps | | Commit ops that came from automation, through the gate a keystroke goes through. |
| applyDrawingOps | | |
| applyHeaderFooterLifecycle | | Commit one package-level furniture lifecycle op (create/delete/link/unlink/options). Flushes layout so the next enter/rebind sees the new resolution. |
| applyImageProperties | | |
| applyTableCommandPlan | | Commit one table-command plan as a single store transaction. |
| armForcePlainPaste | | The next paste routes plain, whatever its payload carries (Cmd+Shift+V). |
| author | | The ambient author tracked edits and review writes record, or undefined. |
| bookmarkEditing | SurfaceBookmarks | List, add, delete and jump to bookmarks, and show their marks. |
| bookmarks | | `bookmarkName -> position` over the current revision, for resolving an internal link. First in document order wins a duplicate name, matching Word. |
| canEditTextFormField | | Refresh cached TOC entries and/or page numbers through the two-pass layout pipeline. |
| canInsertTable | | Whether a `rows`×`cols` table can be inserted at the caret. |
| canInsertToc | | Whether a generated body TOC can be inserted before the caret paragraph. |
| canRefreshToc | | Whether the addressed (or caret-local) body TOC can be refreshed. |
| clearFormatting | | Word's Clear All Formatting: direct run properties off the selected text, and every paragraph the selection touches back to the default style with its direct paragraph properties and mark dropped. |
| collaborationSession | | The collaboration replica a `collaborationModule` attached, or null. |
| commitReviewOps | | Commit review ops — accept, reject, a new comment — through the SAME path a keystroke takes: layout, paint, and a caret clamped to what the document now holds. |
| contentControls | ContentControlOps | Content-control chrome, form-fill navigation, and value / remove verbs. |
| convertAllNotes | | |
| convertNote | | |
| copyFlavours | | Every clipboard flavour for the current selection: plain text, and the interop HTML carrying the embedded fragment when the selection is a body-story range. A cell rectangle answers grid text plus a flattened table; `html` is null where only plain text should be written. A chart refuses as `'chart-content'`, another object as `'unsupported-content'`. |
| currentPage | | One-based page at the caret, or at the centre of the mounted viewport. |
| deleteBackward | | |
| deleteForward | | Delete forward — the Delete key, and `deleteContentForward` from an IME. |
| deleteImage | | |
| deleteNote | | |
| deleteSelection | | Remove the selection, if any. Returns whether anything was deleted. |
| deleteWordBackward | | Delete to the previous word boundary — Alt/Ctrl+Backspace. |
| deleteWordForward | | Delete to the next word boundary — Alt/Ctrl+Delete. |
| destroy | | |
| dismissActiveReview | | Close the open item until the caret next moves. |
| drawingSelectionIntent | | How the current selection came to address a drawing, if it does at all. |
| editingMode | | How edits are written right now. |
| editTextFormField | | |
| enqueueType | | Queue plain typed text for a batched commit at the caret. |
| enterHeaderFooter | | Open a header/footer story for editing on the painted surface. Refuses dangling / unknown relationship ids. |
| enterNote | | |
| equations | EquationOps | |
| exitHeaderFooter | | Leave furniture editing and restore the prior body selection. |
| exitNote | | |
| flushPendingInput | | Land any queued typed text now, as its own transaction, AND publish any layout pass a commit deferred under input pressure — so the caller reads current text and current geometry at one seam. Both halves are no-ops when nothing is pending, which is the common case: an isolated commit lays out synchronously in its own tail, and deferral only happens when the browser reports queued input behind an expensive pass. |
| focus | | |
| formatPainter | FormatPainterOps | Word's Format Painter: capture, apply, and the transient armed mode. |
| formatting | | Formatting as it stands at the selection, for a toolbar to reflect. |
| headerFooterState | | Chrome read-model for the open furniture scope, or null when editing the body. |
| hostElement | | The element the pages are in now: the host's, or a private holder while parked. |
| hyperlinks | HyperlinkOps | The hyperlink lane: what link the caret is in, and the insert / retarget / unlink verbs. |
| imageDecodePort | | |
| insertImage | | |
| insertLineBreak | | A `w:br` — Shift+Enter, a line break inside the same paragraph. |
| insertNote | | Insert a footnote/endnote at the body caret. |
| insertPageBreak | | A `w:br w:type="page"` — Ctrl+Enter, a hard page break inside the paragraph. |
| insertPageField | | Insert an allowlisted page field at the caret in the open HF story. |
| insertPlainText | | Insert text whose newlines are PARAGRAPH BOUNDARIES, in one commit. |
| insertSectionBreak | | Insert a section break at the caret: the paragraph splits, and the head ends a new section cloning the governing section's page setup — Word's Layout Breaks. One undoable step. Returns whether the break committed. |
| insertTab | | A tab character as a `w:tab` element, not a literal tab in the run text. |
| insertTable | | Insert an empty `rows`×`cols` table at the caret, columns evenly dividing the content width of the caret's section, and leave the caret in the first cell. |
| insertToc | | Insert and populate a generated body TOC before the caret paragraph. |
| isInsideToc | | Whether a body paragraph belongs to a detected TOC boundary or cached result. |
| layout | | |
| layoutSession | | The layout session, so a host or a test can see how much work a pass actually did. |
| moveTo | | Move the painted pages into `container`, which may belong to another document: a pop-out window or an iframe. The session, undo history, selection and collaboration replica stay as they are; only the DOM and the document- and window-level listeners move. Open content-control menus close. |
| navigate | | |
| navigation | SurfaceNavigation | Bookmark jumps and the ONE external-activation gate. A host's popover "open" action calls `openExternal`; nothing else in the engine may call `window.open`. |
| notePreviewText | | Plain-text preview for hover chrome — never returns markup. |
| notePropertiesState | | Resolved/authored note properties for the caret section — chrome read-model. |
| overlayCoordinates | | Paint-scale coordinate context for overlay chrome. |
| park | | Take the pages out of their container and keep them, with all editing state, for a later `moveTo`. A parked surface still accepts commands and remote edits; it paints into a private, disconnected holder until it moves again. |
| parked | | Whether the surface is parked: mounted nowhere, state kept. |
| pasteRich | | Route one paste payload by fidelity: embedded fragment, then external HTML, then plain text. Unsupported object fragments refuse without fallback. Other decode, read, or apply failures can degrade. Suggesting mode, non-body stories and an armed force-plain all land on the plain lane. False when the payload landed on no lane at all (nothing to insert). |
| proposeTextChange | | Author one explicit tracked text change without changing the editing mode. |
| publishedLayout | | The layout as last PUBLISHED, without forcing pending work. |
| redo | | |
| refreshRefFieldResults | | Rewrite stale REF field results in the body, footnote and endnote stories so a save exports what the pages paint. Fresh results commit nothing (no transaction, no revision bump, no undo entry); a rewrite is ONE transaction and ONE undo unit across every stale part. Viewing, a non-editable session, and a collaborative session write nothing — the collaboration gate cannot journal the rewrite, so those saves export cached results and the call returns false. |
| refreshTableInteractionLabels | | Refresh table insertion furniture labels without remounting or relayout. |
| refreshToc | | |
| releaseSelection | | Drop one owned pin. Another owner's pin remains visible. |
| remotePresenceColor | | The presence colour the caret paints for `name`, sanitized as the paint sink is. |
| removeToc | | Remove a body TOC: its field, or the table of contents control around it with its heading. Text before and after the field stays. One undo step. Refused while suggesting. |
| removeTocRefusal | | Why the addressed (or right-clicked, or caret-local) body TOC cannot be removed now, or null when it can: `notFound` when there is none, `unsupported` with the reason otherwise. |
| repaintHighlights | | Call the installed highlight painter against the current frame. |
| replaceImage | | |
| replacementLanding | | Where a replacement for `[start, end)` of a paragraph lands, or null when the edit would not be tracked. |
| replaceTextInPlace | | Replace a paragraph range of the active story in place; suggesting tracks it. |
| retainedSelection | | The pinned range, or null once it was released or escaped. |
| retainSelection | | Pin the current selection so it stays VISIBLY selected while focus is elsewhere. |
| revealPage | | Scroll a page, or the page a paragraph sits on, into view. Returns whether it scrolled — false when the target is not laid out, or the surface is not inside a scroll container, so a caller can tell "no such target" from "done". |
| revealParagraph | | |
| revealPosition | | Scroll an exact position into view — `revealParagraph` for a caret that is not at offset 0. Focus-independent and virtualization-safe like every reveal: geometry comes from the layout and the target page is materialized on the way. Defaults to `block: 'nearest'`, so an already-visible target never yanks the viewport. |
| revisionAuthors | | Every author with a revision in the CURRENT layout, mapped to Word's colour slot by order of first appearance. One map instance per layout, so a caller can key caches on its identity. |
| revisionDisplayMode | | Which revision halves this surface is SHOWING. |
| save | | Commit pending form input, refresh REF results, and serialize the document. Throws an error with code `invalidArgs` for invalid form values, or `invalidState` during an active edit. Retry after the edit finishes. A destroyed surface throws with code `destroyed`. Does not change focus. |
| saveSteps | | [save](save) in steps a caller can pause between. Everything `save` does before it serializes happens at the call, and the document is captured then. |
| sectionAnchorParagraphAt | | How a section-addressed op should name the section `paragraphId` is in. |
| sectionAtPage | | The section a painted page belongs to, and the page that section starts on. |
| sectionBreakRefusal | | Why [insertSectionBreak](insertSectionBreak) would refuse this kind right now, or `null`. |
| sectionProperties | | The section the document declares: page size, margins, columns, orientation. |
| sectionPropertiesAt | | The section GOVERNING one paragraph — what a ruler or dialog reflects when the caret sits in a multi-section document. |
| selectAll | | Select the whole document. |
| selectDrawing | | Select one painted drawing at its host paragraph, as a pointer press would. |
| selectedText | | The selected text, for copy and cut. |
| session | TreeDocxSessionView | |
| setActiveScope | | Activate a view scope. Returns false when a header/footer rId cannot be opened. |
| setAllRevisionAuthorsVisible | | Show or hide every reviewer in one layout pass. |
| setAuthor | | Set the ambient author after buffered text commits under the previous author. |
| setCellSelection | | Select a rectangle of table cells, or clear one with null. |
| setDrawingStrings | | Replace localized drawing labels and repaint materialized pages. |
| setEditable | | Turn the browser's editing affordance on the pages layer on or off. |
| setEditingMode | | |
| setHighlightPainter | | Install the painter for host text highlights, or remove it with `null`. The surface calls it after every render and once on installation, with the frame it just painted. |
| setLocale | | Set regional conventions for subsequent date input without reformatting stored values. |
| setNoteProperties | | |
| setParagraphFormat | | The Paragraph dialog as ONE write: alignment, indents, spacing, line spacing and the five paragraph flags, over every paragraph the selection touches. |
| setParagraphProperties | | Several paragraph properties in ONE transaction, so a dialog is one undo step. |
| setParagraphProperty | | Set a property on every paragraph the selection touches — alignment, style, spacing. |
| setRemoteCaretLabelHost | | Hand remote-caret label content to the host, or take it back with `null`. |
| setReviewActivationExclusions | | Revision kinds the CARET must not activate, or null for none. |
| setRevisionAuthorVisible | | Show one reviewer's markup, or render that reviewer's changes as accepted. |
| setRevisionDisplayMode | | Change the review display without accepting, rejecting, or changing author filters. |
| setRevisionMarkup | | Replace how tracked changes are coloured, live. Paint-level: the pages repaint without remeasuring a line, and the caret, selection and undo history stay where they are. |
| setRevisionStyles | | |
| setRunProperty | | SET a run property over the selection, rather than toggling it. |
| setSectionProperties | | Write section page-setup fields — size, orientation, margins — as ONE undoable transaction. Twips throughout; omitted fields are left as authored. With `anchorParagraphId` only that paragraph's governing section is written (Word's "Apply to: This section"); without it, every section. Returns whether the write committed (a hostile value is refused by the op layer). |
| setSelection | | Set the selection directly, for a host driving the surface programmatically. |
| setShowParagraphMarks | | Toggle paragraph-end furniture without layout or document changes. |
| setTableInteractionLabel | | Refresh table insertion furniture labels without remounting the surface. |
| setTocLabels | | Replace the localized title used by later TOC insertions. |
| setTrackedChangesFilter | | Apply a view-time predicate over complete tracked-change items. |
| setTranslate | | Update shared form-control labels without replacing open dialogs. |
| setUnsupportedElementRules | | |
| showAllRevisionAuthors | | Clear the reviewer filter in one layout pass. |
| splitParagraph | | |
| state | | |
| storyScope | | |
| textMeasurer | | The measurer layout uses; sizes engine-authored shapes such as a watermark. |
| toggleRunProperty | | Toggle a run property over the selection, e.g. `b`, `i`, `u`. |
| type | | |
| undo | | Reverse the last history entry and put the caret back where it was made. |
PaginatedSurfaceOptionsinterfaceSource ↗
How a paginated surface opens. Every field is optional.
measurer is the injection seam that keeps layout DOM-free — supply one to lay a document out on a server, or leave it off in a browser to get the canvas measurer.
interface PaginatedSurfaceOptions| Member | Type | Summary |
|---|---|---|
| author? | string | Ambient author for tracked edits. Required before suggesting can write anything. |
| bookmarkMarks? | BookmarkMarkOptionsSource | The host's Show bookmarks options, read on every paint. `onChange` names the repaint to run when the host changes them. |
| collaborationModel? | CollaborationModuleContribution | The collaboration module's replica for this surface's session. Absent, the surface does not attach, and local store history remains the undo authority. |
| contentLockPolicy? | ContentLockPolicy | Opt-in relaxation of `w:lock` for run-property writes: `contentLocked` / `sdtContentLocked` controls can be restyled (toolbar, shortcuts, automation `setFont`) but not retyped. Absent, they refuse both, as ECMA-376 / Word do. |
| defaultFontFamily? | string | The family a run with no authored font is reported as by `formatting()` AND painted in — the face the measurer falls back to. Absent, such a run reports `fontFamily: null` and paints in whatever font the page inherits, which the measurer did not measure: visible glyphs drift from wrap points and caret geometry. |
| drawingStrings? | DrawingPaintStrings | Localized drawing refusal labels; defaults to English when omitted. |
| editingMode? | SurfaceEditingMode | Opening mode; changeable at runtime with `setEditingMode`. |
| fieldResults? | FieldResultsMode | How saved field results are edited. `atomic` (the default) keeps every field one unit. `editable` lets the reader type, delete, and select inside the saved result of a DATE, MERGEFIELD, HYPERLINK, or similar field. Results must be unnested; simple fields inside complex field results are not supported. Refused with a [collaborationModel](collaborationModel). |
| fieldShading? | FieldShadingMode | When a field's result wears Word's grey shading. Omitted keeps Word's own default, `when-selected`. |
| fontAlias? | (family: string) => string | undefined | Maps a document-declared font family to the alias its registered bytes live under, so painted runs can use embedded glyphs without the file's family name entering the page-global CSS font namespace. |
| imageDecodePort? | ImageDecodePort | Override raster decode for package image intents; defaults to browser/headless. |
| locale? | string | Regional conventions for new date input; defaults to en-US. |
| lockedControlNavigation? | LockedControlNavigation | How the caret moves through a content-locked inline control; see `LockedControlNavigation`. |
| measurer? | TextMeasurer | |
| onChange? | (state: PaginatedSurfaceState) => void | |
| onEdit? | (typing: boolean) => void | Told once for each local edit that changed the document, with `typing` true for buffered typing, which can land inside a later command's commit. Remote edits are not local. |
| onEquationPopover? | (activation: EquationActivation) => void | |
| onHostMoved? | (document: Document) => void | The pages turned up in another document without a `moveTo`: a host moved the mount element itself (a Vue `Teleport` retargeted, or a plain `appendChild`). The surface has already re-bound its own listeners; the owner re-registers what is per document. |
| onHyperlinkPopover? | (activation: HyperlinkActivation) => void | A plain click on an external (or inert) hyperlink, for a host to open its popover with. |
| onRejection? | (reason: string) => void | Told each time an edit is refused, with the raw reason: a store code such as `'locked'`, or the surface's own refusal sentence. The raw reason can be a sentence, so a listener maps it to a public code before it reports anything. |
| onRequestBookmark? | () => boolean | Ctrl/Cmd+Shift+F5: open the host's bookmark dialog. Answers whether chrome took the request; when none did, or when this is absent, the key is left to the browser. |
| onRequestContentControlWidget? | (session: ContentControlWidgetSession) => boolean | |
| onRequestGoTo? | () => boolean | Ctrl+G (Cmd+Option+G on macOS): open the host's Go To UI; answers whether chrome took it. |
| onRequestHyperlink? | () => boolean | void | Ctrl/Cmd+K — Word's Insert Hyperlink. The engine reports the request; the host's chrome decides what a link dialog looks like. A host that passes nothing leaves the key alone rather than doing something surprising with it. Answering `false` leaves it alone too. |
| onRequestInvalidTextFormField? | (session: InvalidTextFormFieldSession) => boolean | |
| onRequestTextFormField? | (session: TextFormFieldDialogSession) => boolean | Return true when host chrome handles this session. |
| onTiming? | (phase: 'layout' | 'paint' | 'input', value: number) => void | Told the milliseconds of each layout pass and each paint. For `'input'`, told the browser timestamp of each key press or pointer press on the pages, so a listener can time it to the next frame. Numbers only. |
| onToggleParagraphMarks? | () => void | |
| pointer? | 'engine' | 'native' | Who resolves a pointer to a caret. |
| producer? | string | Identifies the measurer for cache invalidation. |
| reviewModel? | ReviewModuleContribution | The review module's derivation hooks for this surface's session. Absent, `session.reviewItems()` is the typed empty queue and every review affordance built on it stays inert. |
| revisionDisplayMode? | ReviewDisplayMode | How revisions project into layout and paint. Omitted keeps the layout default (`all-markup`). The editor facade passes `proposed` when no review module is registered — the free tier's final-state rendering; the machinery below this option is shared either way. |
| revisionMarkup? | ResolvedRevisionMarkup | |
| revisionStyles? | RevisionStyles | How tracked changes are coloured: by AUTHOR (the default), by kind, or by author with host-pinned colours. A paint-level option like [fieldShading](fieldShading): it changes no geometry, so switching it repaints without remeasuring a line. Applies wherever revision markup paints, whatever the [revisionDisplayMode](revisionDisplayMode) leaves visible. |
| scale? | number | Points to CSS pixels. |
| showBookmarks? | boolean | Show bracket marks at bookmarks. Paint-level; the document does not change. |
| showParagraphMarks? | boolean | Show paragraph-end furniture without changing document content. |
| tableInteractionLabel? | (key: TableInteractionLabelKey) => string | Localized accessible names for core-owned table insertion furniture. Defaults to English from `@docx-editor.dev/i18n` when omitted. |
| tocLabels? | {
readonly title: string;
} | Localized name for a generated TOC, written as the control's `w:alias` on insert. |
| translate? | (key: string, params?: Record<string, string | number>) => string | UI labels for shared form controls; omitted keys fall back to English. |
| unsupportedElementRules? | readonly UnsupportedElementRule[] |
PaginatedSurfaceStateinterfaceSource ↗
Everything observable about the surface right now, as one immutable value.
revision is the change token: it moves whenever anything else here does, which is what lets snapshot() hand back the same reference until state actually changes.
interface PaginatedSurfaceState| Member | Type | Summary |
|---|---|---|
| canRedo | boolean | |
| canUndo | boolean | |
| cellSelection | CellSelection | null | The rectangle of table cells a drag across cells selected, or null. |
| collaborationStatus | CollaborationStatus | 'inactive' | Lifecycle of the attached replica, or `'inactive'` when no collaboration module is registered on this surface. |
| contentControls | ContentControlSurfaceState | Content-control chrome and form-fill mode. |
| contextTocId | string | null | The TOC the last right-click landed on, or null. |
| formatPainter | FormatPainterSurfaceState | Format painter arming, and the level of what it holds. |
| lastRejection | string | null | |
| pageCount | number | |
| pendingFormat | readonly {
readonly localName: string;
}[] | null | The typing format armed at the caret (Word's stored marks), or null. |
| perf | PaginatedSurfacePerf | Timing and reuse counters for the last pass. Diagnostics, not document state. |
| revision | number | |
| selection | SemanticSelection |
ParagraphDialogFieldsinterfaceSource ↗
Every field of the form, in the shape the controls hold it.
Deliberately flat and all-defined: this is what the dialog SHOWS, and a control cannot show "mixed" and a number at once. The disagreement itself is remembered by comparing against the seed, not by keeping a null in here.
interface ParagraphDialogFields| Member | Type | Summary |
|---|---|---|
| alignment | 'left' | 'center' | 'right' | 'justify' | |
| clearedAllTabStops | boolean | The user pressed "Clear all", which is a decision even when the list already looked empty. |
| contextualSpacing | boolean | |
| direction | 'ltr' | 'rtl' | |
| indentLeft | number | |
| indentRight | number | |
| keepLines | boolean | |
| keepNext | boolean | |
| lineRule | 'multiple' | 'exact' | 'atLeast' | |
| lineValue | number | |
| pageBreakBefore | boolean | |
| spaceAfter | number | |
| spaceBefore | number | |
| special | SpecialIndent | |
| specialBy | number | |
| tabStops | readonly ParagraphTabStop[] | |
| widowControl | boolean |
ParagraphDialogMixedinterfaceSource ↗
Which settings the selection DISAGREES about, so a control can show it.
The value fields need this as much as the checkboxes do. A control that renders a disagreement as a plausible-looking number is not just unhelpful — it makes the disagreement uncorrectable, because the value that would fix it is the one already on screen, so changedFields sees nothing move and writes nothing. Four paragraphs at mixed alignments showed "Left" and could not be set to Left.
interface ParagraphDialogMixed| Member | Type | Summary |
|---|---|---|
| alignment | boolean | |
| contextualSpacing | boolean | |
| direction | boolean | |
| indentLeft | boolean | |
| indentRight | boolean | |
| keepLines | boolean | |
| keepNext | boolean | |
| lineSpacing | boolean | |
| pageBreakBefore | boolean | |
| spaceAfter | boolean | |
| spaceBefore | boolean | |
| special | boolean | |
| tabStops | boolean | The selection's paragraphs carry DIFFERENT tab stops, so the list shows none of them. |
| widowControl | boolean |
ParagraphFlagsinterfaceSource ↗
The five paragraph flags a Paragraph dialog shows as checkboxes.
contextualSpacing is Word's "Don't add space between paragraphs of the same style"; the rest are its Pagination block. null means the selection disagrees.
interface ParagraphFlags| Member | Type | Summary |
|---|---|---|
| contextualSpacing | boolean | null | |
| keepLines | boolean | null | |
| keepNext | boolean | null | |
| pageBreakBefore | boolean | null | |
| widowControl | boolean | null |
ParagraphFormatReadinterfaceSource ↗
What the Paragraph dialog reads: every field, as the selection currently stands.
A null means the selection's paragraphs DISAGREE about that field, which a control shows as an indeterminate checkbox or an empty box rather than as a value. indent is the exception the engine already documents — it reports the first touched paragraph and flags disagreement per field, because a ruler has to draw its handles somewhere.
interface ParagraphFormatRead| Member | Type | Summary |
|---|---|---|
| alignment | 'left' | 'center' | 'right' | 'justify' | null | `justify`, not OOXML's `both`. The engine speaks `w:jc` values; an adapter speaks the word its consumers write. Read and write use the SAME spelling here, so a value that comes out of `format` can go straight back into `apply`. |
| contextualSpacing | ParagraphFlagState | |
| direction | 'ltr' | 'rtl' | null | Base direction (`w:bidi` through the cascade); null when the selection mixes them. |
| disagrees | {
readonly alignment: boolean;
readonly direction: boolean;
readonly spaceBeforePt: boolean;
readonly spaceAfterPt: boolean;
readonly lineSpacing: boolean;
readonly tabStops: boolean;
readonly indentLeft: boolean;
readonly indentRight: boolean;
readonly indentFirstLine: boolean;
} | Which fields are `null` because the selection DISAGREES, as opposed to because nothing states them. |
| indentFirstLineTwips | number | null | ONE signed first-line offset: negative is a hanging indent. |
| indentLeftTwips | number | null | |
| indentRightTwips | number | null | |
| indentUnknown | boolean | Whether the indent reads are UNKNOWN rather than disagreed. |
| keepLines | ParagraphFlagState | |
| keepNext | ParagraphFlagState | |
| lineSpacing | {
readonly rule: 'multiple' | 'exact' | 'atLeast';
readonly value: number;
} | null | |
| pageBreakBefore | ParagraphFlagState | |
| spaceAfterPt | number | null | |
| spaceBeforePt | number | null | |
| tabStops | readonly ParagraphTabStop[] | null | Custom tab stops, cascade included. Null when the selection disagrees. |
| widowControl | ParagraphFlagState |
ParagraphFormatUpdateinterfaceSource ↗
The fields apply accepts. Omitted fields are left as authored; null where allowed REMOVES the setting so the style supplies it again, which is not the same as a zero.
interface ParagraphFormatUpdate| Member | Type | Summary |
|---|---|---|
| alignment? | 'left' | 'center' | 'right' | 'justify' | |
| contextualSpacing? | boolean | |
| direction? | 'ltr' | 'rtl' | Word's Direction. `ltr` overrides a right-to-left style with `w:bidi w:val="0"`. |
| indentFirstLineTwips? | number | null | |
| indentLeftTwips? | number | null | |
| indentRightTwips? | number | null | |
| keepLines? | boolean | |
| keepNext? | boolean | |
| lineSpacing? | {
readonly rule: 'multiple' | 'exact' | 'atLeast';
readonly value: number;
} | null | |
| pageBreakBefore? | boolean | |
| spaceAfterPt? | number | null | |
| spaceBeforePt? | number | null | |
| tabStops? | readonly ParagraphTabStop[] | Replace the custom tab stops. An EMPTY list clears them; omit to leave them alone. |
| widowControl? | boolean |
ParagraphPropertyEditinterfaceSource ↗
One property in a batched paragraph write.
interface ParagraphPropertyEdit| Member | Type | Summary |
|---|---|---|
| attributes? | Record<string, string | null> | A null-valued attribute REMOVES that attribute; see `setParagraphProperty`. |
| localName | string | |
| mergeAttributes? | boolean | Keep the attributes this entry does not name, for multi-setting elements. |
| paragraphDirection? | 'ltr' | 'rtl' | For `w:bidi` only: the base direction the paragraph must END in. The writer spells it per paragraph and skips one already in that direction (see `directionalParagraphEntry`). |
| physicalAlignment? | boolean | For `w:jc` only: `attributes.val` names a PHYSICAL edge, as a toolbar button does. The writer converts it per paragraph, because a bidi paragraph reaches its right margin with `left` (see `jcValueForAlignment`). |
| remove? | boolean | Drop the paragraph's own element of this name instead of writing one. |
ParagraphTabStopinterfaceSource ↗
One custom tab stop, as a command states it.
interface ParagraphTabStop| Member | Type | Summary |
|---|---|---|
| alignment | 'left' | 'center' | 'right' | 'decimal' | 'bar' | |
| leader? | 'none' | 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot' | |
| positionTwips | number |
PopupChromeRegistrationOptionsinterfaceSource ↗
Priority of an editor-owned popup renderer.
interface PopupChromeRegistrationOptions| Member | Type | Summary |
|---|---|---|
| fallback? | boolean | Use only when no manually registered renderer exists. |
RefreshChangeinterfaceSource ↗
One validated change for an accepted result.
interface RefreshChange| Member | Type | Summary |
|---|---|---|
| description? | string | Processor-provided summary. The controller does not compute a document diff. |
| diagnostic? | {
readonly code: 'missing-location' | 'deleted' | 'invalid-selector' | 'invalid-paragraph-id' | 'paragraph-not-found' | 'ambiguous-paragraph-id' | 'invalid-offsets' | 'text-mismatch' | 'not-rendered' | 'unsupported-story' | 'multiple-paragraphs';
readonly location?: RefreshLocation;
} | Why this change cannot receive a highlight. Includes the requested location when supplied. |
| id | string | |
| isNew | boolean | True for a new change id, changed text, or changed description in an existing change id. |
| location? | RefreshLocation | |
| resultId | string | Identity of the accepted submission and processor sequence. |
| status | 'available' | 'deleted' | 'unavailable' | 'invalid' | 'unsupported-story' |
RefreshChangeInputinterfaceSource ↗
One processor change. Keep its id stable across cumulative results.
interface RefreshChangeInput| Member | Type | Summary |
|---|---|---|
| description? | string | Processor-provided review summary, including changes without a body location. Maximum: 1000 characters. |
| id | string | |
| location? | RefreshLocation | |
| unavailableReason? | 'deleted' | 'unavailable' | Deletions without a surviving range have no highlight. |
RefreshHighlightOptionsinterfaceSource ↗
Presentation for temporary paragraph highlights. Each call starts from these defaults.
interface RefreshHighlightOptions extends AnchorHighlightOptions| Member | Type | Summary |
|---|---|---|
| changeIds? | readonly string[] | Select these change IDs instead of the recent/all filter. Unknown or unavailable IDs are skipped. Empty means none. |
| includePrevious? | boolean | Include earlier changes from the latest cumulative result. Default: false. |
RefreshLocationinterfaceSource ↗
A processor location in the returned document's body, including table paragraphs.
interface RefreshLocation| Member | Type | Summary |
|---|---|---|
| end | number | |
| paragraphId? | string | OOXML w14:paraId: eight hexadecimal digits, 00000001 through 7FFFFFFF. Case-insensitive. Use this or paragraphIndex, not both. |
| paragraphIndex? | number | Zero-based body paragraph index in document order. |
| start | number | UTF-16 offsets in the returned paragraph. |
| text | string | Exact returned text at these offsets. Required to reject mismatched metadata. |
RefreshSubmissioninterfaceSource ↗
A document captured for external processing. Treat this object as an opaque token.
interface RefreshSubmission| Member | Type | Summary |
|---|---|---|
| bytes | ArrayBuffer | |
| id | string |
RefreshUpdateinterfaceSource ↗
Cumulative output for one submission. Assign sequence at the processor, before delivery.
interface RefreshUpdate| Member | Type | Summary |
|---|---|---|
| bytes | ArrayBuffer | Uint8Array | |
| changes? | readonly RefreshChangeInput[] | Omit to derive changes from tracked revisions when a review module is registered. |
| failures? | readonly string[] | Stable failed operation ids. The controller reports these and never retries processor work. |
| sequence | number | |
| submission | RefreshSubmission |
RemoteCaretLabelAnchorinterfaceSource ↗
One live remote-caret label the engine positioned. The host owns its content; the engine still owns the label's geometry, class, and presence colour, and rebuilds the labels wholesale on every repaint that moves them.
interface RemoteCaretLabelAnchor| Member | Type | Summary |
|---|---|---|
| element | HTMLElement | |
| selection | CollaborationRemoteSelection |
RemoteCaretLabelHostinterfaceSource ↗
A host that renders its own content inside the engine's remote-caret labels.
interface RemoteCaretLabelHost| Member | Type | Summary |
|---|---|---|
| publish | | Called after every paint that rebuilt the labels, with the current anchors. |
ResolvedReviewPaneinterfaceSource ↗
The review pane settings in force, with every field resolved.
interface ResolvedReviewPane| Member | Type | Summary |
|---|---|---|
| commentMarkers | CommentMarkerStyle | How a collapsed comment marker looks. |
| opening | ReviewPaneOpening | When the pane opens by itself. |
| overflow | ReviewPaneOverflow | What the open pane does when its card column does not fit beside the page. |
| revisionsIn | RevisionDisplay | Where tracked changes open. |
ResolvedRevisionMarkupinterfaceSource ↗
Fully resolved, immutable viewer preferences.
interface ResolvedRevisionMarkup| Member | Type | Summary |
|---|---|---|
| cells | {
readonly inserted: RevisionMarkupNamedColor | 'byAuthor' | 'none';
readonly deleted: RevisionMarkupNamedColor | 'byAuthor' | 'none';
readonly merged: RevisionMarkupNamedColor | 'byAuthor' | 'none';
readonly split: RevisionMarkupNamedColor | 'byAuthor' | 'none';
} | |
| changedLines | RevisionMarkupStyle<RevisionChangedLinesMark> | |
| deletions | RevisionMarkupTextStyle<RevisionDeletionMark> | |
| formatting | RevisionMarkupTextStyle | |
| insertions | RevisionMarkupTextStyle | |
| movedFrom | RevisionMarkupTextStyle<RevisionDeletionMark> | |
| movedTo | RevisionMarkupTextStyle | |
| trackFormatting | boolean | |
| trackMoves | boolean |
ReviewAuthorInfointerfaceSource ↗
One document author, resolved: who, which ramp slot, and what they draw in.
interface ReviewAuthorInfo| Member | Type | Summary |
|---|---|---|
| author | string | The `w:author` string, exactly as the file carries it. |
| color | string | The colour this author is DRAWN IN by the review chrome — their declared colour, or their ramp slot's token. |
| slot | number | Stable session rank, seeded by order of first appearance — an UNBOUNDED index. |
| style? | RevisionAuthorStyle | The host-supplied style, normalised; absent when the author rides the ramp. |
ReviewItemHitinterfaceSource ↗
One review item under a client point.
interface ReviewItemHit| Member | Type | Summary |
|---|---|---|
| placement | ReviewItemPlacement | The item, as `getReviewItems()` with the same query returns it. |
| rect | HighlightRect | The item's painted band on the line under the point, in client coordinates. It covers the part of the item's range on that line, not the whole range. Anchor popovers to it. |
ReviewModelInputinterfaceSource ↗
What the review queue derivation reads: one story part plus its comment parts.
interface ReviewModelInput| Member | Type | Summary |
|---|---|---|
| commentsExtendedPart? | OoxmlPart | undefined | `word/commentsExtended.xml`, absent when the package has none. |
| commentsPart? | OoxmlPart | undefined | `word/comments.xml`, absent when the package has none. |
| customNodePayloads? | ReadonlyMap<string, {
readonly nodeId: string;
readonly label: string;
readonly data: string;
}> | undefined | The payload each of the story's controls binds to, keyed by the control's node id. |
| customNodes? | readonly unknown[] | undefined | Custom node definitions from the module registry, forwarded OPAQUELY. |
| furnitureParts? | readonly OoxmlPart[] | undefined | Header/footer story parts, in section order. Their revisions and comment anchors join the queue: a tracked change in a header is a pending decision like any other, and a queue that only walked the body silently hid it from the rail AND from Accept All. |
| reportCustomNodeDiagnostic? | ((diagnostic: unknown) => void) | undefined | Where a capability package reports a node it could not read. Supplied per editor, so a page with two of them keeps their diagnostics apart. |
| storyPart | OoxmlPart | The story the ranges live in — the main document, a header, a note. |
| stylesPart? | OoxmlPart | undefined | Shared style definitions. Their revisions have no paragraph range. |
ReviewModuleContributioninterfaceSource ↗
What a review module contributes: the queue derivation, and the revision display modes the editor may enter beyond the free tier's final-state projection.
interface ReviewModuleContribution| Member | Type | Summary |
|---|---|---|
| collectReviewItems | CollectReviewItems | The review queue derivation. |
| compareDocuments? | CompareDocumentsEngine | Document compare. Absent, compare commands refuse. |
| compareDocumentsInBackground? | CompareDocumentsBackgroundEngine | The same compare off the main thread. When present, the Compare documents dialog uses it, reports progress, and can stop a running compare. If it rejects before its first progress report, the dialog compares with `compareDocuments` instead. The `compareDocuments` command stays synchronous and uses `compareDocuments`. |
| createCompareDocumentsDialog? | (host: CompareDocumentsDialogHost) => CompareDocumentsDialog | Create the Compare documents dialog when a host opens it. |
| createRevisionMarkupDialog? | (host: RevisionMarkupDialogHost) => RevisionMarkupDialog | Create local review settings chrome when a host opens the dialog. |
| displayModes | readonly ReviewDisplayMode[] | Display modes this module unlocks (the free engine renders `proposed` only). |
| pane? | ReviewPaneOptions | The review pane settings the editor starts with. `setReviewPaneOptions` changes them later. |
| revisionItemsOfParagraph | (part: OoxmlPart, paragraphId: string) => readonly ReviewRevisionItem[] | Revisions wholly inside one paragraph — for the conservative local review patch after a text-local body edit. |
ReviewPaneItemFieldsinterfaceSource ↗
The fields of a review item that decide whether the review pane lists it. A ReviewItem and a review item placement both have them.
interface ReviewPaneItemFields| Member | Type | Summary |
|---|---|---|
| kind | 'revision' | 'comment' | 'custom' | The item kind, as `ReviewItem.kind` gives it. |
| parentRevisionId? | string | For a comment, the tracked change it replies to. |
ReviewPaneOptionsinterfaceSource ↗
Review pane settings to change. Every field is optional, and an omitted field keeps its current value.
interface ReviewPaneOptions| Member | Type | Summary |
|---|---|---|
| commentMarkers? | CommentMarkerStyle | Default `'icon'`. |
| opening? | ReviewPaneOpening | Default `'auto'`. |
| overflow? | ReviewPaneOverflow | Default `'float'`. |
| revisionsIn? | RevisionDisplay | Default `'pane'`. |
RevisionAuthorAssignmentsinterfaceSource ↗
Per-author style assignments.
Keys match w:author exactly; a value is a CSS colour or a full [RevisionAuthorStyle](RevisionAuthorStyle). others says what authors WITHOUT an entry take: the --doc-review-author-N ramp by default, or 'kind' to leave them on the kind colours — which is how "highlight these reviewers, leave everyone else green and red" is said.
interface RevisionAuthorAssignments| Member | Type | Summary |
|---|---|---|
| authors | Readonly<Record<string, string | RevisionAuthorStyle>> | |
| others? | 'kind' | 'author' | Authors without an entry: the ramp (default), or the `'kind'` colours. |
RevisionAuthorStyleinterfaceSource ↗
Everything a host can say about ONE author's presentation. Every field is optional and every field is presentation-only — nothing here is ever serialised into the document.
Deliberately about the PAINTED DOCUMENT (which only the painter can style) plus the author's identity data. Review-card DESIGN is not configured here: the review chrome follows color as its accent automatically, and everything further is composition — a custom card reading this style through the review surface's useReviewAuthor, or CSS on the cards' data-review-author/data-review-author-slot hooks.
interface RevisionAuthorStyle| Member | Type | Summary |
|---|---|---|
| activeBackground? | string | Background of the highlight band over this author's OPEN change — the one the caret is in. Applied inline, so it outranks the `--doc-revision-*-active-bg` kind tokens, and the kind-coloured rule under the band goes with it: a custom background with a green or red rule beneath it would contradict the decoration it sits behind, and a `transparent` that left a floating rule would not read as cleared at all. |
| avatarUrl? | string | Avatar image for this author; the packaged card renders it in place of initials. |
| background? | string | Background wash behind this author's changes in the document. |
| color? | string | Ink and decoration colour of this author's changes in the document — and the accent the review chrome keys on (avatar disc, card variable, marker). |
| spanClassName? | string | Class names added to every painted span of this author's changes, for styling the typed fields do not cover. Keep the rules metric-safe (outlines, shadows, accents): the engine measures the text it paints, and a class that resizes glyphs drifts the page from its layout. |
RevisionMarkupChromeHandlersinterfaceSource ↗
Host rendering for the Track changes options dialog.
interface RevisionMarkupChromeHandlers| Member | Type | Summary |
|---|---|---|
| onRequest? | (session: RevisionMarkupDialogSession) => void |
RevisionMarkupDialoginterfaceSource ↗
Viewer settings dialog supplied by the review module.
interface RevisionMarkupDialog| Member | Type | Summary |
|---|---|---|
| destroy | | |
| open | |
RevisionMarkupDialogHostinterfaceSource ↗
Local settings access for review chrome. No document mutations occur here.
interface RevisionMarkupDialogHost extends RevisionMarkupDialogSession| Member | Type | Summary |
|---|---|---|
| container | HTMLElement | |
| translate? | (key: string) => string | undefined |
RevisionMarkupDialogSessioninterfaceSource ↗
A local settings draft owned by the editor.
interface RevisionMarkupDialogSession| Member | Type | Summary |
|---|---|---|
| apply | | Commit the draft and close. Returns false after cancellation. |
| canApply | | |
| cancel | | Close without committing the draft. |
| get | | Read the immutable draft. |
| reset | | Restore default preferences in the draft only. |
| set | | Merge validated options into the draft without committing preferences. |
| signal | AbortSignal | Aborts on close, replacement, load, detach, destroy, or renderer disposal. |
| subscribe | | Observe draft changes, including effective external preference changes. |
RevisionMarkupStyleinterfaceSource ↗
interface RevisionMarkupStyle<Mark extends string = RevisionMarkupMark>| Member | Type | Summary |
|---|---|---|
| color | RevisionMarkupColor | |
| mark | Mark |
RevisionMarkupTextStyleinterfaceSource ↗
Viewer-only text styling. Document highlighting remains unchanged.
interface RevisionMarkupTextStyle<Mark extends string = RevisionMarkupMark> extends RevisionMarkupStyle<Mark>| Member | Type | Summary |
|---|---|---|
| background | RevisionMarkupNamedColor | 'byAuthor' | 'none' | Background color behind revision text. Defaults to `none`. |
RulerDragOptionsinterfaceSource ↗
How a ruler drag resolves: which grid it snaps to, and whether it snaps at all.
interface RulerDragOptions| Member | Type | Summary |
|---|---|---|
| precise? | boolean | Alt held: continuous, twip-precision drag, bypassing the snap grid — as in Word. |
| unit? | RulerUnit | Which snap grid applies. Defaults to inches. |
RulerIndentinterfaceSource ↗
A paragraph's indent as the ruler works with it. Twips; firstLine signed.
interface RulerIndent| Member | Type | Summary |
|---|---|---|
| firstLine | number | |
| left | number | |
| right | number | |
| rtl? | boolean | The paragraph reads right to left. Its `left` indent is then the LEADING one, on the right margin, and its first-line offset counts from there, so the ruler axis mirrors. |
RulerMarginTickinterfaceSource ↗
One horizontal ruler tick, in twips from the page's left sheet edge.
interface RulerMarginTick| Member | Type | Summary |
|---|---|---|
| height | number | Tick length in CSS pixels: 8 for a whole unit, 5 for a half, 3 or 2 for minor ticks. |
| label? | string | Whole units from the paragraph's leading margin; omitted at the margin and on minor ticks. |
| position | number | Twips from the page's left sheet edge. |
RulerPageMetricsinterfaceSource ↗
The page the handles are placed against. Twips.
interface RulerPageMetrics| Member | Type | Summary |
|---|---|---|
| leftMargin | number | |
| pageWidth | number | |
| rightMargin | number |
RulerTickinterfaceSource ↗
One tick on the ruler: where it sits, how tall it is, and its label if it carries one.
interface RulerTick| Member | Type | Summary |
|---|---|---|
| height | number | |
| label? | string | Whole-unit label, omitted at the origin and on minor ticks. |
| position | number | Offset along the ruler in content pixels. |
RunTableChromeCommandResultinterfaceSource ↗
Result of [runTableChromeCommand](runTableChromeCommand): engine outcome plus post-pick draft on success.
interface RunTableChromeCommandResult| Member | Type | Summary |
|---|---|---|
| nextDraft | TableChromeDraft | null | |
| result | ExecResult |
ScrollToAnchorOptionsinterfaceSource ↗
Scroll settings for [EditorAnchorNavigation.scrollToAnchor](EditorAnchorNavigation.scrollToAnchor). Every field is optional. The fields match document refresh NavigateToChangeOptions.
interface ScrollToAnchorOptions| Member | Type | Summary |
|---|---|---|
| behavior? | 'instant' | 'smooth' | Default: instant. Reduced motion uses instant even when smooth is requested. |
| block? | ScrollPlacement | Target placement. The default depends on the method: `scrollToAnchor` uses `'centerIfNeeded'`, which keeps the viewport still for a visible target, and `scrollToBlock` uses `'start'`. |
| offsetPx? | number | Edge padding for start/nearest placement, in CSS pixels. Default: 24. Finite and nonnegative. |
SectionPropertiesinterfaceSource ↗
One section's resolved w:sectPr, as layout needs it.
Resolved, not raw: defaults the file omitted are filled in here (an absent w:type is nextPage), so layout never has to know which attributes were authored and which were inherited.
interface SectionProperties| Member | Type | Summary |
|---|---|---|
| breakType | SectionBreakType | Absent `w:type` defaults to `nextPage`. |
| columns | SectionColumns | |
| gridLinePitchTwips? | number | Active document grid line pitch: line-unit paragraph margins and line snapping. |
| landscape | boolean | |
| margins | SectionMargins | |
| pageBorders? | SectionPageBorders | Resolved `w:pgBorders` (§17.6.10). Absent when the section declares none, or when every edge it declares is off or an art border — see [parsePageBorders](parsePageBorders). |
| pageNumbering? | SectionPageNumbering | Authored page-number type. Absent when `w:pgNumType` is missing; empty object when the element is present with no attributes (comprehensive-fixture shape). |
| pageSize | {
readonly widthTwips: number;
readonly heightTwips: number;
} | |
| titlePage | boolean | |
| verticalAlign? | SectionVerticalAlign | Authored `w:vAlign` (§17.6.23) other than `top`: where the body sits between the top and bottom of the text area. Absent means top alignment. |
SelectedDrawingOverlayTargetinterfaceSource ↗
The painted geometry of the selected drawing, plus what the overlay is allowed to do to it.
Carries BOTH the painted rect (points, for hit-testing and handle placement) and the stored extent (EMU, for writing back), so the overlay never has to convert between the two spaces to decide what it is looking at.
interface SelectedDrawingOverlayTarget| Member | Type | Summary |
|---|---|---|
| anchorFrameOrigin | {
readonly x: number;
readonly y: number;
} | null | |
| aspectLocked | boolean | Hard lock from `noChangeAspect` — never overridden by Shift. |
| canMove | boolean | |
| canResize | boolean | |
| height | number | |
| heightEmu | number | |
| id | string | |
| kind | 'inline' | 'anchored' | |
| pageIndex | number | |
| position | DrawingPositionInput | null | |
| textbox? | boolean | Keep the text area available for pointer editing through the frame. |
| textEditable? | boolean | False for a text box whose text takes no caret: rotated or vertical text, or a story holding a table. Absent for a drawing that is not a text box. |
| transform | DrawingTransform | |
| width | number | |
| widthEmu | number | |
| x | number | |
| y | number |
SelectedImageStateinterfaceSource ↗
Canonical selected-image read model shared by [EditorSnapshot.image](EditorSnapshot.image) and [Editor.getSelectedImage](Editor.getSelectedImage).
interface SelectedImageState| Member | Type | Summary |
|---|---|---|
| canChangeWrap | boolean | Whether `setImageWrapType` applies: pictures only, never text boxes. |
| canCrop | boolean | Whether `setImageProperties` can crop: pictures only, never text boxes. |
| canMove | boolean | Whether `setImagePosition` can move the drawing. False for an inline drawing, which flows with its line, for a locked or hidden drawing, a rotated legacy VML text box, and in viewing mode. |
| canResize | boolean | Whether `setImageProperties` can change the size. False for a hidden drawing, a drawing whose size is locked, a rotated legacy VML text box or one sized as a percentage of a frame, and in viewing mode. An inline text box resizes. |
| crop | ImageCropPercent | Crop inset per edge in UI percent (0–100); OOXML stores permille (×1000). |
| description | string | |
| heightEmu | number | |
| hyperlink | string | null | |
| id | string | |
| intrinsic | Readonly<{
readonly pixelWidth: number;
readonly pixelHeight: number;
readonly dpiX: number;
readonly dpiY: number;
}> | null | |
| kind | DrawingKind | |
| locks | DrawingLocks | |
| name | string | |
| position | DrawingPositionInput | null | |
| resourceStatus | ImageResourceState['kind'] | |
| rotationDegrees | number | |
| title | string | |
| widthEmu | number | |
| wrap | ImageWrapTarget |
SemanticPositioninterfaceSource ↗
A caret position in the model.
interface SemanticPosition| Member | Type | Summary |
|---|---|---|
| offset | number | |
| paragraphId | string |
SemanticSelectioninterfaceSource ↗
A selection as two semantic positions — never as DOM nodes.
anchor is where the selection started and head is where it currently ends, so head before anchor is an ordinary backwards selection rather than an error. Collapsed when the two are equal, which is what a caret is.
interface SemanticSelection| Member | Type | Summary |
|---|---|---|
| anchor | SemanticPosition | |
| head | SemanticPosition |
SplitCellCountsinterfaceSource ↗
Typed split counts read against the cell's limits.
interface SplitCellCounts| Member | Type | Summary |
|---|---|---|
| counts | {
readonly rows: number;
readonly cols: number;
} | null | The counts to ask the engine about, or null while a problem stands. |
| problem | SplitCellCountProblem | null |
SplitCellLimitsinterfaceSource ↗
The most rows and columns a cell splits into, as splitCellConfig answers.
interface SplitCellLimits| Member | Type | Summary |
|---|---|---|
| maxCols | number | |
| maxRows | number |
SurfaceEquationinterfaceSource ↗
One addressable inline equation and its compact editable projection.
interface SurfaceEquation| Member | Type | Summary |
|---|---|---|
| end | number | |
| fallbackText | string | |
| id | string | |
| linear | string | |
| paragraphId | string | |
| start | number | |
| supported | boolean | True when every source construct belongs to the editable subset. |
SurfaceExtentinterfaceSource ↗
interface SurfaceExtent| Member | Type | Summary |
|---|---|---|
| height | number | |
| pageOffsetX | ReadonlyMap<number, number> | |
| width | number |
SurfaceFormattinginterfaceSource ↗
What the selection is currently formatted as.
A value is present only when EVERY span in the selection agrees on it: a selection running from 11pt into 14pt has no font size, and a toolbar should show a blank rather than pick one of the two and imply the whole selection is that.
interface SurfaceFormatting| Member | Type | Summary |
|---|---|---|
| alignment | 'left' | 'center' | 'right' | 'both' | null | |
| bold | boolean | |
| color | string | null | |
| direction | 'ltr' | 'rtl' | null | Paragraph base direction through the cascade; null when the selection mixes them. |
| disagrees | ParagraphDisagreements | Which of the paragraph-level reads above are `null` because the selection DISAGREES, as opposed to because nothing states them. See [ParagraphDisagreements](ParagraphDisagreements). |
| fontFamily | string | null | |
| fontSizeHalfPoints | number | null | Half-points, the unit OOXML stores and the picker expects. |
| highlight | string | null | |
| indent | IndentFormatting | null | Effective indent at the selection, in twips, or null with no selection or inside a table. |
| italic | boolean | |
| lineSpacing | {
readonly rule: 'multiple' | 'exact' | 'atLeast';
readonly value: number;
} | null | `w:spacing`'s line rule and its value: LINES for `multiple`, points for the other two (`w:line` is 240ths of a line under `auto` and twentieths of a point otherwise). The effective value: a paragraph whose cascade states none reads as single spacing (`multiple`, 1). Null when the selection's paragraphs disagree. |
| paragraphFlags | ParagraphFlags | The paragraph flags the Paragraph dialog shows as checkboxes, or null when the selection's paragraphs disagree about that one. |
| spaceAfterPt | number | null | |
| spaceBeforePt | number | null | `w:spacing/@w:before` and `@w:after` in points, null when the selection disagrees. |
| strikethrough | boolean | |
| styleId | string | null | |
| subscript | boolean | |
| superscript | boolean | |
| tabStops | readonly ParagraphTabStop[] | null | The paragraph's resolved custom tab stops, cascade included, or null when the selection disagrees or nothing is loaded. Positions in TWIPS, like every other measurement a control writes back. |
| underline | boolean |
SurfaceHyperlinkinterfaceSource ↗
A hyperlink as the surface reports it: its identity, where it sits, and the SANITIZED target. href: null is an inert link — a refused scheme or a dangling relationship — which a UI shows and offers to edit but must never offer to open.
interface SurfaceHyperlink| Member | Type | Summary |
|---|---|---|
| anchor? | string | |
| authored | string | The authored target, for an editor to seed its input with. |
| end | number | |
| href | string | null | Sanitized projection: an absolute URL, `#anchor`, or null when inert. |
| id | string | Canonical node id of the `w:hyperlink`. |
| kind | 'external' | 'internal' | 'unresolved' | |
| paragraphId | string | |
| start | number | UTF-16 range of the link's display text within its paragraph. |
| text | string | |
| tooltip? | string |
SurfaceIndentAndListOpsinterfaceSource ↗
Indent and list commands of the paginated surface.
interface SurfaceIndentAndListOps| Member | Type | Summary |
|---|---|---|
| adjustIndent | | Word's Increase/Decrease Indent, over every paragraph the selection touches. |
| canAdjustIndent | | Whether Increase/Decrease Indent would do anything right now. |
| exitListOnEmptyItem | | Enter on an empty list item: outdent a level, or leave the list at level 0. Backspace at an item's start (`removeListNumber`): drop its number and keep the text in place. Both answer false when they did not handle the key, so the caller splits or joins. |
| indentWithTab | | Tab (`increase`) or Shift+Tab (`decrease`) over a selection outside a list and outside a table cell (the key moves between cells there): change the indent and keep the text. |
| isListActive | | Whether every paragraph the selection touches is already a list of `kind`. |
| isListParagraph | | Whether the paragraph at the caret is a list item, for Tab's Word-like fallback. |
| removeListNumber | | Backspace at the start of `paragraphId`: drop its list number; false if it is not one. |
| removeParagraphIndent | | Backspace at the start of an unnumbered `paragraphId`: remove its left and first-line or hanging indent, or step it back to the marker of the list item it lines up with. |
| setIndent | | Set indent to exact values on every paragraph the selection touches — what a ruler drag and an indent spinner both need, where [adjustIndent](adjustIndent) only steps. |
| toggleList | | Word's Bullets and Numbering buttons. |
SurfaceNavigationinterfaceSource ↗
Moving the caret and the viewport: to a position, to a bookmark, or out to an external target.
[SurfaceNavigation.openExternal](SurfaceNavigation.openExternal) is THE external-activation call site, and it refuses anything but an already-sanitized href. Routing an authored target through some other path is how a document gets to choose where a click goes.
interface SurfaceNavigation| Member | Type | Summary |
|---|---|---|
| destroy | | |
| goToBookmark | | Scroll a bookmark into view and place the caret at it. Answers false for a name no bookmark declares — an inert click, which is what Word does with a dangling anchor. |
| goToPosition | | With `orShow`, a story that cannot be opened is scrolled to without moving the caret into it, and the answer is `'shown'`. With `center`, the target is centered in the viewport unless it is already well inside it, so it never lands under chrome at the top edge. |
| openExternal | | THE external-activation call site. Refuses anything but a sanitized projection, so a caller cannot route an authored target through it by mistake. |
SurfaceOverlayCoordinatesinterfaceSource ↗
What an overlay needs to place itself over the painted pages: the zoom scale, and where each page sits horizontally.
Per-page X offsets rather than one origin, because pages are centred independently and a narrower page in a mixed-size document does not start where its neighbours do.
interface SurfaceOverlayCoordinates| Member | Type | Summary |
|---|---|---|
| pageOffsetX | ReadonlyMap<number, number> | |
| paintScale | number |
SurfaceParagraphFormatinterfaceSource ↗
Every field of the Paragraph dialog, in the units the rest of this contract uses: points for spacing, TWIPS for indents.
An omitted field is left as authored. Where null is allowed it REMOVES the setting, which is not the same as writing a zero — a zero blocks the cascade, a removal lets the style through again.
interface SurfaceParagraphFormat| Member | Type | Summary |
|---|---|---|
| alignment? | 'left' | 'center' | 'right' | 'both' | |
| contextualSpacing? | boolean | |
| direction? | 'ltr' | 'rtl' | Base direction; see `directionalParagraphEntry` for what each value writes. |
| indentFirstLineTwips? | number | null | ONE signed first-line offset: negative is a hanging indent (§17.3.1.12). |
| indentLeftTwips? | number | null | |
| indentRightTwips? | number | null | |
| keepLines? | boolean | |
| keepNext? | boolean | |
| lineSpacing? | {
readonly rule: 'multiple' | 'exact' | 'atLeast';
readonly value: number;
} | null | |
| pageBreakBefore? | boolean | |
| spaceAfterPt? | number | null | |
| spaceBeforePt? | number | null | |
| tabStops? | readonly ParagraphTabStop[] | Replace the paragraph's custom tab stops. An empty list CLEARS them, which is what Word's "Clear All" does; omit the field to leave them as authored. |
| widowControl? | boolean |
TableBorderStyleOptioninterfaceSource ↗
One entry in the border-style picker, with the CSS class that draws its preview line.
interface TableBorderStyleOption| Member | Type | Summary |
|---|---|---|
| labelKey | string | |
| previewClass | string | Class on the preview swatch. Defined in the core stylesheet, which both adapters import. |
| value | TableBorderStyle |
TableBorderTargetOptioninterfaceSource ↗
One entry in the border-target picker: which edges it addresses, its icon, and its label key.
interface TableBorderTargetOption| Member | Type | Summary |
|---|---|---|
| icon | keyof typeof GENERATED_ICON_PATHS | |
| labelKey | string | i18n key, never a literal string — both adapters translate it themselves. |
| value | TableBorderTargetValue |
TableBorderWidthOptioninterfaceSource ↗
One entry in the border-width picker.
interface TableBorderWidthOption| Member | Type | Summary |
|---|---|---|
| labelKey | string | |
| previewThickness | number | Points, for drawing the preview swatch. `size / 8`. |
| size | number | `w:sz` — eighths of a point, as OOXML stores border widths. |
TableChromeDraftinterfaceSource ↗
UI draft: last active edge scope and the complete border spec to reapply.
interface TableChromeDraft| Member | Type | Summary |
|---|---|---|
| activeTarget | TableBorderEdgeTarget | |
| spec | TableBorderSpec |
TableChromePickinterfaceSource ↗
What one table-chrome selection produced: the command to run, and the draft to remember.
Both halves matter. A border picker is stateful — choosing "dashed" and then "outside" must apply a dashed outside border — so each pick returns the COMPLETE spec to execute alongside the draft the next pick builds on.
interface TableChromePick| Member | Type | Summary |
|---|---|---|
| command | EditorCommand | |
| nextDraft | TableChromeDraft |
TextFormFieldChromeHandlersinterfaceSource ↗
Framework-owned presentation for core-owned Field Options sessions.
interface TextFormFieldChromeHandlers| Member | Type | Summary |
|---|---|---|
| onRequest? | (session: TextFormFieldDialogSession) => void |
TextFormFieldDialogSessioninterfaceSource ↗
A core-owned options edit. Its signal aborts when the dialog must close.
interface TextFormFieldDialogSession| Member | Type | Summary |
|---|---|---|
| apply | | Save one undoable edit. A refused write leaves the session open. |
| canApply | | Whether the current target exists and permits editing. Draft validation happens on apply. |
| cancel | | Close without changing the document. Safe to call more than once. |
| field | TextFormFieldRange | |
| signal | AbortSignal |
TextMatchinterfaceSource ↗
One occurrence of a search query in the document.
Carries TWO addresses on purpose. blockId + start is the engine's own: stable across edits and independent of ordering. paragraphIndex + runIndex + runOffset is the positional one a find/replace UI needs to show and navigate results, and it is derived from the same walk rather than left to the caller to reconstruct — a caller guessing at run boundaries would send the selection to the wrong place.
A match can span runs when formatting changes mid-word; the run address is where it STARTS. scope identifies a non-body story so navigation opens the correct surface. A frame scope selects its anchoring drawing and never places a caret inside its story. A match inside a field result reports the field atom's model range. Its length is one, while text carries the visible match and can be longer. Select with start and length. Never derive the selected length from text.length.
interface TextMatch| Member | Type | Summary |
|---|---|---|
| blockId | string | |
| contextAfter? | string | |
| contextBefore? | string | Paragraph text immediately before and after the match, bounded at the derivation boundary. A results list shows the match in its sentence — "…as described in this **Exhi**bit A" — and nothing else in the contract can reach paragraph text, so a caller would otherwise have to re-read the document to render one row. |
| length | number | |
| paragraphIndex | number | Paragraph ordinal within this match's story. Table and nested-table paragraphs count. Non-paragraph blocks add no ordinal. |
| runIndex | number | Index of the run the match starts in, and the offset within that run. |
| runOffset | number | |
| scope? | ViewScope | Story containing the match. Absence means the body. |
| start | number | Character offset within the paragraph's concatenated run text. |
| text | string | The matched text as it appears in the document. |
TextMeasurerinterfaceSource ↗
Text measurement, injected.
A real implementation shapes with the resolved font; the tests supply a deterministic one. Layout never reads the DOM, so this is the only way width and height enter it.
interface TextMeasurer| Member | Type | Summary |
|---|---|---|
| caretAdvances | | Optional whole-span logical caret advances, indexed by UTF-16 offset. Values are nondecreasing, start at zero, and end at the measured advance. Ligature interiors may share an edge. Undefined selects a bounded approximate fallback. |
| hasResolvedFont | | Whether line metrics use an admitted face instead of approximate fallback metrics. |
| inkBounds | | Optional conservative ink bounds for one grapheme, in points from its origin. Includes size and horizontal scale, but not trailing character spacing. Undefined keeps layout on the advance-only path. |
| lineMetrics | | Line metrics for the actual text faces; omitted text measures the primary face. |
| measure | | Advance width of `text` in the resolved style. |
| strikeoutMetrics | | Optional `OS/2` strikeout stroke for the resolved face, at the drawn size. Word paints `w:separator` as a strikeout, so the note rule reads its thickness and offset here rather than assuming one face's numbers. Undefined keeps the caller's own default. |
| textOutline | | Optional glyph outlines of a whole string, for text drawn as a shape (VML text art). Undefined when the face cannot answer; the shape then paints nothing rather than guess. |
TocRemovalRefusalinterfaceSource ↗
Why a table of contents cannot be removed: none is addressed, or it cannot go now.
interface TocRemovalRefusal| Member | Type | Summary |
|---|---|---|
| code | 'notFound' | 'unsupported' | |
| reason | string |
ToolbarCommandStateinterfaceSource ↗
Whether one control is enabled, and the engine's reason when it is not.
interface ToolbarCommandState| Member | Type | Summary |
|---|---|---|
| active | boolean | Whether the command is currently APPLIED at the selection, from `Editor.isActive` — derived in the engine for marks and alignment, honest-false elsewhere. |
| disabledReason | string | null | The engine's reason when disabled — surfaced as a tooltip, never invented. |
| enabled | boolean | |
| id | ChromeSlotId | |
| value? | string | What the control currently SHOWS, for the slots whose answer is a value rather than a pressed state — the editing-mode pill, and image wrap when it lands. |
ToolbarValueMapinterfaceSource ↗
Value types accepted by toolbar controls. Font size uses half-points.
interface ToolbarValueMap| Member | Type | Summary |
|---|---|---|
| "font.family" | string | |
| "font.size" | number | |
| "image.altText" | string | |
| "image.wrap" | ImageWrapTarget | |
| "list.lineSpacing" | number | |
| "review.editingMode" | 'editing' | 'suggesting' | 'viewing' | |
| "styles.style" | string | |
| "text.color" | string | |
| "text.highlight" | string |
TreeApplyResultinterfaceSource ↗
What applying ops produced: whether it committed, and why not when it did not.
committed and rejected are separate flags because they are not opposites — a batch of zero ops neither commits nor is rejected.
interface TreeApplyResult| Member | Type | Summary |
|---|---|---|
| committed | boolean | |
| opCount | number | |
| reason? | TreeBindingRejection | StoryTargetRejection | string | Present when the edit was refused, so a host can report WHY rather than a silent no-op. |
| rejected | boolean |
TreeDocxSessionViewinterfaceSource ↗
One open document: the canonical tree, and the only write path into it.
applyTreeOps is that path. Every mutation is a TreeDocOp addressed by node id plus UTF-16 offset, applied in one transaction, which is what makes cell and nested paragraphs ordinary rather than special cases.
Holds the whole package, not just the body — headers, footers, notes, comments and styles are all reachable through it, and parts the engine does not model are preserved verbatim.
interface TreeDocxSessionView extends HeadlessDocumentView| Member | Type | Summary |
|---|---|---|
| applyFragmentPaste | | Land a clipboard fragment (resource merge + blocks) as one package undo unit. |
| applyImageProperties | | Apply image property tree ops plus hyperlink relationship wiring atomically. |
| applyTreeOps | | Commit typed tree ops directly, as ONE transaction. |
| applyTreeOpsAtomic | | Commit several stories' ops as ONE transaction and ONE undo unit. |
| beginComposition | | |
| bodyText | | Body text, paragraphs joined by newlines, read from the CANONICAL tree. |
| bookmarks | | `bookmarkName -> { paragraphId, offset }` over the main part, memoized per revision. |
| canRedo | | |
| canUndo | | |
| collaborationPort | | Narrow provider-neutral attachment over this session's canonical package store. |
| currentPackage | | The current package with every opened story store merged in. Authority for layout resolution and save — never a swapped single-part view. |
| deleteComment | | Delete a comment thread outright — body, thread state and story markers. |
| deleteComments | | Delete several comment objects as one package transaction and one undo unit. |
| deleteImage | | Delete a picture drawing and collect orphaned media in one package undo unit. |
| deleteImageTracked | | Propose the drawing's deletion as a tracked change (`w:del`); media stays untouched. |
| documentFonts | | Font family names the document uses, from every `w:rFonts` in the CURRENT main part plus the styles and header/footer parts — validated, deduplicated, sorted. Memoized per package revision. |
| documentOutline | | The heading outline of the BODY story, in document order: paragraphs whose `w:pStyle` resolves to a heading through the styles part (built-in `heading N` name, or the style's own `w:outlineLvl` 0..8). Memoized per main-part revision — an edit can retitle, add or remove a heading, but the styles part cannot change in-session. |
| documentProperties | | The document's own metadata from `docProps/core.xml` and `docProps/app.xml`, for document-property fields (TITLE, AUTHOR, SUBJECT, KEYWORDS, LASTSAVEDBY, COMMENTS). Read once per package revision; an empty object when the parts are absent. |
| documentStyles | | Validated style-picker projection. A document without styles answers `[]`. |
| documentThemeColors | | The theme's ten picker colours (`a:clrScheme`), in Word's column order, or `[]` when the package has no complete scheme. Memoized once: the theme part is immutable for the session's lifetime. |
| documentThemeFonts | | The theme part's Latin typefaces, for resolving `w:rFonts` theme references in layout. |
| editable | boolean | Whether the body holds at least one editable paragraph. |
| effectiveRunDefaults | | The run formatting a paragraph's content INHERITS when it authors none: the paragraph style's `basedOn` chain, then `w:docDefaults`, with theme `rFonts` attributes resolved through the font scheme. `runProperties` (the span's own authored properties) lets a theme-only run-level `w:rFonts` resolve too. This is what lets a toolbar always show the effective font, the way Word does. |
| embeddedFonts | | The faces the package EMBEDS (`word/fontTable.xml` embed relationships), deobfuscated — the only font source that needs neither a substitute nor a network. Extraction asserts nothing about validity; admitting a face is the font resource lane's job. Memoized once: the font table and font parts are immutable in-session. |
| endComposition | | |
| ensureHyperlinkRelationship | | The relationship id for an external hyperlink target on the part owning `scope` (default: body), minting one if that part has none, or `null` when the URL is refused or the scoped part cannot be resolved. |
| ensureListDefinition | | Find or create a `kind` list definition and answer the `w:numId` to name, or `null`. |
| ensureNumberingLevel | | Declare `level` in the list definition `numId` names, with Word's default format for that depth, or answer false. |
| findText | | Every occurrence of `query` across editable stories, in navigation order. Each match uses the same offset vocabulary as tree operations and surface selections. |
| findText | | Many queries in one walk of the document, one result per query in the same order. |
| hasReviewContent | | Whether the document carries review content — tracked changes or comment anchors — regardless of any review module. Derived from store vocabulary only (never the review model), memoized per revision: it is the free tier's honest "this document has more than you are seeing" signal. |
| headerFooterParts | | The resolved header/footer parts of the section, by variant (phase 2). |
| headerFooterPartsBySection | | Per-section header/footer parts after OOXML inheritance, index-aligned with `enumerateDocumentSections`. |
| headerFooterResolutionBySection | | Per-section resolution with declared-vs-inherited metadata for "Same as previous" chrome. Index-aligned with `headerFooterPartsBySection`. |
| insertCustomNode | | `scope` names the story the paragraph is in, and defaults to the body. |
| insertImage | | Insert a validated raster image as one package undo unit (task 12). |
| nodeIdOf | | Canonical node id for a `w14:paraId`, matched case-insensitively, or null. |
| numberingRoot | | Root of the numbering part tree (`w:numbering`), for list layout. Memoized once; `null` when the package has no numbering part. Numbering editing is a later slice. |
| packageRevision | | Package-wide revision — bumps on any story commit (body or HF). |
| paragraphAnchors | | The `w14:paraId` ↔ node-id index over the full editable set of the MAIN part, memoized per revision. Every editable paragraph carries a valid, part-unique id (established at open, maintained by the split appliers), so every paragraph is mapped. Header/footer paragraphs become addressable through `partFor` once their story store is open. |
| paragraphIds | | Canonical node ids of the body paragraphs, in order. |
| paragraphIdsIn | | Canonical node ids of paragraphs in a story scope. Defaults to the body. Header/footer scopes address the part `EditorScope { kind: 'headerFooter'; rId }` names. |
| paraIdOf | | `w14:paraId` of a canonical paragraph node id, verbatim, or null. |
| part | | The current canonical BODY part — what layout reads for the main story. |
| partFor | | The current part for a story scope, or null when the target is refused. |
| redo | | |
| relationshipTarget | | What the owning part's relationships answer for one `r:id` under `scope` (default: body): the authored target and whether it is external. `null` for an id the part does not declare, or when the scoped part is not open. |
| removeCustomNode | | Remove a custom node and the payload it bound. `scope` names the story holding it and defaults to the body; a chip in a header is refused against the body store. |
| renderedFontFamilies | | Font families the document's RENDERED text resolves to, over the story roots only: direct run `w:rFonts` of text-bearing runs plus the style chains those runs, paragraphs and tables actually reference — never a declaration in an unused style. Memoized per package revision. |
| rendersText | | Whether the document puts any literal character on a page, over the same roots [TreeDocxSessionView.documentFonts](TreeDocxSessionView.documentFonts) reads. Memoized per package revision. |
| replaceImage | | Replace a picture drawing's embedded media in one package undo unit. |
| replacePackage | | Replace the whole package with one derived from [currentPackage](currentPackage), as one package undo unit that publishes a `global` change. For writes that rebuild many parts, such as a compare. |
| replyToComment | | Reply to a comment, or add one over a revision's range. Returns the new comment's id. |
| reviewItems | | Every pending review decision in the document, memoized per revision. |
| revision | | Body-store revision (independent of header/footer store revisions). |
| revisionFor | | Per-story revision, or null when the target is refused. |
| save | | Serialize the whole package back to DOCX bytes. |
| saveSteps | | [save](save) in steps a caller can pause between. The package is captured at the call, so the bytes describe the document as it was then, whatever happens between steps. |
| setCommentResolved | | Resolve a comment thread, or reopen it. False when the document holds no such comment. |
| settingsRoot | | Root of the settings part tree (`w:settings`), for document-wide layout constants such as `w:defaultTabStop`. Memoized once; `null` when the package has no settings part. Settings editing is a later slice, so this is immutable for the session. |
| storyParts | | Every part that holds a story, body first, then headers, footers and note parts. |
| storyText | | Text of a story scope, paragraphs joined by newlines. |
| stylesRoot | | Current styles root for layout, or `null` when the package has no styles part. |
| subscribe | | |
| sweepCustomNodePayloads | | Drop every payload no control binds, in the stores whose namespaces a module claims. |
| symbolFontFamilies | | Font families named by a `w:sym/@w:font`, over the same roots [TreeDocxSessionView.documentFonts](TreeDocxSessionView.documentFonts) reads. Memoized per package revision. |
| trackingSettings | | What `settings.xml` says about tracking — `w:trackRevisions`, the tracked-changes protection, and the two do-not-track switches. |
| undo | | Undo the last entry, returning the selection to restore. |
UnsupportedElementinterfaceSource ↗
One occurrence that a custom component can replace: a placeholder for content the editor cannot render, or, with includePartial, a drawing that the editor renders without some features. The drawing fields are present only for drawings.
interface UnsupportedElement| Member | Type | Summary |
|---|---|---|
| bounds? | LayoutBox | Reserved geometry in document points, when the element has been laid out. Always present for a drawing, and it includes the effect extent, as the page of `createDrawingPreviewPackage` does. |
| drawing? | InlineDrawingRecord | AnchoredDrawingRecord | The layout record of a drawing. Use `graphicKind` to identify the graphic: the record's `placeholderGraphicKind` names the graphic only for placeholders. A chart whose chart part can be read also carries `chart`, whose `shownAs` describes the native presentation. Absent for other content. |
| drawingIssues? | readonly DrawingSupportIssue[] | The features of this drawing that the editor does not show as authored, read from its own XML. Chart and diagram parts, inherited theme effects, and image bytes are not read, so an empty list does not prove fidelity. Never holds `unplaced-drawing` or `projection-diagnostic`, which only a report lists. For a placeholder, `graphicKind` names the graphic that the editor cannot draw. |
| equation? | EquationSpanRecord | The layout record of an equation shown as the built-in placeholder. |
| graphicKind? | DrawingGraphicKind | The graphic a drawing holds, such as `picture`, `chart`, or `diagram`, from its source. Note: `textbox` names every DrawingML shape, with or without text, and `shape` names only legacy VML drawings. |
| label | string | The text of the built-in placeholder. |
| localName | string | The local name of the source element, such as `drawing` or `AlternateContent`. |
| namespaceUri | string | null | The namespace of the source element, such as the WordprocessingML namespace. |
| nodeId | string | The node the occurrence comes from, in the editor's current document. |
| ownerPartName | string | The part that holds it, such as `/word/document.xml` or `/word/header1.xml`. |
| placement | 'inline' | 'block' | `inline` inside a line of text, or `block` between paragraphs. |
| source | OoxmlElement | null | Lossless canonical source. Treat this value as read-only and untrusted. The object identity stays unchanged until the drawing content changes. Use `source` to identify cached previews across component remounts. Editor occurrences always provide a source. Standalone painters without a source lookup return `null`. |
| support? | Exclude<DrawingSupport, 'native'> | How completely the editor shows this drawing: `unrendered` for a placeholder, or `partial` for a drawing that renders without some features, offered only with `includePartial`. Absent for content that is not a drawing. |
UnsupportedElementHostinterfaceSource ↗
A component mount point and its built-in fallback.
interface UnsupportedElementHost| Member | Type | Summary |
|---|---|---|
| element | HTMLElement | |
| fallback | HTMLElement | |
| key | string | Stable identity for one painted occurrence. |
| setCustomized | | Hide the default and expose custom controls to assistive technology. Restore with false. |
| slot | HTMLElement | |
| unsupported | UnsupportedElement |
UnsupportedElementLayoutinterfaceSource ↗
Dimensions reserved before pagination, in document points.
interface UnsupportedElementLayout| Member | Type | Summary |
|---|---|---|
| height | number | Height in points: finite, positive, and at most 100,000. |
| width | number | Width in points: finite, positive, and at most 100,000. |
UnsupportedElementRuleinterfaceSource ↗
The first matching registration renders each unsupported element.
interface UnsupportedElementRule| Member | Type | Summary |
|---|---|---|
| includePartial? | boolean | Include partially rendered drawings (`support: 'partial'`). Defaults to `false`. Excludes fully supported drawings, hidden drawings, and drawings without a layout position. Excludes shapes with editable text. Partially rendered shapes without text remain eligible. |
| layout? | UnsupportedElementLayout | The box to reserve for content that has no layout box of its own, in points. |
| match? | (element: UnsupportedElement) => boolean | Return true to replace this occurrence. Omit to match every offered occurrence. Offered occurrences also include equations and other content that is not a drawing; test `element.drawing` to match drawings only. |
WatchHighlightsOptionsinterfaceSource ↗
Options for [watchHighlights](watchHighlights).
interface WatchHighlightsOptions extends HighlightOptions| Member | Type | Summary |
|---|---|---|
| onResult? | (result: HighlightResult) => void | Called when the applied and unavailable counts change. |
WatermarkSizeinterfaceSource ↗
A width and a height in points.
interface WatermarkSize| Member | Type | Summary |
|---|---|---|
| height | number | |
| width | number |
Type aliases (84)
BookmarkSortOrdertypeSource ↗
How the Bookmark dialog orders its list: by name, or by where each bookmark is.
type BookmarkSortOrder = 'name' | 'location';ChromeControlIdtypeSource ↗
Every control id in the chrome, as a literal union. Unique WITHIN a group, not globally (image.insert / table.insert) — key consumers on [ChromeSlotId](ChromeSlotId).
type ChromeControlId = ChromeSlotId extends `${string}.${infer C}` ? C : never;ChromeControlStatetypeSource ↗
HOW a control reaches the engine — never WHETHER it is enabled.
Enabled state has exactly one source: toolbarCommandState(editor, slot), which asks Editor.can. The registry is static data and cannot know what the engine will honour at this selection, in this document, at this moment.
There used to be a fourth member, parityOnly, meaning "visible but permanently disabled". It was a second, static answer to the question Editor.can already answers, and it went stale the moment the engine wired underline, strike, the four alignments, the list commands and the four value slots: the registry still said parity-only, React ignored it and ran them, and Vue believed it and rendered twelve WORKING commands permanently disabled. A slot the engine has not wired needs no registry flag — commandForSlot answers null and toolbarCommandState disables the control with the engine's own words ("not wired to an editor command").
type ChromeControlState =
/**
* Dispatched as one fixed engine command: enabled when
* `Editor.can(commandForSlot(slot))` succeeds, a click runs
* `runToolbarCommand(editor, slot)`. The command is resolved from the SLOT id
* through `commandForSlot` in toolbar-commands.ts — the one command table both
* adapters share. A slot with no row there is simply not wired YET, and says so
* through the engine rather than through this descriptor.
*/
{
readonly kind: 'command';
}
/**
* Dispatched with a PICKED value: `commandForSlotValue(slot, value)`. Enabled when
* the engine would honour a well-formed value right now (`toolbarCommandState`
* probes for exactly that), so the control needs chrome that produces a value — a
* font list, a size, a colour — before a click means anything.
*
* A distinct kind because 'command' cannot describe it: there is no fixed command
* to hand `Editor.can`, and a bare click has nothing to send.
*/
| {
readonly kind: 'value';
}
/** `Editor.save()` — not a command (see `runSave`). */
| {
readonly kind: 'save';
}
/**
* `Editor.load()` — not a command either, and the exact twin of `save`: bytes cross the
* boundary between the host and the engine, and only the host can produce them. The
* control needs chrome that reads a file (a picker, a drop target) before a click means
* anything, so a bare click has nothing to send — the same reason `save` is not `command`.
*
* A fourth kind rather than reusing `save` because the two dispatch in opposite
* directions, and an adapter branching on `kind` must be able to tell them apart. Unlike
* the deleted `parityOnly`, this one IS named by a control (`file.open`).
*/
| {
readonly kind: 'load';
}
/** Host conversion through `runChromeExport` or `runChromePrint`; not an editing command. */
| {
readonly kind: 'export';
};ChromeExportFormattypeSource ↗
File menu conversion formats.
type ChromeExportFormat = 'markdown' | 'pdf';ChromeGroupIdtypeSource ↗
Every group id in the chrome, as a literal union. Stable public API; renaming a group id is a breaking change.
type ChromeGroupId = 'history' | 'zoom' | 'styles' | 'font' | 'text' | 'script' | 'alignment' | 'direction' | 'list' | 'format' | 'review' | 'contentControl' | 'image' | 'table' | 'paragraph' | 'file' | 'insert';ChromeMenuEntrytypeSource ↗
One row of a chrome menu.
type ChromeMenuEntry = ChromeMenuItemEntry | ChromeMenuSubmenuEntry | ChromeMenuSeparatorEntry;ChromeMenuIdtypeSource ↗
Every menu id, as a literal union. Stable public API; renaming one is a breaking change, exactly like a group or slot id.
type ChromeMenuId = 'file' | 'format' | 'insert' | 'review' | 'help';ChromePrintErrorCodetypeSource ↗
Why the browser could not print the converted PDF.
type ChromePrintErrorCode = 'pdf-viewer-unavailable' | 'pdf-load-failed' | 'print-refused' | 'print-ended';ChromeSlotIdtypeSource ↗
The public slot vocabulary: ${groupId}.${controlId} for every control that actually exists — text.bold, font.family, alignment.left. THE stable contract a host composes against and commandForSlot resolves; renaming a slot is a breaking change.
type ChromeSlotId = 'history.undo' | 'history.redo' | 'zoom.level' | 'styles.style' | 'font.family' | 'font.size' | 'text.bold' | 'text.italic' | 'text.underline' | 'text.strike' | 'text.color' | 'text.highlight' | 'text.link' | 'script.super' | 'script.sub' | 'alignment.left' | 'alignment.center' | 'alignment.right' | 'alignment.justify' | 'direction.ltr' | 'direction.rtl' | 'list.bullet' | 'list.numbered' | 'list.outdent' | 'list.indent' | 'list.lineSpacing' | 'format.painter' | 'format.clear' | 'review.revisionMarkup' | 'review.comments' | 'review.addComment' | 'review.paragraphMarks' | 'review.bookmarks' | 'review.protectDocument' | 'review.compareDocuments' | 'review.simpleMarkup' | 'review.allMarkup' | 'review.noMarkup' | 'review.original' | 'review.previousChange' | 'review.nextChange' | 'review.acceptAllChanges' | 'review.rejectAllChanges' | 'review.authors' | 'review.editingMode' | 'contentControl.showAll' | 'contentControl.formFill' | 'contentControl.inspector' | 'contentControl.remove' | 'image.insert' | 'image.properties' | 'image.wrap' | 'image.altText' | 'table.insert' | 'table.borderTarget' | 'table.borderColor' | 'table.borderStyle' | 'table.borderWidth' | 'table.cellFill' | 'table.mergeCells' | 'table.splitCell' | 'file.open' | 'file.save' | 'file.exportMarkdown' | 'file.exportPdf' | 'file.print' | 'paragraph.dialog' | 'file.pageSetup' | 'insert.textBox' | 'insert.footnote' | 'insert.endnote' | 'insert.pageNumber' | 'insert.totalPages' | 'insert.sectionPages' | 'insert.pageXofY' | 'insert.pageBreak' | 'insert.sectionBreakNextPage' | 'insert.sectionBreakContinuous' | 'insert.toc' | 'insert.bookmark' | 'insert.goToBookmark' | 'insert.watermark';ClearRefreshHighlightsOptionstypeSource ↗
Explicit highlight dismissal. Document edits always remove stale highlights immediately.
type ClearRefreshHighlightsOptions = ClearAnchorHighlightOptions;CollectReviewItemstypeSource ↗
Derives the review queue — every pending revision decision and comment thread — from one story part plus its comment parts. Implemented by the pro review module; the free engine has no implementation and reports an empty queue.
type CollectReviewItems = (input: ReviewModelInput) => readonly ReviewItem[];ColorLowerResulttypeSource ↗
A public colour lowered for a border or fill op, or the reason it could not be.
Refusals happen because paint needs a literal: a theme colour the document's theme does not define has no hex to draw, and inventing one would show a border in a colour the file never named.
type ColorLowerResult = {
readonly ok: true;
readonly color: TreeDocColorValue;
} | ColorLowerRefusal;CommentMarkerStyletypeSource ↗
How a collapsed comment marker looks.
- 'initials': a badge with the thread author's initials in the author's color, a reply count, and a check mark when the thread is resolved. - 'icon': the comment icon.
type CommentMarkerStyle = 'initials' | 'icon';CompareDocumentsBackgroundEnginetypeSource ↗
Runs a compare off the page's main thread, for example in a worker. The editor's Compare documents dialog uses it when the review module provides one. It reports progress, and it stops when signal aborts: the promise then rejects with the signal's reason.
type CompareDocumentsBackgroundEngine = (original: Uint8Array, revised: Uint8Array, options: CompareDocumentsEngineOptions, control: {
readonly signal: AbortSignal;
readonly onProgress: (progress: CompareDocumentsProgress) => void;
}) => Promise<CompareDocumentsBackgroundResult>;CompareDocumentsBackgroundResulttypeSource ↗
Result of one background compare: like [CompareDocumentsEngineResult](CompareDocumentsEngineResult), as bytes.
type CompareDocumentsBackgroundResult = {
readonly ok: true;
readonly bytes: Uint8Array | null;
readonly revisionCount: number;
readonly changed: boolean;
} | {
readonly ok: false;
readonly code: CompareDocumentsEngineErrorCode;
readonly reason?: CompareDocumentsRefusalReason;
readonly message: string;
};CompareDocumentsEnginetypeSource ↗
Compares the open document (the original) with a revised DOCX and returns the original with the differences as tracked changes. Synchronous, DOM-free, and free of side effects.
type CompareDocumentsEngine = (original: OoxmlPackage, revised: Uint8Array, options: CompareDocumentsEngineOptions) => CompareDocumentsEngineResult;CompareDocumentsEngineErrorCodetypeSource ↗
Why the compare engine refused a compare, as a stable code: the codes that the engine, compareDocuments, and a background engine return. compareDocuments.errors.<code> in @docx-editor.dev/i18n translates every code.
type CompareDocumentsEngineErrorCode =
/**
* An option has a value of the wrong type, such as a `detectFormatChanges` that is not a
* boolean, or the revised document is not a `Uint8Array`.
*/
'invalidOptions'
/** The original document is not a readable DOCX package. */
| 'invalidOriginal'
/** The revised document is not a readable DOCX package. */
| 'invalidRevised'
/** The documents exceed the compare's size limits. */
| 'tooLarge'
/**
* The original document enforces protection that the compare would break: read-only,
* comments, forms, or tracked-changes protection. A compare also writes differences that
* have no tracked form, such as style definitions and content control properties, so
* tracked-changes protection refuses too.
*/
| 'protected'
/** The differences include content that no tracked change can record. */
| 'unsupportedContent';CompareDocumentsEngineResulttypeSource ↗
Result of one document compare.
type CompareDocumentsEngineResult = {
readonly ok: true;
readonly package: OoxmlPackage;
readonly revisionCount: number;
readonly changed: boolean;
} | {
readonly ok: false;
readonly code: CompareDocumentsEngineErrorCode;
readonly reason?: CompareDocumentsRefusalReason;
readonly message: string;
};CompareDocumentsErrorCodetypeSource ↗
Why a compare was refused, as a stable code. compareDocuments.errors.<code> in @docx-editor.dev/i18n translates every code. The engine and compareDocuments return [CompareDocumentsEngineErrorCode](CompareDocumentsEngineErrorCode) values. The editor command and dialog can also return the editor-only codes.
type CompareDocumentsErrorCode = CompareDocumentsEngineErrorCode
/** Editor only: no review module, no open document, or no mount. */
| 'unavailable'
/** Editor only: a collaboration session is attached. */
| 'collaboration'
/** Editor only: the document is open for viewing only. */
| 'viewing'
/** Editor only: the dialog closed, or the compare was canceled, before it finished. */
| 'closed'
/** Editor only: the revised file is a `Uint8Array` with no bytes. */
| 'empty'
/**
* Editor only: another compare of the same dialog runs, or a preview or an external document
* refresh blocks writes to the document. Try again when it ends.
*/
| 'busy'
/**
* Editor only: the open document changed while a background compare ran, so its result
* no longer applies. The editor never retries by itself.
*/
| 'documentChanged'
/** Editor only: any other failure. */
| 'failed';CompareDocumentsOutcometypeSource ↗
The outcome of one compare.
type CompareDocumentsOutcome = {
readonly ok: true;
readonly revisionCount: number;
readonly changed: boolean;
} | {
readonly ok: false;
readonly code: CompareDocumentsErrorCode;
readonly reason?: CompareDocumentsRefusalReason;
readonly message: string;
};CompareDocumentsPhasetypeSource ↗
A step of a compare that runs in the background. The steps run in this order:
1. reading: read both documents. 2. comparing: find their differences. 3. checking: check that accepting and rejecting all changes give back each document. 4. applying: apply the result to the open document.
type CompareDocumentsPhase = 'reading' | 'comparing' | 'checking' | 'applying';CompareDocumentsRefusalReasontypeSource ↗
What an unsupportedContent refusal is about, as a stable code. compareDocuments.reasons.<reason> in @docx-editor.dev/i18n translates every reason.
type CompareDocumentsRefusalReason =
/** The documents differ inside a content control that is locked or bound to data. */
'lockedContent'
/** A document holds tracked changes that cannot be accepted, so its final state is unknown. */
| 'unresolvedRevisions'
/** The documents differ in content with no tracked-change form, such as an embedded file. */
| 'untrackedContent'
/** The revised document adds section or table settings that a reject cannot restore. */
| 'unrecordedSettings'
/** A header or footer of an earlier section cannot be paired with one of the original. */
| 'headerFooter'
/** The result needs a part type that the original document does not declare. */
| 'packageStructure'
/**
* The result fails the check: accepting all changes does not give the revised text, rejecting
* them does not give the original text, or a tracked change cannot be accepted or rejected.
*/
| 'unverified';CustomFontsResolvertypeSource ↗
A font origin that supplies validated application font bytes on demand.
type CustomFontsResolver = MarkedFontResolver<(request: FontResolutionRequest) => Promise<LoadFontsResult>>;DocumentSearchHighlighttypeSource ↗
Which matches a search interface highlights.
type DocumentSearchHighlight = 'all' | 'active' | 'none';DrawingGraphicKindtypeSource ↗
The kind of graphic a drawing holds. Note: textbox names every DrawingML shape, with or without text, and shape names only legacy VML drawings.
Read from its source: picture, chart (a chart), diagram (SmartArt), textbox (a DrawingML shape, with or without text), group (a shape group), canvas (a drawing canvas), shape (a legacy VML drawing, such as WordArt), or graphic (any other graphic). It does not say whether the engine renders the graphic. The names match placeholderGraphicKind, which adds no picture and is set only for placeholders.
type DrawingGraphicKind = 'picture' | 'chart' | 'diagram' | 'shape' | 'group' | 'textbox' | 'canvas' | 'graphic';DrawingPreviewPackageResulttypeSource ↗
A preview package, or why it could not be built.
- drawing-not-found: the target is not a drawing in the package. - too-many-parts or too-large: the drawing needs more than the limits allow.
type DrawingPreviewPackageResult = {
readonly ok: true;
readonly docx: Uint8Array;
readonly pageFitsDrawing: boolean;
readonly copiedParts: readonly string[];
} | {
readonly ok: false;
readonly reason: 'drawing-not-found' | 'too-many-parts' | 'too-large';
};DrawingSelectionIntenttypeSource ↗
How the current selection came to address a drawing — see [PaginatedSurface.drawingSelectionIntent](PaginatedSurface.drawingSelectionIntent).
type DrawingSelectionIntent = {
readonly kind: 'none';
} | {
readonly kind: 'pointer';
readonly drawingNodeId: string;
} | {
readonly kind: 'programmatic';
};DrawingSupporttypeSource ↗
How completely the editor shows a drawing:
- native: the editor renders the drawing and found no unsupported feature in its source. - partial: the editor renders the drawing, but without some features, or it shows a saved fallback. The issue list names the features. - unrendered: the editor shows a placeholder, or the drawing has no layout position.
A drawing that the document itself hides is native or partial: the editor shows it as authored, which is not at all.
Charts and SmartArt diagrams that the editor draws report native, because the check does not read their chart or diagram parts. Inherited theme effects and image bytes are not checked either.
type DrawingSupport = 'native' | 'partial' | 'unrendered';FieldResultsModetypeSource ↗
How saved field results are addressed.
- atomic: every closed field is one offset unit. - editable: the results of CREATEDATE, DATE, FILENAME, FILLIN, HYPERLINK, MERGEFIELD, PRINTDATE, QUOTE, SAVEDATE, SEQ, and TIME fields are text when their results are unnested. Simple fields inside complex field results are not supported in this mode. Other nested results, other field types, and legacy FORMTEXT inputs keep their existing addressing.
type FieldResultsMode = 'atomic' | 'editable';FieldShadingModetypeSource ↗
When a field's result is drawn on its grey block, following Word's own View option.
when-selected is Word's default and the reason the option exists at all: a document dense with cross-references turns largely grey under always, and under never a reader cannot tell computed text from typed text at all.
type FieldShadingMode = 'never' | 'when-selected' | 'always';FontLoadFailureReasontypeSource ↗
Why one font did not load.
Distinguished rather than collapsed to "failed" because the responses differ: networkError and httpError are worth retrying, while hashMismatch and malformed mean the bytes were not what the source claimed and retrying will fetch the same wrong thing.
type FontLoadFailureReason = 'networkError' | 'httpError' | 'hashMismatch' | 'overLimit' | 'emptyResponse'
/** The declared face itself is unusable (empty family, out-of-range weight); nothing was fetched. */
| 'invalidRequest'
/** The bytes are not a font at all — most often an HTML error page served with 200. */
| 'malformed';FontOrigintypeSource ↗
ONE font origin, in the one shape every origin takes: a finished configuration, a fragment, a promise for either, or a marked resolver that answers per document.
The point of the union is that packagedFonts(), googleFonts(), await defaultFonts() and a hand-built { sources } are all the same kind of thing, so a list of them needs no ordering rule beyond "first wins".
The resolver arm is [MarkedFontResolver](MarkedFontResolver), not bare FontResolver: a list may also hold a zero-argument loader, and only the mark separates the two.
type FontOrigin = FontConfiguration | FontConfigurationFragment | MarkedFontResolver | Promise<FontConfiguration | FontConfigurationFragment | undefined> | undefined;FontResolvertypeSource ↗
Resolve fonts once the document's needs are known, instead of ahead of them.
Called after the file is mounted and again when editing requests a new family. Results compose with previously supplied faces; resolvedFaces identifies that coverage. Returning nothing is a valid answer — it means "I cover none of this", and the document stays on the fixed measurer.
A resolver that fetches makes opening a document perform network requests. That is a real change in posture and it must stay the APP's decision: the engine never supplies one, and the families here are file-derived, so a resolver must look them up in a set it shipped rather than interpolate them into a URL.
type FontResolver = (request: FontResolutionRequest) => FontConfiguration | FontConfigurationFragment | undefined | Promise<FontConfiguration | FontConfigurationFragment | undefined>;HighlightSourcetypeSource ↗
Ranges for watchHighlights and useHighlights: an array, or a function of the editor that runs again after document changes.
type HighlightSource = readonly HighlightRange[] | ((editor: Editor) => readonly HighlightRange[]);HostWindowtypeSource ↗
The window type of a realm: its own timers, observers and constructors.
type HostWindow = Window & typeof globalThis;ImageContexttypeSource ↗
The selected image and what may be done to it — the imageContext query's answer.
An alias of SelectedImageState, kept as its own name because it is the query's result type and chrome is written against it.
type ImageContext = SelectedImageState;ImageResizeHandletypeSource ↗
Which of the eight resize handles a drag started from, by compass direction.
type ImageResizeHandle = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';ImageWrapTargettypeSource ↗
Nine Word wrap menu targets (inline plus eight floating modes).
type ImageWrapTarget = 'inline' | 'square' | 'squareLeft' | 'squareRight' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';LineSpacingMenuValuetypeSource ↗
The line spacing a menu row stands for: lines for multiple, points otherwise.
type LineSpacingMenuValue = NonNullable<SurfaceFormatting['lineSpacing']>;LockedControlNavigationtypeSource ↗
How the caret moves through an inline content control whose effective lock is contentLocked or sdtContentLocked.
- 'characters' (the default) — the caret walks through the control's characters, as in Word. - 'atomic' — the control is one caret unit, as a w:showingPlcHdr prompt already is. Arrows step over it, Shift+arrows select it whole, and a press or double click inside it selects it whole. A press on its edge still places a caret beside it.
It applies in the body, headers and footers; notes and text boxes publish no control boundaries, so they keep character navigation.
Navigation only: what a lock refuses does not change. The rule covers keyboard motions and the engine's own pointer gestures. A selection set in code (setSelection, find) is kept as given, and pointer: 'native' leaves caret placement to the browser.
type LockedControlNavigation = 'characters' | 'atomic';MarkedFontResolvertypeSource ↗
A [FontResolver](FontResolver) that has been through [defineFontResolver](defineFontResolver).
This, not bare FontResolver, is what a FontOrigin list accepts. The mark is the only thing separating a resolver from a zero-argument loader, and getting that wrong loses every font silently, so the type asks for it up front.
type MarkedFontResolver<T extends FontResolver = FontResolver> = T & FontResolverMark;NavigationCommandtypeSource ↗
One caret movement, in Word's own vocabulary.
Visual rather than logical where the two differ: left means left on screen, which in right-to-left text is forward through the string.
type NavigationCommand = 'left' | 'right' | 'up' | 'down' | 'wordLeft' | 'wordRight' | 'lineStart' | 'lineEnd' | 'documentStart' | 'documentEnd' | 'pageUp' | 'pageDown';OpenPaginatedResulttypeSource ↗
What opening a document produced: a mounted surface, or a refusal.
A result rather than a throw, because every refusal here comes from FILE input — a package the bounded reader rejected, a part that exceeded a limit — and a malformed upload should surface as a message the host can show rather than an exception it has to catch.
type OpenPaginatedResult = {
readonly ok: true;
readonly surface: PaginatedSurface;
} | {
readonly ok: false;
readonly reason: string;
readonly detail?: string;
readonly limit?: string;
};ParagraphFlagKeytypeSource ↗
The five members that are checkboxes, and so share a label key with their control. *
type ParagraphFlagKey = 'contextualSpacing' | 'keepNext' | 'keepLines' | 'widowControl' | 'pageBreakBefore';ParagraphFlagStatetypeSource ↗
One tri-state paragraph flag: on, off, or "the selection disagrees".
type ParagraphFlagState = boolean | null;RefreshFailureCodetypeSource ↗
Stable refusal codes for external document replacement.
type RefreshFailureCode = 'unavailable' | 'collaboration' | 'busy' | 'cancelled' | 'superseded' | 'document-changed' | 'local-edits' | 'out-of-order' | 'invalid-result' | 'invalid-document' | 'input-failed' | 'load-failed' | 'recovery-failed';RefreshHighlightAnimationtypeSource ↗
Opacity fade settings. Reduced motion caps fades at 125ms.
type RefreshHighlightAnimation = AnchorHighlightAnimation;RefreshResulttypeSource ↗
Completion belongs to one result, including refusals and recovery failures.
type RefreshResult = {
readonly ok: true;
readonly resultId: string;
readonly changes: readonly RefreshChange[];
readonly changeInformation: 'available' | 'unavailable';
readonly failures: readonly string[];
} | {
readonly ok: false;
readonly resultId: string;
readonly code: RefreshFailureCode;
readonly recovered?: boolean;
};RenderableImageMimetypeSource ↗
Every mime the painter can hand to an <img>.
type RenderableImageMime = SupportedImageMime | VectorImageMime;ResolvedChromePrintSettingstypeSource ↗
Print settings with every choice made.
type ResolvedChromePrintSettings = Required<ChromePrintSettings>;ReviewDiagnosticCodetypeSource ↗
Why accepting, rejecting or re-authoring a tracked change skipped an item.
type ReviewDiagnosticCode = 'review.revision-unsupported' | 'review.incomplete-group' | 'review.retained-structure' | 'review.locked-content' | 'review.bound-content' | 'review.stale-revision';ReviewDisplayModetypeSource ↗
The views the review chrome offers, in Word's terms: the three layout projections plus Simple Markup, which reads as the proposed result with a red change bar beside every line a change touched — the document as accepting everything would leave it, and where.
type ReviewDisplayMode = RevisionDisplayMode | 'simple-markup';ReviewOperationtypeSource ↗
What a tracked-change request was asked to do.
type ReviewOperation = 'accept' | 'reject' | 'reassign';ReviewPaneOpeningtypeSource ↗
When the review pane opens by itself.
- 'auto': the pane opens when a document with review items loads, and when a tracked change is made while it is closed, in both cases when the pane has items to list. With revisionsIn: 'balloons' the pane lists no tracked change and no reply to one, so tracked changes and their replies alone do not open it. - 'manual': the pane stays closed until the host or the user opens it. Use it when the host shows review items its own way, such as in balloons or margin markers.
type ReviewPaneOpening = 'auto' | 'manual';ReviewPaneOverflowtypeSource ↗
What the open review pane does when its full card column does not fit beside the page at the page's zoom.
- 'float': the pane shrinks to a strip of markers, and the open card floats over the page. - 'shrinkPage': under a fit zoom mode, the page may shrink down to the mode's minZoom (or 10%) so that the full column fits. The pane changes to the marker strip only when the column does not fit at that floor either. A fixed zoom behaves as 'float'. - 'scroll': the page keeps the size it has beside the closed pane's marker strip, and the full column stands beside it. The document and the column scroll together: the viewport scrolls sideways to reach the cards.
The setting applies to the review pane only. The navigation pane stays docked at its side in every mode: it never scrolls with the document, and it takes its room beside the page exactly as it does with no review pane.
type ReviewPaneOverflow = 'float' | 'shrinkPage' | 'scroll';ReviewWriteIntenttypeSource ↗
Which review write is being committed through commitReviewOps.
The callback that performs the write is opaque, so a lane deciding whether to allow it cannot tell an Accept from a comment delete. That mattered once a replica was attached: these paths reach the store directly rather than through applyTreeOps, and the ones that graft a package and swap the shell record no primitive effects — they replicate as NOTHING, leaving the peer a commentReference naming a comment it never received. Naming the write lets each be admitted only once a two-replica test proves it arrives whole.
type ReviewWriteIntent = 'revision-resolve' | 'revision-attribution' | 'comment-add' | 'comment-reply' | 'comment-resolve' | 'comment-delete' | 'package-scoped';RevisionChangedLinesMarktypeSource ↗
type RevisionChangedLinesMark = 'none' | 'leftBorder' | 'rightBorder' | 'outsideBorder';RevisionDeletionMarktypeSource ↗
type RevisionDeletionMark = RevisionMarkupMark | 'hidden' | 'caret' | 'pound';RevisionDisplaytypeSource ↗
Where tracked changes open.
- 'pane': the review pane lists tracked changes as cards beside the comments. - 'balloons': the pane lists comments only, except comments that reply to a tracked change: the change's balloon shows those. A tracked change opens in a balloon at its text when the reader clicks it, or when Next Change, Previous Change, or setActiveReviewItem(key, { announce: true }) reaches it. A replacement is one balloon. In both settings, Next Change and Previous Change stop on a replacement once.
type RevisionDisplay = 'pane' | 'balloons';RevisionMarkupColortypeSource ↗
type RevisionMarkupColor = RevisionMarkupNamedColor | 'byAuthor' | 'auto';RevisionMarkupMarktypeSource ↗
type RevisionMarkupMark = 'none' | 'colorOnly' | 'bold' | 'italic' | 'underline' | 'doubleUnderline' | 'strikethrough' | 'doubleStrikethrough';RevisionMarkupNamedColortypeSource ↗
type RevisionMarkupNamedColor = (typeof REVISION_MARKUP_COLORS)[number];RevisionMarkupOptionstypeSource ↗
Partial viewer preferences. Omitted values keep the previous value.
type RevisionMarkupOptions = {
readonly [K in keyof ResolvedRevisionMarkup]?: ResolvedRevisionMarkup[K] extends boolean ? boolean : Partial<ResolvedRevisionMarkup[K]>;
};RevisionStylestypeSource ↗
How painted tracked changes are coloured.
- 'author' (the DEFAULT) — every change takes its author's colour from the --doc-review-author-N ramp. An attached document seeds slots by order of first appearance, then keeps those assignments stable for that session. Word's own default, and the reason it is this engine's: a paragraph three people edited has to read as three people. Restyle a slot under .docx-editor to change the ramp. - 'kind' — insertions and deletions take the two kind colours (--doc-revision-insertion / --doc-revision-deletion), so "added" and "removed" are what a reader tells apart at a glance, whoever proposed them. - [RevisionAuthorAssignments](RevisionAuthorAssignments) — style the named authors; others decides whether the rest take the ramp (the default) or the kind colours.
Presentation only: nothing here is ever serialised into the document.
type RevisionStyles = 'kind' | 'author' | RevisionAuthorAssignments;RulerIndentHandletypeSource ↗
The four handles Word's ruler carries.
hanging and left sit at the SAME position and differ only in what a drag takes with them — the box moves the whole paragraph, the triangle leaves the first line where it is.
type RulerIndentHandle = 'firstLine' | 'hanging' | 'left' | 'right';RulerUnittypeSource ↗
Which measurement system the ruler shows. Drives both tick cadence and drag snapping.
type RulerUnit = 'inch' | 'cm';ScrollPlacementtypeSource ↗
Where a scroll places its target in the viewport.
- 'start': near the top, like a jump to a heading. - 'center': centred. - 'centerIfNeeded': still while the target is on screen, centred when it has to move. - 'nearest': the minimum scroll, which leaves the target at the edge it came in from.
Each method that takes a placement states its own default.
type ScrollPlacement = 'start' | 'center' | 'centerIfNeeded' | 'nearest';SectionAnchortypeSource ↗
How a section-addressed op should name the section a caret is in.
w:sectPr lives on the body story, so the op can only name BODY content — and a caret in a header or a note is not body content. The three answers are genuinely different, and collapsing them to "a paragraph or null" is what let an unaddressable section quietly become a document-wide write.
type SectionAnchor =
/** Name this body paragraph. Its section is the one the caret is in. */
{
readonly kind: 'anchor';
readonly paragraphId: string;
}
/** One section: an anchor names nothing extra, so the op may omit it. */
| {
readonly kind: 'whole-document';
}
/**
* Several sections, and the caret's holds no paragraph to name.
*
* An omitted anchor here would write EVERY section, which is what `scope: 'document'` is
* for — so answering it to a `scope: 'section'` request changes sections nobody asked
* about. There is no anchor that reaches an empty final section: one exists only when every
* paragraph already closes an earlier section, so nothing sits at or after it.
*/
| {
readonly kind: 'unaddressable';
};SectionBreakInsertTypetypeSource ↗
Where the section after an inserted break begins — Word's Layout Breaks menu.
evenPage / oddPage sections from a file paginate with their blank parity sheet, but inserting one is not offered here.
type SectionBreakInsertType = 'nextPage' | 'continuous';SectionVerticalAligntypeSource ↗
w:sectPr/w:vAlign values other than the default top.
type SectionVerticalAlign = 'center' | 'bottom' | 'both';SpecialIndenttypeSource ↗
The "Special" pair: the signed first-line offset, split into a kind and a magnitude. *
type SpecialIndent = 'none' | 'firstLine' | 'hanging';SplitCellCountProblemtypeSource ↗
Why typed counts cannot split, before the engine is asked.
type SplitCellCountProblem = {
readonly kind: 'range';
readonly field: 'columns' | 'rows';
readonly max: number;
} | {
readonly kind: 'oneCell';
};SupportedImageMimetypeSource ↗
Raster media the decode port measures and any authoring path may write.
BMP and WebP are here for the same reason the other three are: an <img> decodes them natively, so they need a signature and a structural header and nothing else. BMP is what older documents carry; WebP is what current Word writes.
type SupportedImageMime = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/bmp' | 'image/webp';SurfaceInsertImageInputtypeSource ↗
What a host may set on a surface image insert.
The decode port and the collaboration actor are the SURFACE's to supply. An actor a host could pass would be a second identity for the same mint, which is the thing actor-scoped allocation exists to prevent.
type SurfaceInsertImageInput = Omit<InsertImageInput, 'decodePort' | 'actorId'>;TabAlignmenttypeSource ↗
type TabAlignment = 'left' | 'center' | 'right' | 'decimal' | 'bar';TabLeaderNametypeSource ↗
type TabLeaderName = 'none' | 'dot' | 'hyphen' | 'underscore';TableBorderTargetValuetypeSource ↗
Border target picker value — concrete scopes plus clear (none).
type TableBorderTargetValue = TableBorderEdgeTarget | 'none';TableChromeSlotIdtypeSource ↗
The chrome slots that only exist while the caret is inside a table.
A subset of ChromeSlotId, so these names are public API on the same terms — renaming one is a breaking change.
type TableChromeSlotId = 'table.borderTarget' | 'table.borderColor' | 'table.borderStyle' | 'table.borderWidth' | 'table.cellFill';TableInteractionLabelKeytypeSource ↗
Keys for the table furniture's accessible names, resolved by tableInteractionLabel.
type TableInteractionLabelKey = 'table.insertRowBelow' | 'table.insertColumnRight' | 'table.selectTable';ToolbarSlotValuetypeSource ↗
type ToolbarSlotValue<K extends ToolbarValueSlot> = K extends keyof ToolbarValueMap ? ToolbarValueMap[K] : unknown;ToolbarValueSlottypeSource ↗
type ToolbarValueSlot = keyof ToolbarValueMap | TableChromeSlotId;TrackedChangeFilterModetypeSource ↗
How revisions excluded by a tracked-changes predicate project into the view.
type TrackedChangeFilterMode = 'accept' | 'reject';TrackedChangePredicatetypeSource ↗
Decides whether one tracked change renders as markup.
Return true to keep the revision visible as tracked markup. Return false to render it with the selected [TrackedChangeFilterMode](TrackedChangeFilterMode) without changing the document. The callback receives the complete revision item, including its author, date, kind, text, ranges, nesting, and resolution metadata.
type TrackedChangePredicate = (revision: ReviewRevisionItem) => boolean;VectorImageMimetypeSource ↗
Vector media painted straight from validated bytes. An <img> renders SVG in the browser's secure static mode — no script, no external subresource loads — so there is no decode step and no raster buffer sized by a file-supplied number.
type VectorImageMime = 'image/svg+xml';Variables (50)
AUTO_ZOOM_MODEconstSource ↗
Fit the page width, but never magnify and never shrink past legibility: the default.
A wide container keeps the 100% it has always had, and only one too narrow to hold the sheet shrinks. Uncapped fitting would render a Letter page at 183% on a 1600px monitor, which is a reader app, not Word; unfloored fitting would render it at 20% beside an open comments rail on a phone.
AUTO_ZOOM_MODE: ZoomModeBROWSER_AUTOMATION_CAPABILITIESconstSource ↗
What a browser host can do.
selection, scrolling and layout are true because a mounted editor genuinely has a caret, a scroll container and paginated layout — a consumer may branch on them. The DOCUMENT operations behave identically to the headless host regardless; the extra capabilities widen what may be asked later, never what an existing operation means.
BROWSER_AUTOMATION_CAPABILITIES: AutomationCapabilitiesCHROME_GROUPSconstSource ↗
The complete chrome, in bar order. Literal-typed (as const) so the slot-id vocabulary below is derived from the data and cannot drift from it.
Taxonomy taste: ids are short, lowercaseCamel, and never repeat their group's name (alignment.left, not alignment.alignLeft; font.family, not font.fontFamily).
CHROME_GROUPS: readonly [{
readonly id: 'history';
readonly labelKey: 'formattingBar.groups.history';
readonly controls: readonly [{
readonly id: 'undo';
readonly labelKey: 'formattingBar.undoShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'redo';
readonly labelKey: 'formattingBar.redoShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'zoom';
readonly labelKey: 'formattingBar.groups.zoom';
readonly controls: readonly [{
readonly id: 'level';
readonly shape: 'stepper';
readonly valueText: '100%';
readonly labelKey: 'formattingBar.groups.zoom';
readonly paths: null;
readonly valueKey: 'zoom.zoomLevel';
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'styles';
readonly labelKey: 'formattingBar.groups.styles';
readonly controls: readonly [{
readonly id: 'style';
readonly shape: 'dropdown';
readonly labelKey: 'styles.selectAriaLabel';
readonly paths: null;
readonly valueKey: 'styles.normalText';
readonly state: {
readonly kind: 'value';
};
}];
}, {
readonly id: 'font';
readonly labelKey: 'formattingBar.groups.font';
readonly controls: readonly [{
readonly id: 'family';
readonly shape: 'dropdown';
readonly labelKey: 'font.selectAriaLabel';
readonly paths: null;
readonly valueKey: 'font.sansSerif';
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'size';
readonly shape: 'stepper';
readonly valueText: '11';
readonly labelKey: 'fontSize.listLabel';
readonly paths: null;
readonly valueKey: 'fontSize.label';
readonly state: {
readonly kind: 'value';
};
}];
}, {
readonly id: 'text';
readonly labelKey: 'formattingBar.groups.textFormatting';
readonly controls: readonly [{
readonly id: 'bold';
readonly labelKey: 'formattingBar.boldShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'italic';
readonly labelKey: 'formattingBar.italicShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'underline';
readonly labelKey: 'formattingBar.underlineShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'strike';
readonly labelKey: 'formattingBar.strikethrough';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'color';
readonly shape: 'colorSplit';
readonly swatch: '#ff0000';
readonly labelKey: 'formattingBar.fontColor';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'highlight';
readonly shape: 'colorSplit';
readonly swatch: '#ffff00';
readonly labelKey: 'formattingBar.highlightColor';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'link';
readonly labelKey: 'formattingBar.insertLinkShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'script';
readonly labelKey: 'formattingBar.groups.script';
readonly controls: readonly [{
readonly id: 'super';
readonly labelKey: 'formattingBar.superscript';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'sub';
readonly labelKey: 'formattingBar.subscript';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'alignment';
readonly labelKey: 'formattingBar.groups.alignment';
readonly controls: readonly [{
readonly id: 'left';
readonly labelKey: 'alignment.alignLeft';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'center';
readonly labelKey: 'alignment.center';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'right';
readonly labelKey: 'alignment.alignRight';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'justify';
readonly labelKey: 'alignment.justify';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'direction';
readonly labelKey: 'formattingBar.groups.direction';
readonly contextual: true;
readonly controls: readonly [{
readonly id: 'ltr';
readonly labelKey: 'toolbar.leftToRight';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'rtl';
readonly labelKey: 'toolbar.rightToLeft';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'list';
readonly labelKey: 'formattingBar.groups.listFormatting';
readonly controls: readonly [{
readonly id: 'bullet';
readonly labelKey: 'lists.bulletList';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'numbered';
readonly labelKey: 'lists.numberedList';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'outdent';
readonly labelKey: 'lists.decreaseIndent';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'indent';
readonly labelKey: 'lists.increaseIndent';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'lineSpacing';
readonly shape: 'dropdown';
readonly labelKey: 'lineSpacing.label';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'format';
readonly labelKey: 'formattingBar.groups.format';
readonly controls: readonly [{
readonly id: 'painter';
readonly labelKey: 'formattingBar.formatPainterShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'clear';
readonly labelKey: 'formattingBar.clearFormatting';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'review';
readonly labelKey: 'formattingBar.commentsAndChanges';
readonly controls: readonly [{
readonly id: 'revisionMarkup';
readonly shape: 'icon';
readonly labelKey: 'revisionMarkup.title';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'simpleMarkup';
readonly shape: 'icon';
readonly labelKey: 'review.simpleMarkup';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'allMarkup';
readonly shape: 'icon';
readonly labelKey: 'review.allMarkup';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'noMarkup';
readonly shape: 'icon';
readonly labelKey: 'review.noMarkup';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'original';
readonly shape: 'icon';
readonly labelKey: 'review.original';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'previousChange';
readonly shape: 'icon';
readonly labelKey: 'review.previousChange';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'nextChange';
readonly shape: 'icon';
readonly labelKey: 'review.nextChange';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'acceptAllChanges';
readonly shape: 'icon';
readonly labelKey: 'review.acceptAllChanges';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'rejectAllChanges';
readonly shape: 'icon';
readonly labelKey: 'review.rejectAllChanges';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'paragraphMarks';
readonly shape: 'icon';
readonly labelKey: 'formattingBar.paragraphMarks';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'bookmarks';
readonly shape: 'icon';
readonly labelKey: 'formattingBar.showBookmarks';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'protectDocument';
readonly shape: 'icon';
readonly labelKey: 'review.protectDocument';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'compareDocuments';
readonly shape: 'icon';
readonly labelKey: 'review.compareDocuments';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'comments';
readonly shape: 'icon';
readonly labelKey: 'formattingBar.commentsAndChanges';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'addComment';
readonly shape: 'icon';
readonly labelKey: 'formattingBar.addComment';
readonly defaultToolbar: false;
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'authors';
readonly shape: 'dropdown';
readonly labelKey: 'reviewers.label';
readonly paths: readonly string[];
readonly defaultToolbar: false;
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'editingMode';
readonly shape: 'dropdown';
readonly labelKey: 'editingMode.label';
readonly valueKey: 'editingMode.editing';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'contentControl';
readonly labelKey: 'contentControl.group';
readonly contextual: true;
readonly controls: readonly [{
readonly id: 'showAll';
readonly labelKey: 'contentControl.showAll';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'formFill';
readonly labelKey: 'contentControl.formFill';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'inspector';
readonly labelKey: 'contentControl.inspector';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'remove';
readonly labelKey: 'contentControl.remove';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'image';
readonly labelKey: 'formattingBar.groups.image';
readonly contextual: true;
readonly controls: readonly [{
readonly id: 'insert';
readonly labelKey: 'toolbar.image';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'properties';
readonly labelKey: 'formattingBar.imagePropertiesShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'wrap';
readonly shape: 'dropdown';
readonly labelKey: 'formattingBar.imageWrap';
readonly paths: readonly string[];
readonly valueKey: 'imageWrap.inline';
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'altText';
readonly shape: 'dropdown';
readonly labelKey: 'formattingBar.altText';
readonly paths: null;
readonly valueKey: 'imageProperties.altText';
readonly state: {
readonly kind: 'value';
};
}];
}, {
readonly id: 'table';
readonly labelKey: 'formattingBar.groups.table';
readonly contextual: true;
readonly controls: readonly [{
readonly id: 'insert';
readonly labelKey: 'toolbar.table';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'borderTarget';
readonly shape: 'dropdown';
readonly labelKey: 'table.borders.tooltip';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'borderColor';
readonly shape: 'colorSplit';
readonly swatch: '#000000';
readonly labelKey: 'table.borderColor';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'borderStyle';
readonly shape: 'dropdown';
readonly labelKey: 'table.borders.styleAriaLabel';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'borderWidth';
readonly shape: 'dropdown';
readonly labelKey: 'table.borderWidth';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'cellFill';
readonly shape: 'colorSplit';
readonly swatch: '#ffffff';
readonly labelKey: 'table.cellFillColor';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'value';
};
}, {
readonly id: 'mergeCells';
readonly labelKey: 'table.mergeCells';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'splitCell';
readonly labelKey: 'table.splitCell';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'paragraph';
readonly labelKey: 'dialogs.paragraph.title';
readonly contextual: true;
readonly controls: readonly [{
readonly id: 'dialog';
readonly labelKey: 'lineSpacing.options';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'file';
readonly labelKey: 'toolbar.file';
readonly contextual: true;
readonly controls: readonly [{
readonly id: 'open';
readonly labelKey: 'toolbar.open';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'load';
};
}, {
readonly id: 'save';
readonly labelKey: 'toolbar.saveShortcut';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'save';
};
}, {
readonly id: 'exportMarkdown';
readonly labelKey: 'toolbar.exportMarkdown';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'export';
};
}, {
readonly id: 'exportPdf';
readonly labelKey: 'toolbar.exportPdf';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'export';
};
}, {
readonly id: 'print';
readonly labelKey: 'toolbar.print';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'export';
};
}, {
readonly id: 'pageSetup';
readonly labelKey: 'toolbar.pageSetup';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}, {
readonly id: 'insert';
readonly labelKey: 'toolbar.insert';
readonly contextual: true;
readonly controls: readonly [{
readonly id: 'textBox';
readonly labelKey: 'toolbar.insertTextBox';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'footnote';
readonly labelKey: 'toolbar.insertFootnote';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'endnote';
readonly labelKey: 'toolbar.insertEndnote';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'pageNumber';
readonly labelKey: 'headerFooter.insertPageNumber';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'totalPages';
readonly labelKey: 'headerFooter.insertTotalPages';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'sectionPages';
readonly labelKey: 'headerFooter.insertSectionPages';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'pageXofY';
readonly labelKey: 'headerFooter.insertPageXofY';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'pageBreak';
readonly labelKey: 'toolbar.pageBreak';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'sectionBreakNextPage';
readonly labelKey: 'toolbar.sectionBreakNextPage';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'sectionBreakContinuous';
readonly labelKey: 'toolbar.sectionBreakContinuous';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'toc';
readonly labelKey: 'toolbar.tableOfContents';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'bookmark';
readonly labelKey: 'toolbar.bookmark';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'goToBookmark';
readonly labelKey: 'toolbar.goToBookmark';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}, {
readonly id: 'watermark';
readonly labelKey: 'toolbar.watermark';
readonly paths: readonly string[];
readonly state: {
readonly kind: 'command';
};
}];
}]CHROME_MENUSconstSource ↗
The menu bar the chrome shows above the toolbar, in bar order: File, Format, Insert, Review, Help.
CHROME_MENUS: readonly ChromeMenu[]CHROME_PRINT_DISPLAY_MODESconstSource ↗
The display modes a print form offers, in Review menu order, with their label keys.
CHROME_PRINT_DISPLAY_MODES: readonly {
readonly mode: ReviewDisplayMode;
readonly labelKey: 'review.simpleMarkup' | 'review.allMarkup' | 'review.noMarkup' | 'review.original';
}[]CHROME_UNAVAILABLE_KEYconstSource ↗
Tooltip for adapter controls without a picker; command refusals use engine reasons.
CHROME_UNAVAILABLE_KEY = "formattingBar.unavailableInPreview"COMPARE_DOCUMENTS_ACCEPTconstSource ↗
The accept value for a file input that picks the revised document: DOCX files only.
COMPARE_DOCUMENTS_ACCEPT = ".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document"COMPARE_DOCUMENTS_PHASE_ATTRIBUTEconstSource ↗
The attribute that marks a Compare documents dialog's busy status: the step of a running compare in words. [focusCompareDocumentsControl](focusCompareDocumentsControl) focuses it while nothing else can take focus.
COMPARE_DOCUMENTS_PHASE_ATTRIBUTE = "data-docx-compare-phase"CONTENT_CONTROL_PICTURE_ACCEPTconstSource ↗
The accept list of the engine's picker: what replaceImage takes.
CONTENT_CONTROL_PICTURE_ACCEPT = "image/png,image/jpeg,image/gif,image/bmp,image/webp"DEFAULT_FONTconstSource ↗
The document default font when nothing else says otherwise: Calibri at 11pt.
DEFAULT_FONT: FontConfiguration['defaultFont']DEFAULT_IMAGE_RESOURCE_LIMITSconstSource ↗
The image caps in force when a host configures none. Conservative and finite.
DEFAULT_IMAGE_RESOURCE_LIMITS: ImageResourceLimitsDEFAULT_REVIEW_PANEconstSource ↗
The settings an editor starts with when nothing sets them.
DEFAULT_REVIEW_PANE: ResolvedReviewPaneDEFAULT_REVISION_MARKUPconstSource ↗
Initial viewer preferences.
DEFAULT_REVISION_MARKUP: ResolvedRevisionMarkupDEFAULT_TABLE_CHROME_DRAFTconstSource ↗
The draft a table's border chrome starts from: a 1pt black single border on every edge.
DEFAULT_TABLE_CHROME_DRAFT: TableChromeDraftDEFAULT_WATERMARK_FONTconstSource ↗
The font a text watermark uses when its options name none.
DEFAULT_WATERMARK_FONT = "Calibri"DRAWING_REL_FROM_HconstSource ↗
Legal relativeFrom bases for a horizontal offset (page, margin, column, character, …).
DRAWING_REL_FROM_H: readonly string[]DRAWING_REL_FROM_VconstSource ↗
Legal relativeFrom bases for a vertical offset (page, margin, paragraph, line, …).
DRAWING_REL_FROM_V: readonly string[]EMU_PER_POINTconstSource ↗
EMUs per point. DrawingML stores extents in EMU; layout works in points.
EMU_PER_POINT = 12700FIT_WIDTH_ZOOM_MODEconstSource ↗
Fit the page width in BOTH directions — the uncapped fit, unlike 'auto'.
A shared constant rather than a literal per call site: modes are compared by value, but a control also has to render its own selected state, and two spellings of one mode in two files is how a menu ends up ticking a row the editor is not in.
FIT_WIDTH_ZOOM_MODE: ZoomModeFONT_RESOLVER_BRANDconstSource ↗
The runtime marker defineFontResolver sets and [isFontResolver](isFontResolver) reads.
Exported because a package mirroring the font contract structurally still has to mark the resolvers it builds. A package in that position sets Symbol.for('docx-editor.dev/font-resolver') itself; this constant is the same symbol, named, for everyone who can import it.
FONT_RESOLVER_BRAND: unique symbolFONT_RESOLVER_MARK_KEYconstSource ↗
The namespaced key carrying the type-level half of the mark, and the runtime property name that backs it.
A plain string rather than a symbol on purpose: @docx-editor.dev/fonts has no runtime or type dependency on the engine, so it declares the same mark itself, and two unique symbols in two packages would not unify. Two identical string keys do.
FONT_RESOLVER_MARK_KEY = "docx-editor.dev/font-resolver"HIGHLIGHT_REFRESH_MSconstSource ↗
Milliseconds a function source waits after an edit before it runs again.
HIGHLIGHT_REFRESH_MS = 150IMAGE_OVERLAY_NUDGE_PTconstSource ↗
How far one arrow-key press nudges a selected image, in points.
IMAGE_OVERLAY_NUDGE_PT = 1IMAGE_OVERLAY_NUDGE_SHIFT_PTconstSource ↗
How far Shift+arrow nudges a selected image, in points.
IMAGE_OVERLAY_NUDGE_SHIFT_PT = 10IMAGE_WRAP_TARGETSconstSource ↗
Every text-wrap mode a drawing may be set to, including inline.
IMAGE_WRAP_TARGETS: readonly ImageWrapTarget[]LINE_SPACING_PRESETSconstSource ↗
The multiples the line-spacing menu offers, in lines.
LINE_SPACING_PRESETS: readonly number[]LOADING_SNAPSHOTconstSource ↗
What snapshot() reports before an editor exists: loading, not editable, nothing selected, nothing undoable — never invented state.
LOADING_SNAPSHOT: EditorSnapshotMAX_RESOLVER_FAMILIESconstSource ↗
Ceiling on the families one document can put in front of a resolver.
A resolver typically turns each family into up to four faces, and the resource snapshot refuses more than HARD_MAX_FONT_SOURCES (256) sources — so 64 families is the point past which a document could no longer be served anyway. Capping here means a file declaring thousands of distinct w:rFonts cannot fan a resolver out across thousands of lookups (or fetches) before that limit is ever reached.
MAX_RESOLVER_FAMILIES = 64NO_MIXED_FIELDSconstSource ↗
NO_MIXED_FIELDS: ParagraphDialogMixedPX_PER_CMconstSource ↗
Painted pixels per centimetre, derived from [PX_PER_INCH](PX_PER_INCH).
PX_PER_CM: numberPX_PER_INCHconstSource ↗
The engine paints at 96 px per inch (twips / 15, 1440 twips per inch).
PX_PER_INCH = 96REVISION_MARKUP_COLORSconstSource ↗
Named revision colors. Identifiers are stable and never contain CSS.
REVISION_MARKUP_COLORS: readonly ['black', 'blue', 'turquoise', 'green', 'pink', 'red', 'yellow', 'white', 'darkBlue', 'teal', 'darkGreen', 'violet', 'darkRed', 'darkYellow', 'gray50', 'gray25', 'lightBlue', 'lightYellow', 'lightOrange', 'lightPurple', 'lightGreen', 'gray']SEARCH_DEBOUNCE_MSconstSource ↗
Milliseconds of quiet before a typed query runs.
SEARCH_DEBOUNCE_MS = 150SEARCH_HIGHLIGHT_PRIORITYconstSource ↗
Stacking priority of search highlights, above host sets at the default 0.
SEARCH_HIGHLIGHT_PRIORITY = 10SEARCH_HIGHLIGHT_SETconstSource ↗
The highlight set name the search session owns.
SEARCH_HIGHLIGHT_SET = "search"SEARCH_MATCH_LIMITconstSource ↗
Most matches one search reports; a full result reads as "at least this many".
SEARCH_MATCH_LIMIT = 2000SNAP_TWIPS_CMconstSource ↗
The centimetre ruler's grid is the millimetre.
SNAP_TWIPS_CM: numberSNAP_TWIPS_INCHconstSource ↗
Word snaps ruler drags to the eighth-inch grid its ticks already draw.
SNAP_TWIPS_INCH: numberSPLIT_CELL_FALLBACK_MAXconstSource ↗
The highest count a dialog offers when the editor gives no limit.
SPLIT_CELL_FALLBACK_MAX = 63TAB_ALIGNMENT_LABELSconstSource ↗
One label key per alignment, so the rows read as words rather than as w:val values. *
TAB_ALIGNMENT_LABELS: {
readonly left: 'dialogs.paragraph.tabAlignLeft';
readonly center: 'dialogs.paragraph.tabAlignCenter';
readonly right: 'dialogs.paragraph.tabAlignRight';
readonly decimal: 'dialogs.paragraph.tabAlignDecimal';
readonly bar: 'dialogs.paragraph.tabAlignBar';
}TABLE_BORDER_STYLE_OPTIONSconstSource ↗
The border-style picker's entries.
TABLE_BORDER_STYLE_OPTIONS: readonly TableBorderStyleOption[]TABLE_BORDER_TARGET_OPTIONSconstSource ↗
The border-target picker's entries, in Word's own order, ending with clear.
TABLE_BORDER_TARGET_OPTIONS: readonly TableBorderTargetOption[]TABLE_BORDER_WIDTH_OPTIONSconstSource ↗
Widths in eighths of a point — Word-like presets.
TABLE_BORDER_WIDTH_OPTIONS: readonly TableBorderWidthOption[]TABLE_CHROME_SLOT_IDSconstSource ↗
Every [TableChromeSlotId](TableChromeSlotId), for iteration and for [isTableChromeSlot](isTableChromeSlot).
TABLE_CHROME_SLOT_IDS: readonly TableChromeSlotId[]TEXT_FORM_FORMATSconstSource ↗
Supported format choices for legacy text input fields.
TEXT_FORM_FORMATS: {
readonly regular: readonly ['', 'Uppercase', 'Lowercase', 'First capital', 'Title case'];
readonly number: readonly ['', '0', '0.00', '#,##0', '#,##0.00', '0%', '0.00%'];
readonly date: readonly ['', 'M/d/yyyy', 'MM/dd/yyyy', 'd/M/yyyy', 'dd/MM/yyyy', 'yyyy-MM-dd', 'd MMMM yyyy', 'MMMM d, yyyy'];
}TWIPS_PER_CMconstSource ↗
Twips per centimetre, as Word rounds them.
TWIPS_PER_CM = 567TWIPS_PER_INCHconstSource ↗
Twips per inch, as OOXML defines them.
TWIPS_PER_INCH = 1440WORD_DEFAULT_FONTconstSource ↗
Deprecated. Use [DEFAULT_FONT](DEFAULT_FONT).
WORD_DEFAULT_FONT: FontConfiguration['defaultFont']ZOOM_MAXconstSource ↗
The widest scale the editor contract accepts.
ZOOM_MAX = 5ZOOM_MINconstSource ↗
The narrowest scale the editor contract accepts. One definition, every user.
ZOOM_MIN = 0.1