@eigenpal/docx-editor-core/prosemirror/paraText
Functions(4)
findParaIdRange
PM position range for a paragraph identified by Word `w14:paraId`. Stable across edits — inverse of `formatContentForLLM`'s `[paraId]` line tag.
Returns inclusive `from` (position before the textblock) and exclusive `to` (`from + nodeSize`). Text content lives in `[from + 1, to - 1]`.
declare function findParaIdRange(doc: Node, paraId: string): {
from: number;
to: number;
} | null;findTextInPmParagraph
Find `searchText` within a PM paragraph range and return its position.
Returns null if: - searchText is empty - searchText is not found - searchText appears more than once (ambiguous; caller disambiguates)
The fullText is built from PM text nodes only and matches the vanilla view the agent reads via `read_document`: tracked insertions are excluded (not in the doc yet), tracked deletions are included (still in the doc until accepted), and comment markers are stripped.
declare function findTextInPmParagraph(doc: Node, paragraphFrom: number, paragraphTo: number, searchText: string): {
from: number;
to: number;
} | null;getVanillaNodeText
Text of a single PM node (typically a paragraph), vanilla view.
declare function getVanillaNodeText(node: Node): string;getVanillaTextBetween
Text between two doc positions, vanilla view.
declare function getVanillaTextBetween(doc: Node, from: number, to: number): string;