@docx-editor.dev/core/output

@docx-editor.dev/core/output — painting a layout into DOM.

The painted pages ARE the editable surface, but the DOM is a picture: browser mutations are prevented and re-expressed as tree ops, and selection maps only through data-paragraph-id and data-start.

Functions (2)

paintSelectionOverlayfunctionSource ↗

Draw a set of rectangles over the pages.

The layer is a SIBLING of the pages, never a child: the page painter sweeps anything it did not paint out of its own subtree, and a stray child of a contenteditable is editable content a keystroke could land in.

declare function paintSelectionOverlay(layer: HTMLElement, layout: SemanticLayout, rects: readonly OverlayRect[], options: SelectionOverlayOptions): void;

paintSemanticLayoutfunctionSource ↗

Paint a whole layout into a container, reusing the pages that did not change.

The DOM is built with createElement and textContent only — no file-derived string is ever parsed as markup — and stray children (nothing this module painted) are removed, so the container's content is always exactly the painted pages.

declare function paintSemanticLayout(container: HTMLElement, layout: SemanticLayout, options?: PaintOptions): void;

Interfaces (3)

OverlayRectinterfaceSource ↗

A rectangle in page-content coordinates, on a named page.

interface OverlayRect
MemberTypeSummary
className?stringClass for THIS rectangle, overriding the layer's default.
heightnumber
pageIndexnumber
widthnumber
xnumber
ynumber

PaintOptionsinterfaceSource ↗

How a layout is painted into DOM. Every field is optional.

The painted pages ARE the editable surface, so everything here is presentation-only — nothing set through these options is ever serialised back into the document.

interface PaintOptions
MemberTypeSummary
activeHeaderFooterPageIndex?numberSheet that hosts the active visual occurrence of a shared furniture part.
activeHeaderFooterRId?stringRelationship id of the header/footer story currently open for editing.
ariaHidden?booleanMarks painted pages as presentational, so assistive tech reads the editable projection.
contentControlChrome?{ readonly showAll?: boolean; readonly activeIds?: ReadonlySet<string>; readonly hoverIds?: ReadonlySet<string>; readonly suppressedIds?: ReadonlySet<string>; readonly checkedIds?: ReadonlySet<string>; readonly additionalBoundaries?: readonly ContentControlBoundaryRecord[]; readonly tocControlIds?: ReadonlySet<string>; }On-demand content-control boundary chrome (show-all and/or caret-entry).
defaultFontFamily?stringSee [PaintContext.defaultFontFamily](PaintContext.defaultFontFamily).
drawingStrings?DrawingPaintStrings
emptyTocPlaceholderIds?ReadonlySet<string>Empty-TOC begin paragraphs that paint subtle identifiable furniture. Paint-only — never serialised into the document.
fontAlias?(family: string) => string | undefinedFamily-alias lookup for fonts the host registered on behalf of THIS document (see [PaintContext.fontAlias](PaintContext.fontAlias)). Painted runs emit the alias ahead of the declared family, so a file can never shadow a family name the host page uses.
imageUrlPort?PaintImageUrlPort
materialize?ReadonlySet<number>Page indices to build in detail (task 9.4).
readOnlyParagraphIds?ReadonlySet<string>Generated paragraphs that paint as non-editable navigation surfaces.
scale?numberPoints to CSS pixels. 96/72 renders a point as a CSS point at 100% zoom.

SelectionOverlayOptionsinterfaceSource ↗

How the selection overlay draws its rectangles over the painted pages.

scale and pageOffsetX must match what the page painter used, or the highlight lands beside the content it describes rather than on it.

interface SelectionOverlayOptions
MemberTypeSummary
className?stringClass for each painted rectangle. Defaults to the cell-selection class, because a cell rectangle was the only thing this layer drew when it was written.
pageOffsetX?ReadonlyMap<number, number>Per-page horizontal offset the page painter applied, by page index.
scalenumberPoints to CSS pixels.

On this page