@eigenpal/docx-editor-core/layout-bridge/toFlowBlocks
ProseMirror to FlowBlock Converter
Converts a ProseMirror document into FlowBlock[] for the layout engine. Tracks pmStart/pmEnd positions for click-to-position mapping.
The deep import @eigenpal/.../layout-bridge/toFlowBlocks is part of the public surface (Vue adapter + tests), so the per-domain helpers under ./toFlowBlocks/ are re-exported from here to keep that path stable.
Functions (4)
convertBorderSpecToLayoutfunctionSource ↗
Convert an OOXML BorderSpec to a layout-engine BorderStyle. Shared by paragraph borders, cell borders, and header/footer borders.
declare function convertBorderSpecToLayout(border: {
style?: string;
size?: number;
space?: number;
color?: {
rgb?: string;
themeColor?: string;
themeTint?: string;
themeShade?: string;
};
}, theme?: Theme | null): BorderStyle | undefined;resetBlockIdCounterfunctionSource ↗
Reset the block ID counter (useful for testing).
declare function resetBlockIdCounter(): void;resolveListTemplatefunctionSource ↗
Resolve an OOXML lvlText template like "%1.%2." against the counter stack and per-level numFmt list (ECMA-376 §17.9.11).
When a referenced counter has no value yet (e.g. "%2" referenced from a level-0 paragraph), the placeholder AND the punctuation immediately following it are dropped — matches Word's behavior so "%1.%2." renders "1." rather than "1..".
Exported for unit testing.
declare function resolveListTemplate(template: string, counters: number[], levelNumFmts: NumberFormat[] | undefined): string;toFlowBlocksfunctionSource ↗
Convert a ProseMirror document to FlowBlock array.
Walks the document tree, converting each node to the appropriate block type. Tracks pmStart/pmEnd positions for each block for click-to-position mapping.
declare function toFlowBlocks(doc: Node, options?: ToFlowBlocksOptions): FlowBlock[];Type aliases (1)
ToFlowBlocksOptionstypeSource ↗
Options for the conversion.
type ToFlowBlocksOptions = {
defaultFont?: string;
defaultSize?: number;
theme?: Theme | null;
pageContentHeight?: number;
defaultTabStopTwips?: number;
listCounters?: Map<number, number[]>;
listSeenNumIds?: Set<string>;
};