import { Node as ProseMirrorNode } from 'prosemirror-model'; export type TextOffsetRange = { start: number; end: number; }; export type ResolvedTextRange = { from: number; to: number; }; /** * Converts an absolute ProseMirror position inside a block to the block's * flattened text offset (same model as {@link resolveTextRangeInBlock}: * text = length, leaf atoms = 1, block separators = 1, inline wrapper * tokens = 0). Returns the total flattened length when `pmPos` is at or * past the end of the block. * * Use this for any PM-selection → TextTarget conversion — subtracting * `pmPos - blockPos - 1` is wrong for blocks with inline wrappers * (`run`, etc.) or leaf atoms, because PM positions include wrapper * boundary tokens that the flattened model does not. */ export declare function pmPositionToTextOffset(blockNode: ProseMirrorNode, blockPos: number, pmPos: number): number; /** * Computes the total flattened text length of a block node using the same * offset model as {@link resolveTextRangeInBlock}: text contributes its * length, leaf atoms contribute 1, block separators contribute 1. */ export declare function computeTextContentLength(blockNode: ProseMirrorNode): number; /** * Resolves block-relative text offsets into absolute ProseMirror positions. * * Uses the same flattened text model as search: * - Text contributes its length. * - Leaf atoms contribute 1. * - Inline wrappers contribute only their inner text. * - Block separators contribute 1 between block children. */ export declare function resolveTextRangeInBlock(blockNode: ProseMirrorNode, blockPos: number, range: TextOffsetRange): ResolvedTextRange | null; //# sourceMappingURL=text-offset-resolver.d.ts.map