Description
When using `PaginationMode.Paginated`, annotations whose character offset range spans across a page boundary are silently not rendered by `projectAnnotationsOntoHtml`. The annotation data is valid and the offsets are correct, but no highlight `` appears in the output HTML.
Reproduction
```typescript
const html = await convertDocxToHtml(docxBytes, {
paginationMode: PaginationMode.Paginated,
});
const annotationSet = {
// ... standard fields ...
labelledText: [{
id: "cross-page-1",
annotationLabel: "KEY",
rawText: "...text spanning pages...",
page: 0,
annotationJson: { start: 6263, end: 6365 }, // spans page 2→3 boundary
structural: false,
}],
textLabels: { /* ... */ },
};
// This produces HTML where the annotation is NOT highlighted,
// even though offsets 6263-6365 are valid in the document text.
const result = await projectAnnotationsOntoHtml(html, annotationSet);
```
Expected Behavior
The annotation should be rendered, potentially as:
- A split highlight (one span on page N, another on page N+1), or
- A single highlight spanning both pages (if the page containers allow it)
Actual Behavior
The annotation is silently ignored — no error thrown, no highlight rendered. Other annotations on the same document that don't cross page boundaries render correctly.
Context
This affects OpenContracts' DOCX annotation viewer, where users can select text that spans page boundaries to create annotations. The annotation is correctly stored in the database with valid character offsets, but doesn't display after reload because the projection doesn't render it.
Environment
- docxodus: 5.5.3
- PaginationMode: Paginated
Description
When using `PaginationMode.Paginated`, annotations whose character offset range spans across a page boundary are silently not rendered by `projectAnnotationsOntoHtml`. The annotation data is valid and the offsets are correct, but no highlight `` appears in the output HTML.
Reproduction
```typescript
const html = await convertDocxToHtml(docxBytes, {
paginationMode: PaginationMode.Paginated,
});
const annotationSet = {
// ... standard fields ...
labelledText: [{
id: "cross-page-1",
annotationLabel: "KEY",
rawText: "...text spanning pages...",
page: 0,
annotationJson: { start: 6263, end: 6365 }, // spans page 2→3 boundary
structural: false,
}],
textLabels: { /* ... */ },
};
// This produces HTML where the annotation is NOT highlighted,
// even though offsets 6263-6365 are valid in the document text.
const result = await projectAnnotationsOntoHtml(html, annotationSet);
```
Expected Behavior
The annotation should be rendered, potentially as:
Actual Behavior
The annotation is silently ignored — no error thrown, no highlight rendered. Other annotations on the same document that don't cross page boundaries render correctly.
Context
This affects OpenContracts' DOCX annotation viewer, where users can select text that spans page boundaries to create annotations. The annotation is correctly stored in the database with valid character offsets, but doesn't display after reload because the projection doesn't render it.
Environment