superdoc 1.0.0-beta.28 → 1.0.0-beta.29

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.
Files changed (28) hide show
  1. package/dist/chunks/{PdfViewer-B7Hq0aBG.cjs → PdfViewer-DWBkw4lb.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-5NaTJwvl.es.js → PdfViewer-tNr66QJz.es.js} +1 -1
  3. package/dist/chunks/{index-CLV7-rJY-i5JVHTCR.es.js → index-C-fdgXvG-CG001xE6.es.js} +1 -1
  4. package/dist/chunks/{index-CLV7-rJY-C4coR32S.cjs → index-C-fdgXvG-CIkJMNA_.cjs} +1 -1
  5. package/dist/chunks/{index-W4KMCYbF.es.js → index-C6yeAWhT.es.js} +3 -4
  6. package/dist/chunks/{index-CQPftiv3.cjs → index-DDwDzZCu.cjs} +3 -4
  7. package/dist/chunks/{super-editor.es-DR7G4vGz.cjs → super-editor.es-CbWugsqL.cjs} +200 -61
  8. package/dist/chunks/{super-editor.es-D4MMQONw.es.js → super-editor.es-DUQSn16o.es.js} +200 -61
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-DCpgxLLA.js → converter-GXPldmlh.js} +1 -1
  12. package/dist/super-editor/chunks/{docx-zipper-BvQShjmj.js → docx-zipper-D7QUJRNp.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-Df43-j5L.js → editor-DaDga3Ye.js} +201 -62
  14. package/dist/super-editor/chunks/{index-CLV7-rJY.js → index-C-fdgXvG.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-DCnKrmbU.js → toolbar-DjueghNO.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +202 -64
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -41859,7 +41859,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41859
41859
  static getStoredSuperdocVersion(docx) {
41860
41860
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41861
41861
  }
41862
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.28") {
41862
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.29") {
41863
41863
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41864
41864
  }
41865
41865
  /**
@@ -66889,7 +66889,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66889
66889
  const shouldSkipNodeView = (editor) => {
66890
66890
  return isHeadless(editor);
66891
66891
  };
66892
- const summaryVersion = "1.0.0-beta.28";
66892
+ const summaryVersion = "1.0.0-beta.29";
66893
66893
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
66894
66894
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
66895
66895
  function mapAttributes(attrs) {
@@ -67678,7 +67678,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67678
67678
  { default: remarkStringify2 },
67679
67679
  { default: remarkGfm2 }
67680
67680
  ] = await Promise.all([
67681
- Promise.resolve().then(() => indexCLV7RJY),
67681
+ Promise.resolve().then(() => indexCFdgXvG),
67682
67682
  Promise.resolve().then(() => indexDRCvimau),
67683
67683
  Promise.resolve().then(() => indexC_x_N6Uh),
67684
67684
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -67883,7 +67883,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67883
67883
  * Process collaboration migrations
67884
67884
  */
67885
67885
  processCollaborationMigrations() {
67886
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.28");
67886
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.29");
67887
67887
  if (!this.options.ydoc) return;
67888
67888
  const metaMap = this.options.ydoc.getMap("meta");
67889
67889
  let docVersion = metaMap.get("version");
@@ -68752,7 +68752,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68752
68752
  sectionIndex: section.sectionIndex,
68753
68753
  headerRefs: section.headerRefs,
68754
68754
  footerRefs: section.footerRefs,
68755
- numbering: section.numbering
68755
+ numbering: section.numbering,
68756
+ titlePg: section.titlePg
68756
68757
  });
68757
68758
  });
68758
68759
  }
@@ -69911,6 +69912,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69911
69912
  enableRichHyperlinks: false
69912
69913
  };
69913
69914
  const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors) => {
69915
+ const isTabRun2 = run2.kind === "tab";
69914
69916
  marks.forEach((mark2) => {
69915
69917
  const forwardedDataAttrs = extractDataAttributes(mark2.attrs);
69916
69918
  try {
@@ -69943,11 +69945,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69943
69945
  break;
69944
69946
  }
69945
69947
  case "textStyle":
69946
- applyTextStyleMark(run2, mark2.attrs ?? {}, themeColors);
69948
+ if (!isTabRun2) {
69949
+ applyTextStyleMark(run2, mark2.attrs ?? {}, themeColors);
69950
+ }
69947
69951
  break;
69948
69952
  case "commentMark":
69949
69953
  case "comment": {
69950
- pushCommentAnnotation(run2, mark2.attrs ?? {});
69954
+ if (!isTabRun2) {
69955
+ pushCommentAnnotation(run2, mark2.attrs ?? {});
69956
+ }
69951
69957
  break;
69952
69958
  }
69953
69959
  case "underline": {
@@ -69974,31 +69980,33 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69974
69980
  run2.highlight = resolveColorFromAttributes(mark2.attrs ?? {}, themeColors);
69975
69981
  break;
69976
69982
  case "link": {
69977
- const attrs = mark2.attrs ?? {};
69978
- if (hyperlinkConfig.enableRichHyperlinks) {
69979
- try {
69980
- const link2 = buildFlowRunLink(attrs);
69981
- if (link2) {
69982
- run2.link = link2;
69983
- }
69984
- } catch (error) {
69985
- if (process$1$1.env.NODE_ENV === "development") {
69986
- console.warn("[PM-Adapter] Failed to build rich hyperlink:", error);
69987
- }
69988
- }
69989
- } else if (typeof attrs.href === "string" && attrs.href.trim()) {
69990
- try {
69991
- const sanitized = sanitizeHref(attrs.href);
69992
- if (sanitized && sanitized.href) {
69993
- const legacyLink = {
69994
- href: sanitized.href,
69995
- title: typeof attrs.title === "string" ? attrs.title : void 0
69996
- };
69997
- run2.link = migrateLegacyLink(legacyLink);
69983
+ if (!isTabRun2) {
69984
+ const attrs = mark2.attrs ?? {};
69985
+ if (hyperlinkConfig.enableRichHyperlinks) {
69986
+ try {
69987
+ const link2 = buildFlowRunLink(attrs);
69988
+ if (link2) {
69989
+ run2.link = link2;
69990
+ }
69991
+ } catch (error) {
69992
+ if (process$1$1.env.NODE_ENV === "development") {
69993
+ console.warn("[PM-Adapter] Failed to build rich hyperlink:", error);
69994
+ }
69998
69995
  }
69999
- } catch (error) {
70000
- if (process$1$1.env.NODE_ENV === "development") {
70001
- console.warn("[PM-Adapter] Failed to sanitize link href:", error);
69996
+ } else if (typeof attrs.href === "string" && attrs.href.trim()) {
69997
+ try {
69998
+ const sanitized = sanitizeHref(attrs.href);
69999
+ if (sanitized && sanitized.href) {
70000
+ const legacyLink = {
70001
+ href: sanitized.href,
70002
+ title: typeof attrs.title === "string" ? attrs.title : void 0
70003
+ };
70004
+ run2.link = migrateLegacyLink(legacyLink);
70005
+ }
70006
+ } catch (error) {
70007
+ if (process$1$1.env.NODE_ENV === "development") {
70008
+ console.warn("[PM-Adapter] Failed to sanitize link href:", error);
70009
+ }
70002
70010
  }
70003
70011
  }
70004
70012
  }
@@ -70012,7 +70020,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70012
70020
  console.warn(`[PM-Adapter] Failed to apply mark ${mark2.type}:`, error);
70013
70021
  }
70014
70022
  }
70015
- if (forwardedDataAttrs) {
70023
+ if (forwardedDataAttrs && !isTabRun2) {
70016
70024
  run2.dataAttrs = { ...run2.dataAttrs ?? {}, ...forwardedDataAttrs };
70017
70025
  }
70018
70026
  });
@@ -70034,14 +70042,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70034
70042
  }
70035
70043
  return run2;
70036
70044
  }
70037
- function tabNodeToRun(node2, positions, tabIndex, paragraph2) {
70045
+ function tabNodeToRun(node2, positions, tabIndex, paragraph2, inheritedMarks = []) {
70038
70046
  const pos = positions.get(node2);
70039
70047
  if (!pos) return null;
70040
70048
  const paragraphAttrs = paragraph2.attrs ?? {};
70041
70049
  const paragraphProps = typeof paragraphAttrs.paragraphProperties === "object" && paragraphAttrs.paragraphProperties !== null ? paragraphAttrs.paragraphProperties : {};
70042
70050
  const tabStops = Array.isArray(paragraphAttrs.tabStops) && paragraphAttrs.tabStops.length ? paragraphAttrs.tabStops : Array.isArray(paragraphProps.tabStops) ? paragraphProps.tabStops : void 0;
70043
70051
  const indent2 = paragraphAttrs.indent ?? paragraphProps.indent ?? void 0;
70044
- return {
70052
+ const run2 = {
70045
70053
  kind: "tab",
70046
70054
  text: " ",
70047
70055
  pmStart: pos.start,
@@ -70051,6 +70059,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70051
70059
  indent: indent2,
70052
70060
  leader: node2.attrs?.leader ?? null
70053
70061
  };
70062
+ const marks = [...node2.marks ?? [], ...inheritedMarks ?? []];
70063
+ if (marks.length > 0) {
70064
+ applyMarksToRun(run2, marks);
70065
+ }
70066
+ return run2;
70054
70067
  }
70055
70068
  function tokenNodeToRun(node2, positions, defaultFont, defaultSize, inheritedMarks = [], token, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors) {
70056
70069
  const run2 = {
@@ -71877,9 +71890,26 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71877
71890
  if (isHeadingStyle && (!resolvedIndent || Object.keys(resolvedIndent).length === 0 || onlyFirstLineIndent)) {
71878
71891
  resolvedIndent = { firstLine: 0, hanging: 0, left: resolvedIndent?.left, right: resolvedIndent?.right };
71879
71892
  }
71893
+ let resolvedSpacing = cloneIfObject(resolvedAsRecord.spacing);
71894
+ const tableStyleParagraphProps = context.tableStyleParagraphProps;
71895
+ if (tableStyleParagraphProps?.spacing) {
71896
+ const tableSpacing = tableStyleParagraphProps.spacing;
71897
+ const paragraphHasExplicitSpacing = Boolean(spacing);
71898
+ if (!paragraphHasExplicitSpacing) {
71899
+ resolvedSpacing = {
71900
+ ...resolvedSpacing,
71901
+ ...tableSpacing
71902
+ };
71903
+ } else {
71904
+ resolvedSpacing = {
71905
+ ...tableSpacing,
71906
+ ...resolvedSpacing
71907
+ };
71908
+ }
71909
+ }
71880
71910
  const hydrated = {
71881
71911
  resolved,
71882
- spacing: cloneIfObject(resolvedAsRecord.spacing),
71912
+ spacing: resolvedSpacing,
71883
71913
  indent: resolvedIndent,
71884
71914
  borders: cloneIfObject(resolvedExtended.borders),
71885
71915
  shading: cloneIfObject(resolvedExtended.shading),
@@ -72778,11 +72808,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72778
72808
  }
72779
72809
  }
72780
72810
  paragraphAttrs.wordLayout = wordLayout;
72781
- if (enrichedNumberingProps.resolvedLevelIndent && !hasExplicitIndent) {
72811
+ if (enrichedNumberingProps.resolvedLevelIndent) {
72782
72812
  const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
72813
+ const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
72783
72814
  paragraphAttrs.indent = {
72784
- ...paragraphAttrs.indent,
72785
- ...resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent
72815
+ ...baseIndent,
72816
+ ...normalizedIndent ?? {}
72786
72817
  };
72787
72818
  }
72788
72819
  }
@@ -73847,7 +73878,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73847
73878
  return;
73848
73879
  }
73849
73880
  if (node2.type === "tab") {
73850
- const tabRun = tabNodeToRun(node2, positions, tabOrdinal, para);
73881
+ const tabRun = tabNodeToRun(node2, positions, tabOrdinal, para, inheritedMarks);
73851
73882
  tabOrdinal += 1;
73852
73883
  if (tabRun) {
73853
73884
  currentRuns.push(tabRun);
@@ -74542,6 +74573,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74542
74573
  hydration.justification = referenced.justification;
74543
74574
  }
74544
74575
  }
74576
+ const paragraphProps = extractTableStyleParagraphProps(styleId, context.docx);
74577
+ if (paragraphProps) {
74578
+ hydration.paragraphProps = paragraphProps;
74579
+ }
74545
74580
  }
74546
74581
  if (Object.keys(hydration).length > 0) {
74547
74582
  return hydration;
@@ -74592,6 +74627,51 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74592
74627
  }
74593
74628
  return { width: raw, type: measurement.type };
74594
74629
  };
74630
+ const extractTableStyleParagraphProps = (styleId, docx) => {
74631
+ try {
74632
+ const stylesXml = docx["word/styles.xml"];
74633
+ if (!stylesXml?.elements?.[0]?.elements) return void 0;
74634
+ const styleElements = stylesXml.elements[0].elements.filter((el) => el.name === "w:style");
74635
+ const styleTag = styleElements.find((el) => el.attributes?.["w:styleId"] === styleId);
74636
+ if (!styleTag?.elements) {
74637
+ return void 0;
74638
+ }
74639
+ const pPr = styleTag.elements.find((el) => el.name === "w:pPr");
74640
+ if (!pPr?.elements) {
74641
+ return void 0;
74642
+ }
74643
+ const spacingEl = pPr.elements.find((el) => el.name === "w:spacing");
74644
+ if (!spacingEl?.attributes) {
74645
+ return void 0;
74646
+ }
74647
+ const attrs = spacingEl.attributes;
74648
+ const spacing = {};
74649
+ const before = parseIntSafe(attrs["w:before"]);
74650
+ const after = parseIntSafe(attrs["w:after"]);
74651
+ const line = parseIntSafe(attrs["w:line"]);
74652
+ const rawLineRule = attrs["w:lineRule"];
74653
+ const lineRule = rawLineRule === "auto" || rawLineRule === "exact" || rawLineRule === "atLeast" ? rawLineRule : void 0;
74654
+ if (before != null) spacing.before = twipsToPx$1(before);
74655
+ if (after != null) spacing.after = twipsToPx$1(after);
74656
+ if (line != null) {
74657
+ if (lineRule === "auto") {
74658
+ spacing.line = line / 240;
74659
+ } else {
74660
+ spacing.line = twipsToPx$1(line);
74661
+ }
74662
+ }
74663
+ if (lineRule) spacing.lineRule = lineRule;
74664
+ const result = Object.keys(spacing).length > 0 ? { spacing } : void 0;
74665
+ return result;
74666
+ } catch (err) {
74667
+ return void 0;
74668
+ }
74669
+ };
74670
+ const parseIntSafe = (value) => {
74671
+ if (value == null) return void 0;
74672
+ const num = typeof value === "number" ? value : parseInt(String(value), 10);
74673
+ return Number.isFinite(num) ? num : void 0;
74674
+ };
74595
74675
  const isTableRowNode = (node2) => node2.type === "tableRow" || node2.type === "table_row";
74596
74676
  const isTableCellNode = (node2) => node2.type === "tableCell" || node2.type === "table_cell" || node2.type === "tableHeader" || node2.type === "table_header";
74597
74677
  const normalizeRowHeight = (rowProps) => {
@@ -74611,11 +74691,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74611
74691
  };
74612
74692
  };
74613
74693
  const parseTableCell = (args) => {
74614
- const { cellNode, rowIndex, cellIndex, context, defaultCellPadding } = args;
74694
+ const { cellNode, rowIndex, cellIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
74615
74695
  if (!isTableCellNode(cellNode) || !Array.isArray(cellNode.content)) {
74616
74696
  return null;
74617
74697
  }
74618
74698
  const blocks2 = [];
74699
+ const cellConverterContext = tableStyleParagraphProps ? {
74700
+ ...context.converterContext,
74701
+ tableStyleParagraphProps
74702
+ } : context.converterContext;
74619
74703
  for (const childNode of cellNode.content) {
74620
74704
  if (childNode.type === "paragraph") {
74621
74705
  const paragraphBlocks = context.paragraphToFlowBlocks(
@@ -74626,11 +74710,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74626
74710
  context.defaultSize,
74627
74711
  context.styleContext,
74628
74712
  void 0,
74713
+ // listCounterContext
74629
74714
  context.trackedChanges,
74630
74715
  context.bookmarks,
74631
74716
  context.hyperlinkConfig,
74632
74717
  context.themeColors,
74633
- context.converterContext
74718
+ cellConverterContext
74719
+ // converterContext at position 12
74634
74720
  );
74635
74721
  const paragraph2 = paragraphBlocks.find((b2) => b2.kind === "paragraph");
74636
74722
  if (paragraph2) {
@@ -74673,7 +74759,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74673
74759
  };
74674
74760
  };
74675
74761
  const parseTableRow = (args) => {
74676
- const { rowNode, rowIndex, context, defaultCellPadding } = args;
74762
+ const { rowNode, rowIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
74677
74763
  if (!isTableRowNode(rowNode) || !Array.isArray(rowNode.content)) {
74678
74764
  return null;
74679
74765
  }
@@ -74684,7 +74770,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74684
74770
  rowIndex,
74685
74771
  cellIndex,
74686
74772
  context,
74687
- defaultCellPadding
74773
+ defaultCellPadding,
74774
+ tableStyleParagraphProps
74688
74775
  });
74689
74776
  if (parsedCell) {
74690
74777
  cells.push(parsedCell);
@@ -74793,13 +74880,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74793
74880
  };
74794
74881
  const hydratedTableStyle = hydrateTableStyleAttrs(node2, converterContext);
74795
74882
  const defaultCellPadding = hydratedTableStyle?.cellPadding;
74883
+ const tableStyleParagraphProps = hydratedTableStyle?.paragraphProps;
74796
74884
  const rows = [];
74797
74885
  node2.content.forEach((rowNode, rowIndex) => {
74798
74886
  const parsedRow = parseTableRow({
74799
74887
  rowNode,
74800
74888
  rowIndex,
74801
74889
  context: parserDeps,
74802
- defaultCellPadding
74890
+ defaultCellPadding,
74891
+ tableStyleParagraphProps
74803
74892
  });
74804
74893
  if (parsedRow) {
74805
74894
  rows.push(parsedRow);
@@ -75055,7 +75144,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75055
75144
  blocks2.push(sectionBreak);
75056
75145
  recordBlockKind(sectionBreak.kind);
75057
75146
  }
75058
- const paragraphConverter = (para, nextBlockId2, positions2, defaultFont2, defaultSize2, context, listCounterContext, trackedChanges, bookmarks2, hyperlinkConfig2) => paragraphToFlowBlocks(
75147
+ const paragraphConverter = (para, nextBlockId2, positions2, defaultFont2, defaultSize2, context, listCounterContext, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => paragraphToFlowBlocks(
75059
75148
  para,
75060
75149
  nextBlockId2,
75061
75150
  positions2,
@@ -75066,8 +75155,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75066
75155
  trackedChanges,
75067
75156
  bookmarks2,
75068
75157
  hyperlinkConfig2,
75069
- themeColors,
75070
- converterContext
75158
+ themeColorsParam ?? themeColors,
75159
+ converterCtx ?? converterContext
75071
75160
  );
75072
75161
  const tableConverter = (node2, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
75073
75162
  node2,
@@ -75847,9 +75936,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75847
75936
  odd: section.footerRefs.odd ?? null
75848
75937
  });
75849
75938
  }
75850
- const hasFirstHeader = Boolean(section.headerRefs?.first);
75851
- const hasFirstFooter = Boolean(section.footerRefs?.first);
75852
- if (hasFirstHeader || hasFirstFooter) {
75939
+ if (section.titlePg === true) {
75853
75940
  identifier.sectionTitlePg.set(idx, true);
75854
75941
  }
75855
75942
  }
@@ -77056,14 +77143,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77056
77143
  const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
77057
77144
  let state2 = ensurePage();
77058
77145
  const availableHeight = state2.contentBottom - state2.cursorY;
77059
- let minRequiredHeight = 0;
77060
- if (measure.rows.length > 0) {
77061
- minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
77062
- } else if (measure.totalHeight > 0) {
77063
- minRequiredHeight = measure.totalHeight;
77064
- }
77065
- if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
77066
- state2 = advanceColumn(state2);
77146
+ const hasPriorFragments = state2.page.fragments.length > 0;
77147
+ const hasMeasuredRows = measure.rows.length > 0 && block.rows.length > 0;
77148
+ if (hasMeasuredRows && hasPriorFragments) {
77149
+ const firstRowCantSplit = block.rows[0]?.attrs?.tableRowProperties?.cantSplit === true;
77150
+ const firstRowHeight = measure.rows[0]?.height ?? measure.totalHeight ?? 0;
77151
+ if (firstRowCantSplit) {
77152
+ if (firstRowHeight > availableHeight) {
77153
+ state2 = advanceColumn(state2);
77154
+ }
77155
+ } else {
77156
+ const partial = computePartialRow(0, block.rows[0], measure, availableHeight);
77157
+ const madeProgress = partial.toLineByCell.some(
77158
+ (toLine, idx) => toLine > (partial.fromLineByCell[idx] || 0)
77159
+ );
77160
+ const hasRenderableHeight = partial.partialHeight > 0;
77161
+ if (!madeProgress || !hasRenderableHeight) {
77162
+ state2 = advanceColumn(state2);
77163
+ }
77164
+ }
77165
+ } else if (hasPriorFragments) {
77166
+ let minRequiredHeight = 0;
77167
+ if (measure.rows.length > 0) {
77168
+ minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
77169
+ } else if (measure.totalHeight > 0) {
77170
+ minRequiredHeight = measure.totalHeight;
77171
+ }
77172
+ if (minRequiredHeight > availableHeight) {
77173
+ state2 = advanceColumn(state2);
77174
+ }
77067
77175
  }
77068
77176
  let currentRow = 0;
77069
77177
  let isTableContinuation = false;
@@ -77128,7 +77236,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77128
77236
  return fromLine < totalLines;
77129
77237
  });
77130
77238
  const fragmentHeight2 = continuationPartialRow.partialHeight + (repeatHeaderCount > 0 ? headerHeight : 0);
77131
- if (fragmentHeight2 > 0) {
77239
+ if (fragmentHeight2 > 0 && madeProgress) {
77132
77240
  const fragment2 = {
77133
77241
  kind: "table",
77134
77242
  blockId: block.id,
@@ -85637,9 +85745,16 @@ ${l}
85637
85745
  tabEl.style.width = `${actualTabWidth}px`;
85638
85746
  tabEl.style.height = `${line.lineHeight}px`;
85639
85747
  tabEl.style.display = "inline-block";
85640
- tabEl.style.visibility = "hidden";
85641
85748
  tabEl.style.pointerEvents = "none";
85642
85749
  tabEl.style.zIndex = "1";
85750
+ if (baseRun.underline) {
85751
+ const underlineStyle = baseRun.underline.style ?? "single";
85752
+ const underlineColor = baseRun.underline.color ?? "#000000";
85753
+ const borderStyle = underlineStyle === "double" ? "double" : "solid";
85754
+ tabEl.style.borderBottom = `1px ${borderStyle} ${underlineColor}`;
85755
+ } else {
85756
+ tabEl.style.visibility = "hidden";
85757
+ }
85643
85758
  if (styleId) {
85644
85759
  tabEl.setAttribute("styleid", styleId);
85645
85760
  }
@@ -85717,6 +85832,28 @@ ${l}
85717
85832
  }
85718
85833
  } else {
85719
85834
  runsForLine.forEach((run2) => {
85835
+ if (run2.kind === "tab") {
85836
+ const tabEl = this.doc.createElement("span");
85837
+ tabEl.classList.add("superdoc-tab");
85838
+ const tabWidth = run2.width ?? 48;
85839
+ tabEl.style.display = "inline-block";
85840
+ tabEl.style.width = `${tabWidth}px`;
85841
+ tabEl.style.height = `${line.lineHeight}px`;
85842
+ tabEl.style.verticalAlign = "bottom";
85843
+ if (run2.underline) {
85844
+ const underlineStyle = run2.underline.style ?? "single";
85845
+ const underlineColor = run2.underline.color ?? "#000000";
85846
+ const borderStyle = underlineStyle === "double" ? "double" : "solid";
85847
+ tabEl.style.borderBottom = `1px ${borderStyle} ${underlineColor}`;
85848
+ }
85849
+ if (styleId) {
85850
+ tabEl.setAttribute("styleid", styleId);
85851
+ }
85852
+ if (run2.pmStart != null) tabEl.dataset.pmStart = String(run2.pmStart);
85853
+ if (run2.pmEnd != null) tabEl.dataset.pmEnd = String(run2.pmEnd);
85854
+ el.appendChild(tabEl);
85855
+ return;
85856
+ }
85720
85857
  const elem = this.renderRun(run2, context, trackedConfig);
85721
85858
  if (elem) {
85722
85859
  if (styleId) {
@@ -86805,8 +86942,10 @@ ${l}
86805
86942
  const indentRight = sanitizePositive(indent2?.right);
86806
86943
  const firstLine = indent2?.firstLine ?? 0;
86807
86944
  const hanging = indent2?.hanging ?? 0;
86945
+ const isWordLayoutList = Boolean(wordLayout?.marker);
86808
86946
  const suppressFirstLine = block.attrs?.suppressFirstLineIndent === true;
86809
- const firstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
86947
+ const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
86948
+ const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
86810
86949
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
86811
86950
  const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
86812
86951
  const tabStops = buildTabStopsPx(
@@ -145637,7 +145776,7 @@ ${style2}
145637
145776
  this.config.colors = shuffleArray(this.config.colors);
145638
145777
  this.userColorMap = /* @__PURE__ */ new Map();
145639
145778
  this.colorIndex = 0;
145640
- this.version = "1.0.0-beta.28";
145779
+ this.version = "1.0.0-beta.29";
145641
145780
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
145642
145781
  this.superdocId = config2.superdocId || v4();
145643
145782
  this.colors = this.config.colors;
@@ -145985,7 +146124,6 @@ ${style2}
145985
146124
  */
145986
146125
  addCommentsList(element2) {
145987
146126
  if (!this.config?.modules?.comments || this.config.role === "viewer") return;
145988
- this.#log("🦋 [superdoc] Adding comments list to:", element2);
145989
146127
  if (element2) this.config.modules.comments.element = element2;
145990
146128
  this.commentsList = new SuperComments(this.config.modules?.comments, this);
145991
146129
  if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
@@ -148082,7 +148220,7 @@ ${style2}
148082
148220
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
148083
148221
  );
148084
148222
  }
148085
- const indexCLV7RJY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
148223
+ const indexCFdgXvG = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
148086
148224
  __proto__: null,
148087
148225
  unified
148088
148226
  }, Symbol.toStringTag, { value: "Module" }));