superdoc 1.0.0-beta.27 → 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-iCAmPXap.cjs → PdfViewer-DWBkw4lb.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DGrlCXZ4.es.js → PdfViewer-tNr66QJz.es.js} +1 -1
  3. package/dist/chunks/{index-B9InP_01-Xwm9fBmW.es.js → index-C-fdgXvG-CG001xE6.es.js} +1 -1
  4. package/dist/chunks/{index-B9InP_01-BiyU244m.cjs → index-C-fdgXvG-CIkJMNA_.cjs} +1 -1
  5. package/dist/chunks/{index-DqPOJm-d.es.js → index-C6yeAWhT.es.js} +3 -4
  6. package/dist/chunks/{index-0fejVel3.cjs → index-DDwDzZCu.cjs} +3 -4
  7. package/dist/chunks/{super-editor.es-BU2yH1Gu.cjs → super-editor.es-CbWugsqL.cjs} +204 -63
  8. package/dist/chunks/{super-editor.es-C7-Cnj9g.es.js → super-editor.es-DUQSn16o.es.js} +204 -63
  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-Djir61CW.js → converter-GXPldmlh.js} +5 -3
  12. package/dist/super-editor/chunks/{docx-zipper-CHXUPlGv.js → docx-zipper-D7QUJRNp.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-DFDdrZ-w.js → editor-DaDga3Ye.js} +201 -62
  14. package/dist/super-editor/chunks/{index-B9InP_01.js → index-C-fdgXvG.js} +1 -1
  15. package/dist/super-editor/chunks/{toolbar-D1rWwsr9.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 +206 -66
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -39196,7 +39196,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39196
39196
  "w:fldSimple",
39197
39197
  "w:proofErr",
39198
39198
  "w:del",
39199
- "w:ins"
39199
+ "w:ins",
39200
+ "w:p"
39201
+ // Paragraph is an inline container; unknown children must be inline-safe
39200
39202
  ]);
39201
39203
  const INLINE_NODE_NAMES = /* @__PURE__ */ new Set([
39202
39204
  "m:oMathPara",
@@ -39209,7 +39211,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39209
39211
  "m:sup",
39210
39212
  "m:sSup"
39211
39213
  ]);
39212
- const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:p", "w:body", "w:tbl", "w:tc", "w:tr"]);
39214
+ const BLOCK_BOUNDARY_NAMES = /* @__PURE__ */ new Set(["w:body", "w:tbl", "w:tc", "w:tr"]);
39213
39215
  const isInlineContext = (path2 = [], currentNodeName) => {
39214
39216
  if (currentNodeName && INLINE_NODE_NAMES.has(currentNodeName)) {
39215
39217
  return true;
@@ -41857,7 +41859,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41857
41859
  static getStoredSuperdocVersion(docx) {
41858
41860
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
41859
41861
  }
41860
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.27") {
41862
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.29") {
41861
41863
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
41862
41864
  }
41863
41865
  /**
@@ -66887,7 +66889,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66887
66889
  const shouldSkipNodeView = (editor) => {
66888
66890
  return isHeadless(editor);
66889
66891
  };
66890
- const summaryVersion = "1.0.0-beta.27";
66892
+ const summaryVersion = "1.0.0-beta.29";
66891
66893
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
66892
66894
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
66893
66895
  function mapAttributes(attrs) {
@@ -67676,7 +67678,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67676
67678
  { default: remarkStringify2 },
67677
67679
  { default: remarkGfm2 }
67678
67680
  ] = await Promise.all([
67679
- Promise.resolve().then(() => indexB9InP_01),
67681
+ Promise.resolve().then(() => indexCFdgXvG),
67680
67682
  Promise.resolve().then(() => indexDRCvimau),
67681
67683
  Promise.resolve().then(() => indexC_x_N6Uh),
67682
67684
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -67881,7 +67883,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67881
67883
  * Process collaboration migrations
67882
67884
  */
67883
67885
  processCollaborationMigrations() {
67884
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.27");
67886
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.29");
67885
67887
  if (!this.options.ydoc) return;
67886
67888
  const metaMap = this.options.ydoc.getMap("meta");
67887
67889
  let docVersion = metaMap.get("version");
@@ -68750,7 +68752,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68750
68752
  sectionIndex: section.sectionIndex,
68751
68753
  headerRefs: section.headerRefs,
68752
68754
  footerRefs: section.footerRefs,
68753
- numbering: section.numbering
68755
+ numbering: section.numbering,
68756
+ titlePg: section.titlePg
68754
68757
  });
68755
68758
  });
68756
68759
  }
@@ -69909,6 +69912,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69909
69912
  enableRichHyperlinks: false
69910
69913
  };
69911
69914
  const applyMarksToRun = (run2, marks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG, themeColors) => {
69915
+ const isTabRun2 = run2.kind === "tab";
69912
69916
  marks.forEach((mark2) => {
69913
69917
  const forwardedDataAttrs = extractDataAttributes(mark2.attrs);
69914
69918
  try {
@@ -69941,11 +69945,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69941
69945
  break;
69942
69946
  }
69943
69947
  case "textStyle":
69944
- applyTextStyleMark(run2, mark2.attrs ?? {}, themeColors);
69948
+ if (!isTabRun2) {
69949
+ applyTextStyleMark(run2, mark2.attrs ?? {}, themeColors);
69950
+ }
69945
69951
  break;
69946
69952
  case "commentMark":
69947
69953
  case "comment": {
69948
- pushCommentAnnotation(run2, mark2.attrs ?? {});
69954
+ if (!isTabRun2) {
69955
+ pushCommentAnnotation(run2, mark2.attrs ?? {});
69956
+ }
69949
69957
  break;
69950
69958
  }
69951
69959
  case "underline": {
@@ -69972,31 +69980,33 @@ Please report this to https://github.com/markedjs/marked.`, e) {
69972
69980
  run2.highlight = resolveColorFromAttributes(mark2.attrs ?? {}, themeColors);
69973
69981
  break;
69974
69982
  case "link": {
69975
- const attrs = mark2.attrs ?? {};
69976
- if (hyperlinkConfig.enableRichHyperlinks) {
69977
- try {
69978
- const link2 = buildFlowRunLink(attrs);
69979
- if (link2) {
69980
- run2.link = link2;
69981
- }
69982
- } catch (error) {
69983
- if (process$1$1.env.NODE_ENV === "development") {
69984
- console.warn("[PM-Adapter] Failed to build rich hyperlink:", error);
69985
- }
69986
- }
69987
- } else if (typeof attrs.href === "string" && attrs.href.trim()) {
69988
- try {
69989
- const sanitized = sanitizeHref(attrs.href);
69990
- if (sanitized && sanitized.href) {
69991
- const legacyLink = {
69992
- href: sanitized.href,
69993
- title: typeof attrs.title === "string" ? attrs.title : void 0
69994
- };
69995
- 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
+ }
69996
69995
  }
69997
- } catch (error) {
69998
- if (process$1$1.env.NODE_ENV === "development") {
69999
- 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
+ }
70000
70010
  }
70001
70011
  }
70002
70012
  }
@@ -70010,7 +70020,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70010
70020
  console.warn(`[PM-Adapter] Failed to apply mark ${mark2.type}:`, error);
70011
70021
  }
70012
70022
  }
70013
- if (forwardedDataAttrs) {
70023
+ if (forwardedDataAttrs && !isTabRun2) {
70014
70024
  run2.dataAttrs = { ...run2.dataAttrs ?? {}, ...forwardedDataAttrs };
70015
70025
  }
70016
70026
  });
@@ -70032,14 +70042,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70032
70042
  }
70033
70043
  return run2;
70034
70044
  }
70035
- function tabNodeToRun(node2, positions, tabIndex, paragraph2) {
70045
+ function tabNodeToRun(node2, positions, tabIndex, paragraph2, inheritedMarks = []) {
70036
70046
  const pos = positions.get(node2);
70037
70047
  if (!pos) return null;
70038
70048
  const paragraphAttrs = paragraph2.attrs ?? {};
70039
70049
  const paragraphProps = typeof paragraphAttrs.paragraphProperties === "object" && paragraphAttrs.paragraphProperties !== null ? paragraphAttrs.paragraphProperties : {};
70040
70050
  const tabStops = Array.isArray(paragraphAttrs.tabStops) && paragraphAttrs.tabStops.length ? paragraphAttrs.tabStops : Array.isArray(paragraphProps.tabStops) ? paragraphProps.tabStops : void 0;
70041
70051
  const indent2 = paragraphAttrs.indent ?? paragraphProps.indent ?? void 0;
70042
- return {
70052
+ const run2 = {
70043
70053
  kind: "tab",
70044
70054
  text: " ",
70045
70055
  pmStart: pos.start,
@@ -70049,6 +70059,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
70049
70059
  indent: indent2,
70050
70060
  leader: node2.attrs?.leader ?? null
70051
70061
  };
70062
+ const marks = [...node2.marks ?? [], ...inheritedMarks ?? []];
70063
+ if (marks.length > 0) {
70064
+ applyMarksToRun(run2, marks);
70065
+ }
70066
+ return run2;
70052
70067
  }
70053
70068
  function tokenNodeToRun(node2, positions, defaultFont, defaultSize, inheritedMarks = [], token, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors) {
70054
70069
  const run2 = {
@@ -71875,9 +71890,26 @@ Please report this to https://github.com/markedjs/marked.`, e) {
71875
71890
  if (isHeadingStyle && (!resolvedIndent || Object.keys(resolvedIndent).length === 0 || onlyFirstLineIndent)) {
71876
71891
  resolvedIndent = { firstLine: 0, hanging: 0, left: resolvedIndent?.left, right: resolvedIndent?.right };
71877
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
+ }
71878
71910
  const hydrated = {
71879
71911
  resolved,
71880
- spacing: cloneIfObject(resolvedAsRecord.spacing),
71912
+ spacing: resolvedSpacing,
71881
71913
  indent: resolvedIndent,
71882
71914
  borders: cloneIfObject(resolvedExtended.borders),
71883
71915
  shading: cloneIfObject(resolvedExtended.shading),
@@ -72776,11 +72808,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72776
72808
  }
72777
72809
  }
72778
72810
  paragraphAttrs.wordLayout = wordLayout;
72779
- if (enrichedNumberingProps.resolvedLevelIndent && !hasExplicitIndent) {
72811
+ if (enrichedNumberingProps.resolvedLevelIndent) {
72780
72812
  const resolvedIndentPx = convertIndentTwipsToPx(enrichedNumberingProps.resolvedLevelIndent);
72813
+ const baseIndent = resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent;
72781
72814
  paragraphAttrs.indent = {
72782
- ...paragraphAttrs.indent,
72783
- ...resolvedIndentPx ?? enrichedNumberingProps.resolvedLevelIndent
72815
+ ...baseIndent,
72816
+ ...normalizedIndent ?? {}
72784
72817
  };
72785
72818
  }
72786
72819
  }
@@ -73845,7 +73878,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
73845
73878
  return;
73846
73879
  }
73847
73880
  if (node2.type === "tab") {
73848
- const tabRun = tabNodeToRun(node2, positions, tabOrdinal, para);
73881
+ const tabRun = tabNodeToRun(node2, positions, tabOrdinal, para, inheritedMarks);
73849
73882
  tabOrdinal += 1;
73850
73883
  if (tabRun) {
73851
73884
  currentRuns.push(tabRun);
@@ -74540,6 +74573,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74540
74573
  hydration.justification = referenced.justification;
74541
74574
  }
74542
74575
  }
74576
+ const paragraphProps = extractTableStyleParagraphProps(styleId, context.docx);
74577
+ if (paragraphProps) {
74578
+ hydration.paragraphProps = paragraphProps;
74579
+ }
74543
74580
  }
74544
74581
  if (Object.keys(hydration).length > 0) {
74545
74582
  return hydration;
@@ -74590,6 +74627,51 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74590
74627
  }
74591
74628
  return { width: raw, type: measurement.type };
74592
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
+ };
74593
74675
  const isTableRowNode = (node2) => node2.type === "tableRow" || node2.type === "table_row";
74594
74676
  const isTableCellNode = (node2) => node2.type === "tableCell" || node2.type === "table_cell" || node2.type === "tableHeader" || node2.type === "table_header";
74595
74677
  const normalizeRowHeight = (rowProps) => {
@@ -74609,11 +74691,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74609
74691
  };
74610
74692
  };
74611
74693
  const parseTableCell = (args) => {
74612
- const { cellNode, rowIndex, cellIndex, context, defaultCellPadding } = args;
74694
+ const { cellNode, rowIndex, cellIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
74613
74695
  if (!isTableCellNode(cellNode) || !Array.isArray(cellNode.content)) {
74614
74696
  return null;
74615
74697
  }
74616
74698
  const blocks2 = [];
74699
+ const cellConverterContext = tableStyleParagraphProps ? {
74700
+ ...context.converterContext,
74701
+ tableStyleParagraphProps
74702
+ } : context.converterContext;
74617
74703
  for (const childNode of cellNode.content) {
74618
74704
  if (childNode.type === "paragraph") {
74619
74705
  const paragraphBlocks = context.paragraphToFlowBlocks(
@@ -74624,11 +74710,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74624
74710
  context.defaultSize,
74625
74711
  context.styleContext,
74626
74712
  void 0,
74713
+ // listCounterContext
74627
74714
  context.trackedChanges,
74628
74715
  context.bookmarks,
74629
74716
  context.hyperlinkConfig,
74630
74717
  context.themeColors,
74631
- context.converterContext
74718
+ cellConverterContext
74719
+ // converterContext at position 12
74632
74720
  );
74633
74721
  const paragraph2 = paragraphBlocks.find((b2) => b2.kind === "paragraph");
74634
74722
  if (paragraph2) {
@@ -74671,7 +74759,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74671
74759
  };
74672
74760
  };
74673
74761
  const parseTableRow = (args) => {
74674
- const { rowNode, rowIndex, context, defaultCellPadding } = args;
74762
+ const { rowNode, rowIndex, context, defaultCellPadding, tableStyleParagraphProps } = args;
74675
74763
  if (!isTableRowNode(rowNode) || !Array.isArray(rowNode.content)) {
74676
74764
  return null;
74677
74765
  }
@@ -74682,7 +74770,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74682
74770
  rowIndex,
74683
74771
  cellIndex,
74684
74772
  context,
74685
- defaultCellPadding
74773
+ defaultCellPadding,
74774
+ tableStyleParagraphProps
74686
74775
  });
74687
74776
  if (parsedCell) {
74688
74777
  cells.push(parsedCell);
@@ -74791,13 +74880,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74791
74880
  };
74792
74881
  const hydratedTableStyle = hydrateTableStyleAttrs(node2, converterContext);
74793
74882
  const defaultCellPadding = hydratedTableStyle?.cellPadding;
74883
+ const tableStyleParagraphProps = hydratedTableStyle?.paragraphProps;
74794
74884
  const rows = [];
74795
74885
  node2.content.forEach((rowNode, rowIndex) => {
74796
74886
  const parsedRow = parseTableRow({
74797
74887
  rowNode,
74798
74888
  rowIndex,
74799
74889
  context: parserDeps,
74800
- defaultCellPadding
74890
+ defaultCellPadding,
74891
+ tableStyleParagraphProps
74801
74892
  });
74802
74893
  if (parsedRow) {
74803
74894
  rows.push(parsedRow);
@@ -75053,7 +75144,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75053
75144
  blocks2.push(sectionBreak);
75054
75145
  recordBlockKind(sectionBreak.kind);
75055
75146
  }
75056
- 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(
75057
75148
  para,
75058
75149
  nextBlockId2,
75059
75150
  positions2,
@@ -75064,8 +75155,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75064
75155
  trackedChanges,
75065
75156
  bookmarks2,
75066
75157
  hyperlinkConfig2,
75067
- themeColors,
75068
- converterContext
75158
+ themeColorsParam ?? themeColors,
75159
+ converterCtx ?? converterContext
75069
75160
  );
75070
75161
  const tableConverter = (node2, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
75071
75162
  node2,
@@ -75845,9 +75936,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75845
75936
  odd: section.footerRefs.odd ?? null
75846
75937
  });
75847
75938
  }
75848
- const hasFirstHeader = Boolean(section.headerRefs?.first);
75849
- const hasFirstFooter = Boolean(section.footerRefs?.first);
75850
- if (hasFirstHeader || hasFirstFooter) {
75939
+ if (section.titlePg === true) {
75851
75940
  identifier.sectionTitlePg.set(idx, true);
75852
75941
  }
75853
75942
  }
@@ -77054,14 +77143,35 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77054
77143
  const headerHeight = headerCount > 0 ? sumRowHeights(measure.rows, 0, headerCount) : 0;
77055
77144
  let state2 = ensurePage();
77056
77145
  const availableHeight = state2.contentBottom - state2.cursorY;
77057
- let minRequiredHeight = 0;
77058
- if (measure.rows.length > 0) {
77059
- minRequiredHeight = sumRowHeights(measure.rows, 0, 1);
77060
- } else if (measure.totalHeight > 0) {
77061
- minRequiredHeight = measure.totalHeight;
77062
- }
77063
- if (minRequiredHeight > availableHeight && state2.page.fragments.length > 0) {
77064
- 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
+ }
77065
77175
  }
77066
77176
  let currentRow = 0;
77067
77177
  let isTableContinuation = false;
@@ -77126,7 +77236,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
77126
77236
  return fromLine < totalLines;
77127
77237
  });
