@file-viewer/docx 0.3.34 → 0.3.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5969,7 +5969,7 @@ class DocumentParser {
5969
5969
  row.className = values.classNameOfCnfStyle(c);
5970
5970
  break;
5971
5971
  case "tblHeader":
5972
- row.isHeader = globalXmlParser.boolAttr(c, "val");
5972
+ row.isHeader = globalXmlParser.boolAttr(c, "val", true);
5973
5973
  break;
5974
5974
  case "gridBefore":
5975
5975
  row.gridBefore = globalXmlParser.intAttr(c, "val");
@@ -8698,6 +8698,7 @@ class HtmlRenderer {
8698
8698
  this.tableCellPositions = [];
8699
8699
  this.currentCellPosition = null;
8700
8700
  this.currentTableRow = null;
8701
+ this.repeatedTableHeaderRows = new WeakSet();
8701
8702
  this.footnoteMap = {};
8702
8703
  this.endnoteMap = {};
8703
8704
  this.currentEndnoteIds = [];
@@ -8751,6 +8752,7 @@ class HtmlRenderer {
8751
8752
  this.endnoteMap = {};
8752
8753
  this.noteNumbering = new NoteNumbering();
8753
8754
  this.renderedNoteIds = new Set();
8755
+ this.repeatedTableHeaderRows = new WeakSet();
8754
8756
  this.noteSectionIds = new Map();
8755
8757
  this.notePageIndex = 1;
8756
8758
  this.dynamicNoteState = new WeakMap();
@@ -9535,8 +9537,14 @@ class HtmlRenderer {
9535
9537
  return;
9536
9538
  const continuation = result.length > 0;
9537
9539
  let fragmentRows = currentRows;
9538
- if (continuation && headerRows.length > 0 && !currentRows.some(row => row.isHeader))
9539
- fragmentRows = [...headerRows, ...currentRows];
9540
+ if (continuation && headerRows.length > 0 && !currentRows.some(row => row.isHeader)) {
9541
+ const repeatedHeaders = headerRows.map(row => {
9542
+ const copy = { ...row };
9543
+ this.repeatedTableHeaderRows.add(copy);
9544
+ return copy;
9545
+ });
9546
+ fragmentRows = [...repeatedHeaders, ...currentRows];
9547
+ }
9540
9548
  result.push({
9541
9549
  table: { ...table, children: fragmentRows },
9542
9550
  breakAfter
@@ -10008,6 +10016,8 @@ class HtmlRenderer {
10008
10016
  const rect = child.getBoundingClientRect();
10009
10017
  bottom = Math.max(bottom, rect.bottom);
10010
10018
  if (child.tagName.toLowerCase() == "article") {
10019
+ if (rect.bottom > bodyBottom + tolerance)
10020
+ return true;
10011
10021
  for (const block of Array.from(child.children)) {
10012
10022
  const blockRect = block.getBoundingClientRect();
10013
10023
  bottom = Math.max(bottom, blockRect.bottom);
@@ -10192,7 +10202,7 @@ class HtmlRenderer {
10192
10202
  getPageBodyBottom(page) {
10193
10203
  const lists = Array.from(page.children).filter(node => node.dataset.docxNoteList);
10194
10204
  const view = page.ownerDocument?.defaultView;
10195
- if (!lists.length || !view)
10205
+ if (!view)
10196
10206
  return page.getBoundingClientRect().bottom;
10197
10207
  let bottom = this.getPageNoteBottom(page);
10198
10208
  for (const list of lists) {
@@ -14009,6 +14019,8 @@ section.${c}>footer { z-index: 1; }
14009
14019
  const row = this.toHTML(elem, ns.html, "tr", children);
14010
14020
  if (elem.isHeader)
14011
14021
  row.dataset.docxRepeatHeader = "true";
14022
+ if (this.repeatedTableHeaderRows.has(elem))
14023
+ row.dataset.docxRepeatedHeader = "true";
14012
14024
  return row;
14013
14025
  }
14014
14026
  renderTableCellPlaceholder(colSpan) {
@@ -14572,7 +14572,7 @@
14572
14572
  row.className = values.classNameOfCnfStyle(c);
14573
14573
  break;
14574
14574
  case "tblHeader":
14575
- row.isHeader = globalXmlParser.boolAttr(c, "val");
14575
+ row.isHeader = globalXmlParser.boolAttr(c, "val", true);
14576
14576
  break;
14577
14577
  case "gridBefore":
14578
14578
  row.gridBefore = globalXmlParser.intAttr(c, "val");
@@ -123,6 +123,7 @@ export declare class HtmlRenderer {
123
123
  tableCellPositions: CellPos[];
124
124
  currentCellPosition: CellPos;
125
125
  currentTableRow: WmlTableRow;
126
+ private repeatedTableHeaderRows;
126
127
  footnoteMap: Record<string, WmlFootnote>;
127
128
  endnoteMap: Record<string, WmlFootnote>;
128
129
  currentFootnoteIds: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/docx",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
4
4
  "description": "Pure HTML DOCX renderer fork for browser-based Word previews.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [