@eigenpal/docx-editor-core/editor
Functions(3)
computeLayout
Run the pure layout compute pass (the 6 steps in this file's header), lifted verbatim from `useLayoutPipeline`. The adapter performs the DOM paint (`renderPages`), scroll-restore, `painter:painted`, and state writeback with the returned values.
declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;createLayoutScheduler
declare function createLayoutScheduler(run: (state: EditorState) => void, scheduleFrame?: (cb: () => void) => number, cancelFrame?: (handle: number) => void): LayoutScheduler;stripScrollFlag
Clear the scroll-into-view flag on `transaction` in place. Call inside `dispatchTransaction` before `state.apply(transaction)`. `probeTr` should be a fresh `view.state.tr` used only for the one-shot drift canary (so the real transaction is never mutated by the probe).
declare function stripScrollFlag(transaction: Transaction, probeTr: Transaction): void;Interfaces(3)
ComputeLayoutInputs
interface ComputeLayoutInputs| Member | Type | Summary |
|---|---|---|
| columns | ColumnLayout | undefined | |
| contentWidth | number | |
| document | Document | null | |
| finalColumns | ColumnLayout | undefined | |
| finalMargins | PageMargins | |
| finalPageSize | PageSizePx | |
| finalSectionProperties | SectionProperties | null | undefined | |
| firstPageFooterContent | HeaderFooter | null | undefined | |
| firstPageHeaderContent | HeaderFooter | null | undefined | |
| footerContent | HeaderFooter | null | undefined | |
| getHfPmDoc | (hf: HeaderFooter) => Node | null | undefined | HF unification: the persistent PM doc for an HF, or null to re-parse content. |
| headerContent | HeaderFooter | null | undefined | Resolved HF objects for the section (default + first-page). |
| margins | PageMargins | |
| measureBlocks | MeasureBlocksFn | |
| pageGap | number | |
| pageSize | PageSizePx | |
| sectionProperties | SectionProperties | null | undefined | |
| state | EditorState | |
| styles | StyleDefinitions | null | undefined | |
| theme | Theme | null | undefined |
LayoutComputation
interface LayoutComputation| Member | Type | Summary |
|---|---|---|
| blocks | FlowBlock[] | |
| firstPageFooterForRender | HeaderFooterContent | undefined | |
| firstPageHeaderForRender | HeaderFooterContent | undefined | |
| footerContentForRender | HeaderFooterContent | undefined | |
| footerDistancePx | number | undefined | |
| footnotesByPage | Map<number, FootnoteRenderItem[]> | undefined | |
| hasTitlePg | boolean | |
| headerContentForRender | HeaderFooterContent | undefined | |
| headerDistancePx | number | undefined | |
| layout | Layout | |
| measures | Measure[] | |
| pageBorders | SectionProperties['pageBorders'] | undefined | |
| watermark | Watermark | undefined |
LayoutScheduler
rAF-coalescing layout scheduler shared by the React and Vue adapters (issue #696 Tier 2). Rapid doc-changing transactions (a burst of keystrokes) collapse to a single layout pass per animation frame: while a frame is pending, later `schedule` calls just replace the target state, so only the final state lays out.
`scheduleFrame`/`cancelFrame` are injected so a headless/test host can pass a synchronous stub; they default to requestAnimationFrame.
interface LayoutScheduler| Member | Type | Summary |
|---|---|---|
| cancel | — | Cancel any pending frame (call on teardown). |
| schedule | — | Request a layout for `state`, coalesced into the pending frame. |
Type aliases(1)
MeasureBlocksFn
Adapter-supplied block measurer (React's is caching).
type MeasureBlocksFn = (blocks: FlowBlock[], contentWidth: number | number[], pageGeometry?: FloatPageGeometry) => Measure[];