77128
77238
  const fragmentHeight2 = continuationPartialRow.partialHeight + (repeatHeaderCount > 0 ? headerHeight : 0);
77129
- if (fragmentHeight2 > 0) {
77239
+ if (fragmentHeight2 > 0 && madeProgress) {
77130
77240
  const fragment2 = {
77131
77241
  kind: "table",
77132
77242
  blockId: block.id,
@@ -85635,9 +85745,16 @@ ${l}
85635
85745
  tabEl.style.width = `${actualTabWidth}px`;
85636
85746
  tabEl.style.height = `${line.lineHeight}px`;
85637
85747
  tabEl.style.display = "inline-block";
85638
- tabEl.style.visibility = "hidden";
85639
85748
  tabEl.style.pointerEvents = "none";
85640
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
+ }
85641
85758
  if (styleId) {
85642
85759
  tabEl.setAttribute("styleid", styleId);
85643
85760
  }
@@ -85715,6 +85832,28 @@ ${l}
85715
85832
  }
85716
85833
  } else {
85717
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
+ }
85718
85857
  const elem = this.renderRun(run2, context, trackedConfig);
85719
85858
  if (elem) {
85720
85859
  if (styleId) {
@@ -86803,8 +86942,10 @@ ${l}
86803
86942
  const indentRight = sanitizePositive(indent2?.right);
86804
86943
  const firstLine = indent2?.firstLine ?? 0;
86805
86944
  const hanging = indent2?.hanging ?? 0;
86945
+ const isWordLayoutList = Boolean(wordLayout?.marker);
86806
86946
  const suppressFirstLine = block.attrs?.suppressFirstLineIndent === true;
86807
- const firstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
86947
+ const rawFirstLineOffset = suppressFirstLine ? 0 : firstLine - hanging;
86948
+ const firstLineOffset = isWordLayoutList ? 0 : rawFirstLineOffset;
86808
86949
  const contentWidth = Math.max(1, maxWidth - indentLeft - indentRight);
86809
86950
  const initialAvailableWidth = Math.max(1, contentWidth - firstLineOffset);
86810
86951
  const tabStops = buildTabStopsPx(
@@ -145635,7 +145776,7 @@ ${style2}
145635
145776
  this.config.colors = shuffleArray(this.config.colors);
145636
145777
  this.userColorMap = /* @__PURE__ */ new Map();
145637
145778
  this.colorIndex = 0;
145638
- this.version = "1.0.0-beta.27";
145779
+ this.version = "1.0.0-beta.29";
145639
145780
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
145640
145781
  this.superdocId = config2.superdocId || v4();
145641
145782
  this.colors = this.config.colors;
@@ -145983,7 +146124,6 @@ ${style2}
145983
146124
  */
145984
146125
  addCommentsList(element2) {
145985
146126
  if (!this.config?.modules?.comments || this.config.role === "viewer") return;
145986
- this.#log("🦋 [superdoc] Adding comments list to:", element2);
145987
146127
  if (element2) this.config.modules.comments.element = element2;
145988
146128
  this.commentsList = new SuperComments(this.config.modules?.comments, this);
145989
146129
  if (this.config.onCommentsListChange) this.config.onCommentsListChange({ isRendered: true });
@@ -148080,7 +148220,7 @@ ${style2}
148080
148220
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
148081
148221
  );
148082
148222
  }
148083
- const indexB9InP_01 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
148223
+ const indexCFdgXvG = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
148084
148224
  __proto__: null,
148085
148225
  unified
148086
148226
  }, Symbol.toStringTag, { value: "Module" }));