/** * ODF comment (`office:annotation`) read/write over a parsed `content.xml` DOM. * * ODF comments are inline: an `office:annotation` (carrying `dc:creator`, `dc:date`, and a * `text:p` body) marks the anchor point, and a paired `office:annotation-end` (same * `office:name`) closes a ranged comment. There is no separate comments part. * * Two insertion paths (a deliberate split — see the `add-odf-comments` design notes): * - whole-paragraph: structural (annotation as the block's first inline child, end after its * last), independent of text segmentation — robust to spans/spaces/tabs/multiple text nodes; * - ranged: split a single host `#text` node at the visible `[start,end)` offsets; a match that * crosses node boundaries returns `MATCH_SPANS_MULTIPLE_NODES`. * * All element matching is by `namespaceURI` + `localName` (ODF prefixes are not guaranteed). */ /** A comment read back from the document. */ export type OdfComment = { id: number; author: string; date: string | null; initials: string; text: string; anchoredParagraphId: string | null; }; export type AddAnnotationParams = { /** Visible offset of the range start; omit (with `end`) to bracket the whole paragraph. */ start?: number; /** Visible offset of the range end (exclusive). */ end?: number; author: string; text: string; initials?: string; }; export type AddAnnotationResult = { ok: true; commentId: number; name: string; } | { ok: false; code: 'MATCH_SPANS_MULTIPLE_NODES' | 'INVALID_RANGE'; message: string; }; /** * Insert an annotation on `block`. With no `start`/`end` the whole paragraph is bracketed; with a * range, a single host `#text` node is split. Returns the allocated comment id, or * `MATCH_SPANS_MULTIPLE_NODES` if a ranged match crosses node boundaries. */ export declare function addAnnotation(doc: Document, block: Element, params: AddAnnotationParams): AddAnnotationResult; /** * Read every `office:annotation` across `blocks` (document order) into structured comments. * Numeric ids are parsed from `__Annot__` names; annotations whose names don't match the * convention are assigned ids sequentially after the max parsed value (a documented limitation). */ export declare function readAnnotations(blocks: Element[]): OdfComment[]; //# sourceMappingURL=comments.d.ts.map