@stll/folio-core 0.8.0 → 0.10.0

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 (168) hide show
  1. package/README.md +39 -0
  2. package/dist/ai-edits/apply.js +18 -4
  3. package/dist/ai-edits/headless.d.ts +73 -6
  4. package/dist/ai-edits/headless.js +299 -60
  5. package/dist/ai-edits/index.d.ts +3 -3
  6. package/dist/ai-edits/index.js +2 -1
  7. package/dist/ai-edits/snapshot.js +40 -3
  8. package/dist/ai-edits/types.d.ts +2 -1
  9. package/dist/compat/eigenpal.d.ts +6 -4
  10. package/dist/compat/eigenpal.js +5 -3
  11. package/dist/controller/latestRequestGate.d.ts +13 -0
  12. package/dist/controller/latestRequestGate.js +16 -0
  13. package/dist/controller/layoutPipeline.js +13 -1
  14. package/dist/document-operations.d.ts +20 -4
  15. package/dist/document-operations.js +36 -15
  16. package/dist/document-stories.d.ts +10 -0
  17. package/dist/document-stories.js +27 -0
  18. package/dist/docx/blockContentParser.js +2 -2
  19. package/dist/docx/commentParser.js +1 -1
  20. package/dist/docx/compatibility.d.ts +3 -7
  21. package/dist/docx/compatibility.js +0 -11
  22. package/dist/docx/corePropertiesParser.d.ts +8 -0
  23. package/dist/docx/corePropertiesParser.js +53 -0
  24. package/dist/docx/encryption/agileDecryption.js +1 -1
  25. package/dist/docx/encryption/encryptionInfo.js +1 -1
  26. package/dist/docx/encryption/openEncryptedDocx.js +1 -1
  27. package/dist/docx/fontTableParser.d.ts +6 -0
  28. package/dist/docx/fontTableParser.js +72 -0
  29. package/dist/docx/groupDrawingParser.js +7 -2
  30. package/dist/docx/headerFooterParser.js +1 -1
  31. package/dist/docx/index.d.ts +2 -1
  32. package/dist/docx/index.js +2 -1
  33. package/dist/docx/metadataPrivacy.d.ts +40 -0
  34. package/dist/docx/metadataPrivacy.js +131 -0
  35. package/dist/docx/normalizeBaseDirection.js +1 -1
  36. package/dist/docx/numberingParser.js +1 -0
  37. package/dist/docx/paragraphParser.js +12 -1
  38. package/dist/docx/parser.d.ts +1 -1
  39. package/dist/docx/parser.js +16 -10
  40. package/dist/docx/rezip.d.ts +5 -4
  41. package/dist/docx/rezip.js +76 -13
  42. package/dist/docx/runConsolidator.js +4 -0
  43. package/dist/docx/runParser.js +19 -1
  44. package/dist/docx/selectiveSave.js +3 -3
  45. package/dist/docx/serializer/fontTableSerializer.d.ts +6 -0
  46. package/dist/docx/serializer/fontTableSerializer.js +26 -0
  47. package/dist/docx/serializer/headerFooterSerializer.js +1 -1
  48. package/dist/docx/serializer/paragraphSerializer.js +4 -0
  49. package/dist/docx/serializer/runSerializer.js +7 -0
  50. package/dist/docx/serializer/settingsSerializer.d.ts +6 -0
  51. package/dist/docx/serializer/settingsSerializer.js +16 -0
  52. package/dist/docx/serializer/stylesSerializer.d.ts +6 -0
  53. package/dist/docx/serializer/stylesSerializer.js +56 -0
  54. package/dist/docx/serializer/tableSerializer.js +25 -26
  55. package/dist/docx/serializer/themeSerializer.d.ts +6 -0
  56. package/dist/docx/serializer/themeSerializer.js +36 -0
  57. package/dist/docx/settingsParser.js +46 -0
  58. package/dist/docx/styleParser.js +26 -1
  59. package/dist/docx/tableParser.js +11 -1
  60. package/dist/docx/vmlImageParser.js +1 -0
  61. package/dist/i18n/messages/catalogs.gen.d.ts +5916 -5916
  62. package/dist/i18n/messages/catalogs.gen.js +5910 -5910
  63. package/dist/index.d.ts +6 -4
  64. package/dist/index.js +5 -3
  65. package/dist/layout-bridge/convert/footnoteLayout.d.ts +3 -0
  66. package/dist/layout-bridge/convert/footnoteLayout.js +3 -1
  67. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +3 -0
  68. package/dist/layout-bridge/convert/headerFooterLayout.js +6 -1
  69. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +14 -2
  70. package/dist/layout-bridge/convert/toFlowBlocks.js +52 -14
  71. package/dist/layout-bridge/engine/measuring/index.d.ts +2 -1
  72. package/dist/layout-bridge/engine/measuring/index.js +2 -1
  73. package/dist/layout-engine/index.js +36 -28
  74. package/dist/layout-engine/measure/cache.js +6 -3
  75. package/dist/layout-engine/measure/effectiveLineBreakPolicy.d.ts +29 -0
  76. package/dist/layout-engine/measure/effectiveLineBreakPolicy.js +60 -0
  77. package/dist/layout-engine/measure/font-metrics.worker.js +1 -0
  78. package/dist/layout-engine/measure/index.d.ts +2 -1
  79. package/dist/layout-engine/measure/index.js +2 -1
  80. package/dist/layout-engine/measure/lineBreakProvider.d.ts +33 -0
  81. package/dist/layout-engine/measure/lineBreakProvider.js +252 -0
  82. package/dist/layout-engine/measure/lineBreaks.d.ts +7 -2
  83. package/dist/layout-engine/measure/lineBreaks.js +11 -18
  84. package/dist/layout-engine/measure/listMarkerWidth.d.ts +1 -0
  85. package/dist/layout-engine/measure/listMarkerWidth.js +12 -6
  86. package/dist/layout-engine/measure/measureBlocks.d.ts +1 -2
  87. package/dist/layout-engine/measure/measureBlocks.js +6 -36
  88. package/dist/layout-engine/measure/measureContainer.js +32 -9
  89. package/dist/layout-engine/measure/measureHelpers.js +5 -2
  90. package/dist/layout-engine/measure/measureParagraph.js +332 -73
  91. package/dist/layout-engine/measure/measureTypes.d.ts +2 -1
  92. package/dist/layout-engine/measure/measureWorker.d.ts +2 -2
  93. package/dist/layout-engine/measure/measureWorker.js +8 -19
  94. package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +3 -14
  95. package/dist/layout-engine/measure/tableCellFloating.d.ts +10 -3
  96. package/dist/layout-engine/measure/tableCellFloating.js +51 -37
  97. package/dist/layout-engine/measure/tableCellFlow.d.ts +27 -0
  98. package/dist/layout-engine/measure/tableCellFlow.js +73 -0
  99. package/dist/layout-engine/measure/tableCellGrid.js +1 -1
  100. package/dist/layout-engine/measure/textMeasurementPolicy.d.ts +18 -0
  101. package/dist/layout-engine/measure/textMeasurementPolicy.js +24 -0
  102. package/dist/layout-engine/renderedBreakReconciliation.d.ts +6 -1
  103. package/dist/layout-engine/renderedBreakReconciliation.js +34 -11
  104. package/dist/layout-engine/tableRowBreak.d.ts +5 -2
  105. package/dist/layout-engine/tableRowBreak.js +62 -29
  106. package/dist/layout-engine/types.d.ts +43 -8
  107. package/dist/layout-painter/anchoredImagePosition.d.ts +23 -0
  108. package/dist/layout-painter/anchoredImagePosition.js +95 -0
  109. package/dist/layout-painter/borderStroke.d.ts +23 -0
  110. package/dist/layout-painter/borderStroke.js +39 -0
  111. package/dist/layout-painter/renderImage.d.ts +5 -4
  112. package/dist/layout-painter/renderImage.js +18 -4
  113. package/dist/layout-painter/renderPage.d.ts +2 -27
  114. package/dist/layout-painter/renderPage.js +13 -99
  115. package/dist/layout-painter/renderParagraph.js +41 -23
  116. package/dist/layout-painter/renderTable.d.ts +2 -0
  117. package/dist/layout-painter/renderTable.js +223 -43
  118. package/dist/managers/DocumentLoaderManager.d.ts +1 -1
  119. package/dist/managers/DocumentLoaderManager.js +2 -2
  120. package/dist/prosemirror/attrs/index.d.ts +4 -2
  121. package/dist/prosemirror/attrs/index.js +22 -2
  122. package/dist/prosemirror/commands/propertyChangeScope.js +1 -1
  123. package/dist/prosemirror/conversion/effectiveTableCellFormatting.d.ts +62 -0
  124. package/dist/prosemirror/conversion/effectiveTableCellFormatting.js +131 -0
  125. package/dist/prosemirror/conversion/fromProseDoc.js +34 -18
  126. package/dist/prosemirror/conversion/toProseDoc.js +81 -77
  127. package/dist/prosemirror/extensions/StarterKit.js +2 -0
  128. package/dist/prosemirror/extensions/core/ParagraphExtension.js +7 -2
  129. package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +1 -1
  130. package/dist/prosemirror/extensions/features/ListExtension.js +1 -0
  131. package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +1 -0
  132. package/dist/prosemirror/extensions/marks/HighlightExtension.js +1 -1
  133. package/dist/prosemirror/extensions/marks/LanguageExtension.d.ts +7 -0
  134. package/dist/prosemirror/extensions/marks/LanguageExtension.js +30 -0
  135. package/dist/prosemirror/extensions/marks/RunShadingExtension.js +1 -1
  136. package/dist/prosemirror/extensions/marks/TextColorExtension.js +1 -1
  137. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +1 -1
  138. package/dist/prosemirror/extensions/marks/markUtils.js +12 -0
  139. package/dist/prosemirror/extensions/nodes/ImageExtension.js +3 -1
  140. package/dist/prosemirror/extensions/nodes/TableExtension.js +4 -2
  141. package/dist/prosemirror/schema/index.d.ts +2 -2
  142. package/dist/prosemirror/schema/marks.d.ts +6 -1
  143. package/dist/prosemirror/schema/nodes.d.ts +15 -12
  144. package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
  145. package/dist/prosemirror/utils/tabCalculator.d.ts +3 -1
  146. package/dist/prosemirror/utils/tabCalculator.js +12 -10
  147. package/dist/prosemirror/validation.js +4 -1
  148. package/dist/redline.d.ts +26 -11
  149. package/dist/redline.js +107 -64
  150. package/dist/server.d.ts +9 -5
  151. package/dist/server.js +8 -4
  152. package/dist/style-sets/extract.d.ts +35 -0
  153. package/dist/style-sets/extract.js +123 -0
  154. package/dist/style-sets/stellaStyle.d.ts +13 -0
  155. package/dist/style-sets/stellaStyle.js +516 -0
  156. package/dist/style-sets/types.d.ts +31 -0
  157. package/dist/style-sets/types.js +5 -0
  158. package/dist/utils/createDocument.d.ts +12 -2
  159. package/dist/utils/createDocument.js +42 -31
  160. package/dist/utils/fontResolver.js +6 -6
  161. package/dist/utils/formatToStyle.js +1 -1
  162. package/dist/utils/paragraphFormattingMerge.d.ts +14 -3
  163. package/dist/utils/paragraphFormattingMerge.js +14 -4
  164. package/dist/version-comparison.d.ts +65 -11
  165. package/dist/version-comparison.js +187 -29
  166. package/package.json +5 -1
  167. package/dist/docx/capabilities.d.ts +0 -41
  168. package/dist/docx/capabilities.js +0 -322
@@ -0,0 +1,131 @@
1
+ import { resolveColor } from "../../utils/colorResolver.js";
2
+ import { resolveShadingFill } from "../../utils/formatToStyle.js";
3
+ //#region src/prosemirror/conversion/effectiveTableCellFormatting.ts
4
+ const TABLE_BORDER_SIDES = [
5
+ "top",
6
+ "bottom",
7
+ "left",
8
+ "right",
9
+ "insideH",
10
+ "insideV",
11
+ "topLeftToBottomRight",
12
+ "topRightToBottomLeft"
13
+ ];
14
+ /**
15
+ * Resolve the display-facing table-cell cascade without mutating authored
16
+ * OOXML formatting. Source discriminators keep inherited values distinct from
17
+ * direct values that the editor may later override.
18
+ */
19
+ const resolveEffectiveTableCellFormatting = ({ directFormatting, styleFormatting, tableBorders, position, gridWidthPercent, defaultMargins, theme }) => {
20
+ return {
21
+ width: resolveEffectiveWidth(directFormatting, gridWidthPercent),
22
+ background: resolveEffectiveBackground({
23
+ directFormatting,
24
+ styleFormatting,
25
+ theme
26
+ }),
27
+ borders: resolveEffectiveBorders({
28
+ directFormatting,
29
+ styleFormatting,
30
+ tableBorders,
31
+ position,
32
+ theme
33
+ }),
34
+ margins: resolveEffectiveMargins({
35
+ directFormatting,
36
+ styleFormatting,
37
+ defaultMargins
38
+ })
39
+ };
40
+ };
41
+ const resolveEffectiveWidth = (directFormatting, gridWidthPercent) => {
42
+ const directWidth = directFormatting?.width;
43
+ if (directWidth) return {
44
+ type: "value",
45
+ source: "direct",
46
+ value: directWidth.value,
47
+ widthType: directWidth.type
48
+ };
49
+ if (gridWidthPercent !== void 0) return {
50
+ type: "value",
51
+ source: "grid",
52
+ value: gridWidthPercent,
53
+ widthType: "pct"
54
+ };
55
+ return { type: "none" };
56
+ };
57
+ const resolveEffectiveBackground = ({ directFormatting, styleFormatting, theme }) => {
58
+ const directShading = directFormatting?.shading;
59
+ if (directShading !== void 0) return resolveBackgroundColor({
60
+ shading: directShading,
61
+ source: "direct",
62
+ theme
63
+ });
64
+ const styleShading = styleFormatting?.shading;
65
+ if (styleShading !== void 0) return resolveBackgroundColor({
66
+ shading: styleShading,
67
+ source: "style",
68
+ theme
69
+ });
70
+ return {
71
+ type: "none",
72
+ source: "none"
73
+ };
74
+ };
75
+ const resolveBackgroundColor = ({ shading, source, theme }) => {
76
+ const rgb = resolveShadingFill(shading, theme).replace(/^#/u, "");
77
+ if (!rgb) return {
78
+ type: "none",
79
+ source
80
+ };
81
+ return {
82
+ type: "color",
83
+ source,
84
+ rgb
85
+ };
86
+ };
87
+ const resolveEffectiveBorders = ({ directFormatting, styleFormatting, tableBorders, position, theme }) => {
88
+ const baseBorders = tableBorders ? {
89
+ top: position.isFirstRow ? tableBorders.top : tableBorders.insideH,
90
+ bottom: position.isLastRow ? tableBorders.bottom : tableBorders.insideH,
91
+ left: position.isFirstColumn ? tableBorders.left : tableBorders.insideV,
92
+ right: position.isLastColumn ? tableBorders.right : tableBorders.insideV
93
+ } : void 0;
94
+ const styleBorders = styleFormatting?.borders;
95
+ const directBorders = directFormatting?.borders;
96
+ const borders = baseBorders || styleBorders || directBorders ? {
97
+ ...baseBorders,
98
+ ...styleBorders,
99
+ ...directBorders
100
+ } : void 0;
101
+ return resolveThemedBorderColors(borders, theme);
102
+ };
103
+ const resolveEffectiveMargins = ({ directFormatting, styleFormatting, defaultMargins }) => {
104
+ if (directFormatting?.margins) return cellMarginsToAttrs(directFormatting.margins);
105
+ if (styleFormatting?.margins) return cellMarginsToAttrs(styleFormatting.margins);
106
+ return defaultMargins;
107
+ };
108
+ const cellMarginsToAttrs = (margins) => {
109
+ const result = {};
110
+ if (margins.top?.value !== void 0) result.top = margins.top.value;
111
+ if (margins.bottom?.value !== void 0) result.bottom = margins.bottom.value;
112
+ if (margins.left?.value !== void 0) result.left = margins.left.value;
113
+ if (margins.right?.value !== void 0) result.right = margins.right.value;
114
+ return result;
115
+ };
116
+ const resolveThemedBorderColors = (borders, theme) => {
117
+ if (!borders || !theme?.colorScheme) return borders;
118
+ let resolved;
119
+ for (const side of TABLE_BORDER_SIDES) {
120
+ const border = borders[side];
121
+ if (!border?.color?.themeColor || border.color.auto) continue;
122
+ resolved ??= { ...borders };
123
+ resolved[side] = {
124
+ ...border,
125
+ color: { rgb: resolveColor(border.color, theme).replace(/^#/u, "") }
126
+ };
127
+ }
128
+ return resolved ?? borders;
129
+ };
130
+ //#endregion
131
+ export { resolveEffectiveTableCellFormatting };
@@ -2,11 +2,11 @@ import { OUTLINE_STYLE_CSS_ALIASES } from "../../types/documentEnumValues.js";
2
2
  import { ShapeOutlineStyleSchema, narrowEnum } from "../../docx/parserEnums.js";
3
3
  import { pixelsToEmu } from "../../utils/units.js";
4
4
  import { numPrEqual } from "../../docx/numberingParser.js";
5
- import { directionToBidi } from "../paragraphDirection.js";
6
- import { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs } from "../attrs/index.js";
7
5
  import { autospacingMatchesBase, hasAutospacingBaseSide } from "../autospacingBase.js";
8
- import { runShadingAttrsToShading } from "./runShadingMark.js";
6
+ import { directionToBidi } from "../paragraphDirection.js";
7
+ import { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs } from "../attrs/index.js";
9
8
  import { assertValidProseMirrorDocument } from "../validation.js";
9
+ import { runShadingAttrsToShading } from "./runShadingMark.js";
10
10
  //#region src/prosemirror/conversion/fromProseDoc.ts
11
11
  function normalizeShapeOutlineStyle(style) {
12
12
  if (!style) return;
@@ -210,6 +210,7 @@ function listRenderingFromAttrs(attrs) {
210
210
  ...attrs.listMarkerHidden != null && { markerHidden: attrs.listMarkerHidden },
211
211
  ...attrs.listMarkerFontFamily != null && { markerFontFamily: attrs.listMarkerFontFamily },
212
212
  ...attrs.listMarkerFontSize != null && { markerFontSize: attrs.listMarkerFontSize },
213
+ ...attrs.listMarkerBold != null && { markerBold: attrs.listMarkerBold },
213
214
  ...attrs.listMarkerAlignment != null && { markerAlignment: attrs.listMarkerAlignment },
214
215
  ...attrs.listMarkerSuffix != null && { markerSuffix: attrs.listMarkerSuffix },
215
216
  ...attrs.listMarkerAllCaps != null && { markerAllCaps: attrs.listMarkerAllCaps },
@@ -343,6 +344,9 @@ function paragraphAttrsToFormatting(attrs) {
343
344
  else delete result.styleId;
344
345
  assignBooleanToggle(result, attrs, orig, "pageBreakBefore");
345
346
  assignBooleanToggle(result, attrs, orig, "widowControl");
347
+ assignBooleanToggle(result, attrs, orig, "kinsoku");
348
+ assignBooleanToggle(result, attrs, orig, "overflowPunctuation");
349
+ assignBooleanToggle(result, attrs, orig, "suppressAutoHyphens");
346
350
  if (attrs.spacingExplicit !== orig.spacingExplicit) if (attrs.spacingExplicit) result.spacingExplicit = attrs.spacingExplicit;
347
351
  else delete result.spacingExplicit;
348
352
  const bidi = directionToBidi(attrs.direction);
@@ -352,7 +356,7 @@ function paragraphAttrsToFormatting(attrs) {
352
356
  }
353
357
  const outlineLevel = Reflect.get(attrs, "outlineLevel");
354
358
  const bidi = directionToBidi(attrs.direction);
355
- if (!(attrs.alignment || shouldSerializeSpaceBefore || shouldSerializeSpaceAfter || beforeAutospacingEdited || afterAutospacingEdited || attrs.lineSpacing || attrs.indentLeft || attrs.indentRight || attrs.indentFirstLine || attrs.numPr || attrs.styleId || attrs.borders || attrs.shading || attrs.tabs || typeof outlineLevel === "number" || attrs.contextualSpacing || attrs.spacingExplicit || bidi != null || attrs.pageBreakBefore != null || attrs.widowControl != null)) return;
359
+ if (!(attrs.alignment || shouldSerializeSpaceBefore || shouldSerializeSpaceAfter || beforeAutospacingEdited || afterAutospacingEdited || attrs.lineSpacing || attrs.indentLeft || attrs.indentRight || attrs.indentFirstLine || attrs.numPr || attrs.styleId || attrs.borders || attrs.shading || attrs.tabs || typeof outlineLevel === "number" || attrs.contextualSpacing || attrs.spacingExplicit || bidi != null || attrs.pageBreakBefore != null || attrs.widowControl != null || attrs.kinsoku != null || attrs.overflowPunctuation != null || attrs.suppressAutoHyphens != null)) return;
356
360
  const f = {};
357
361
  if (attrs.alignment) f.alignment = attrs.alignment;
358
362
  if (shouldSerializeSpaceBefore) f.spaceBefore = spaceBefore;
@@ -376,6 +380,9 @@ function paragraphAttrsToFormatting(attrs) {
376
380
  if (bidi != null) f.bidi = bidi;
377
381
  if (attrs.pageBreakBefore != null) f.pageBreakBefore = attrs.pageBreakBefore;
378
382
  if (attrs.widowControl != null) f.widowControl = attrs.widowControl;
383
+ if (attrs.kinsoku != null) f.kinsoku = attrs.kinsoku;
384
+ if (attrs.overflowPunctuation != null) f.overflowPunctuation = attrs.overflowPunctuation;
385
+ if (attrs.suppressAutoHyphens != null) f.suppressAutoHyphens = attrs.suppressAutoHyphens;
379
386
  return f;
380
387
  }
381
388
  /**
@@ -451,11 +458,6 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks) {
451
458
  syncCommentRanges(node, offset);
452
459
  const linkMark = node.marks.find((m) => m.type.name === "hyperlink");
453
460
  const noteRefMark = node.marks.find((m) => m.type.name === "footnoteRef");
454
- if (noteRefMark && !linkMark) {
455
- flushCurrentInline();
456
- content.push(createNoteReferenceRun(noteRefMark, node.marks));
457
- return;
458
- }
459
461
  const insertionMark = node.marks.find((m) => m.type.name === "insertion");
460
462
  const deletionMark = node.marks.find((m) => m.type.name === "deletion");
461
463
  if (insertionMark || deletionMark) {
@@ -492,6 +494,11 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks) {
492
494
  });
493
495
  return;
494
496
  }
497
+ if (noteRefMark && !linkMark) {
498
+ flushCurrentInline();
499
+ content.push(createNoteReferenceRun(noteRefMark, node.marks));
500
+ return;
501
+ }
495
502
  if (linkMark) {
496
503
  const linkKey = getLinkKey(linkMark);
497
504
  if (currentHyperlink && currentHyperlinkKey === linkKey) {} else {
@@ -565,6 +572,8 @@ function extractParagraphContent(paragraph, _documentCounts, emptyHyperlinks) {
565
572
  return content;
566
573
  }
567
574
  function createTrackedChangeRun(node, marks) {
575
+ const noteRefMark = marks.find((mark) => mark.type.name === "footnoteRef");
576
+ if (noteRefMark) return createNoteReferenceRun(noteRefMark, marks);
568
577
  if (node.isText) {
569
578
  const formatting = marksToTextFormatting(marks);
570
579
  return {
@@ -858,7 +867,7 @@ function createInlineSdtFromNode(node) {
858
867
  return {
859
868
  type: "inlineSdt",
860
869
  properties,
861
- content: extractParagraphContent(node).filter((c) => c.type === "run" || c.type === "hyperlink" || c.type === "simpleField" || c.type === "complexField" || c.type === "inlineSdt" || c.type === "mathEquation")
870
+ content: extractParagraphContent(node).filter((c) => c.type === "run" || c.type === "hyperlink" || c.type === "simpleField" || c.type === "complexField" || c.type === "inlineSdt" || c.type === "insertion" || c.type === "deletion" || c.type === "mathEquation")
862
871
  };
863
872
  }
864
873
  function parseSdtListItems(rawItems) {
@@ -902,6 +911,7 @@ function createImageRun(node) {
902
911
  if (attrs.opacity != null) image.opacity = attrs.opacity;
903
912
  const imagePosition = imagePositionFromAttrs(attrs.position);
904
913
  if (imagePosition) image.position = imagePosition;
914
+ if (attrs.layoutInCell !== void 0) image.layoutInCell = attrs.layoutInCell;
905
915
  if (attrs.borderWidth && attrs.borderWidth > 0) {
906
916
  const outline = {
907
917
  width: pixelsToEmu(attrs.borderWidth),
@@ -1073,6 +1083,15 @@ function marksToTextFormatting(marks) {
1073
1083
  formatting.fontFamily = ff;
1074
1084
  break;
1075
1085
  }
1086
+ case "language": {
1087
+ const attrs = expectLanguageMarkAttrs(mark);
1088
+ formatting.language = {
1089
+ ...attrs.val ? { val: attrs.val } : {},
1090
+ ...attrs.eastAsia ? { eastAsia: attrs.eastAsia } : {},
1091
+ ...attrs.bidi ? { bidi: attrs.bidi } : {}
1092
+ };
1093
+ break;
1094
+ }
1076
1095
  case "superscript":
1077
1096
  formatting.vertAlign = "superscript";
1078
1097
  break;
@@ -1453,11 +1472,9 @@ function convertPMTableCell(node, documentCounts) {
1453
1472
  if (Array.isArray(attrs.tcPrChange) && attrs.tcPrChange.length > 0) cell.propertyChanges = [...attrs.tcPrChange];
1454
1473
  return cell;
1455
1474
  }
1456
- /**
1457
- * Convert ProseMirror table cell attrs to TableCellFormatting
1458
- * Borders are stored as full BorderSpec objects — no conversion needed.
1459
- */
1475
+ const cellShadingFromAttrs = (attrs) => attrs.backgroundColor ? { fill: { rgb: attrs.backgroundColor } } : { pattern: "nil" };
1460
1476
  function tableCellAttrsToFormatting(attrs) {
1477
+ const backgroundChanged = attrs.backgroundColor !== attrs._resolvedBackgroundColor;
1461
1478
  if (attrs._originalFormatting) {
1462
1479
  const orig = attrs._originalFormatting;
1463
1480
  const result = { ...orig };
@@ -1471,8 +1488,7 @@ function tableCellAttrsToFormatting(attrs) {
1471
1488
  };
1472
1489
  if (attrs.verticalAlign !== (orig.verticalAlign ?? void 0)) if (attrs.verticalAlign) result.verticalAlign = attrs.verticalAlign;
1473
1490
  else delete result.verticalAlign;
1474
- if (attrs.backgroundColor) result.shading = { fill: { rgb: attrs.backgroundColor } };
1475
- else if (!attrs.backgroundColor && orig.shading) delete result.shading;
1491
+ if (backgroundChanged) result.shading = cellShadingFromAttrs(attrs);
1476
1492
  if (attrs.borders) result.borders = attrs.borders;
1477
1493
  if (attrs.margins) result.margins = buildCellMarginsFromAttrs(attrs.margins);
1478
1494
  if (attrs.textDirection !== (orig.textDirection ?? void 0)) if (attrs.textDirection) result.textDirection = attrs.textDirection;
@@ -1480,7 +1496,7 @@ function tableCellAttrsToFormatting(attrs) {
1480
1496
  return result;
1481
1497
  }
1482
1498
  const cellWidth = attrs.width;
1483
- if (!(attrs.colspan > 1 || attrs.rowspan > 1 || cellWidth !== void 0 || attrs.verticalAlign || attrs.backgroundColor || attrs.borders || attrs.margins || attrs.textDirection)) return;
1499
+ if (!(attrs.colspan > 1 || attrs.rowspan > 1 || cellWidth !== void 0 || attrs.verticalAlign || backgroundChanged || attrs.borders || attrs.margins || attrs.textDirection)) return;
1484
1500
  const f = {};
1485
1501
  if (attrs.colspan > 1) f.gridSpan = attrs.colspan;
1486
1502
  if (attrs.rowspan > 1) f.vMerge = "restart";
@@ -1490,7 +1506,7 @@ function tableCellAttrsToFormatting(attrs) {
1490
1506
  };
1491
1507
  if (attrs.verticalAlign) f.verticalAlign = attrs.verticalAlign;
1492
1508
  if (attrs.textDirection) f.textDirection = attrs.textDirection;
1493
- if (attrs.backgroundColor) f.shading = { fill: { rgb: attrs.backgroundColor } };
1509
+ if (backgroundChanged) f.shading = cellShadingFromAttrs(attrs);
1494
1510
  if (attrs.borders) f.borders = attrs.borders;
1495
1511
  if (attrs.margins) f.margins = buildCellMarginsFromAttrs(attrs.margins);
1496
1512
  return f;
@@ -1,15 +1,15 @@
1
1
  import { emuToPixels } from "../../utils/units.js";
2
- import { resolveColor } from "../../utils/colorResolver.js";
3
- import { directionFromBidi } from "../paragraphDirection.js";
2
+ import { mergeTextFormatting } from "../../utils/textFormattingMerge.js";
3
+ import { mergeParagraphFormatting, mergeParagraphTabStops } from "../../utils/paragraphFormattingMerge.js";
4
4
  import { setAutospacingBaseValue } from "../autospacingBase.js";
5
- import { shadingToRunShadingAttrs } from "./runShadingMark.js";
5
+ import { directionFromBidi } from "../paragraphDirection.js";
6
6
  import { assertValidProseMirrorDocument } from "../validation.js";
7
- import { mergeTextFormatting } from "../../utils/textFormattingMerge.js";
8
- import { mergeParagraphFormatting } from "../../utils/paragraphFormattingMerge.js";
7
+ import { shadingToRunShadingAttrs } from "./runShadingMark.js";
9
8
  import { marksToTextFormatting } from "./fromProseDoc.js";
10
9
  import { createStyleEngine } from "../../style-engine/styleEngine.js";
11
10
  import { buildRunFormattingOverrideAttrs } from "../extensions/marks/RunFormattingOverrideExtension.js";
12
11
  import { schema } from "../schema/index.js";
12
+ import { resolveEffectiveTableCellFormatting } from "./effectiveTableCellFormatting.js";
13
13
  //#region src/prosemirror/conversion/toProseDoc.ts
14
14
  const TOC_STYLE_ID = /^TOC\d*$/iu;
15
15
  /**
@@ -30,7 +30,16 @@ function toProseDoc(document, options) {
30
30
  for (const block of blocks) if (block.type === "paragraph") {
31
31
  const pbPos = paragraphPageBreakPosition(block);
32
32
  if (pbPos === "before") out.push(schema.node("pageBreak"));
33
- out.push(...convertParagraphWithTextBoxes(block, styleResolver, { textBoxGroupId: nextTextBoxGroupId() }));
33
+ const converted = convertParagraphWithTextBoxes(block, styleResolver, { textBoxGroupId: nextTextBoxGroupId() });
34
+ const firstConverted = converted.at(0);
35
+ if (pbPos === "before" && converted.length === 1 && firstConverted?.type.name === "paragraph" && firstConverted.content.size === 0 && document.package.settings?.splitPageBreakAndParagraphMark !== true) {
36
+ const paragraph = firstConverted;
37
+ converted[0] = paragraph.type.create({
38
+ ...paragraph.attrs,
39
+ _pageBreakCarrier: true
40
+ }, paragraph.content, paragraph.marks);
41
+ }
42
+ out.push(...converted);
34
43
  if (pbPos === "after") out.push(schema.node("pageBreak"));
35
44
  } else if (block.type === "table") out.push(convertTable(block, styleResolver, {
36
45
  theme,
@@ -105,13 +114,13 @@ function convertParagraph(paragraph, styleResolver, activeCommentIds, extraRunFo
105
114
  if (styleResolver) styleRunFormatting = styleResolver.resolveParagraphStyle(paragraph.formatting?.styleId).runFormatting;
106
115
  const paragraphRunFormatting = resolveParagraphMarkRunFormatting(paragraph.formatting?.runProperties, styleResolver);
107
116
  let inheritableParagraphRunFormatting;
108
- if (paragraphRunFormatting && !isTocParagraph) inheritableParagraphRunFormatting = stripParagraphMarkOnlyFormatting(paragraphRunFormatting);
117
+ if (paragraphRunFormatting && !isTocParagraph) inheritableParagraphRunFormatting = stripParagraphMarkFormattingForBodyRuns(paragraphRunFormatting);
109
118
  const baseRunFormatting = mergeTextFormatting(styleRunFormatting, extraRunFormatting);
110
119
  const paragraphMarkPrecedesStyle = paragraph.formatting?.styleId !== void 0;
111
120
  const defaultRunFormatting = paragraphMarkPrecedesStyle ? mergeTextFormatting(inheritableParagraphRunFormatting, baseRunFormatting) : mergeTextFormatting(baseRunFormatting, inheritableParagraphRunFormatting);
112
121
  const getInheritedRunFormatting = (formatting, fieldType) => {
113
122
  if (fieldType === "TOC") return hasDirectRunFormatting(formatting) ? suppressParagraphMarkFormatting(baseRunFormatting, void 0, formatting) : baseRunFormatting;
114
- if (!hasDirectRunFormatting(formatting)) return defaultRunFormatting;
123
+ if (!(hasDirectRunFormatting(formatting) || formatting?.styleId !== void 0)) return defaultRunFormatting;
115
124
  return suppressParagraphMarkFormatting(baseRunFormatting, inheritableParagraphRunFormatting, formatting, paragraphMarkPrecedesStyle);
116
125
  };
117
126
  const emitTrackedChange = (change, markType, moveKind) => {
@@ -227,6 +236,7 @@ function paragraphFormattingToAttrs(paragraph, styleResolver, tableParagraphOver
227
236
  if (paragraph.listRendering?.markerHidden) attrs.listMarkerHidden = paragraph.listRendering.markerHidden;
228
237
  if (paragraph.listRendering?.markerFontFamily) attrs.listMarkerFontFamily = paragraph.listRendering.markerFontFamily;
229
238
  if (paragraph.listRendering?.markerFontSize) attrs.listMarkerFontSize = paragraph.listRendering.markerFontSize;
239
+ if (paragraph.listRendering?.markerBold !== void 0) attrs.listMarkerBold = paragraph.listRendering.markerBold;
230
240
  if (paragraph.listRendering?.markerAlignment) attrs.listMarkerAlignment = paragraph.listRendering.markerAlignment;
231
241
  if (paragraph.listRendering?.markerSuffix) attrs.listMarkerSuffix = paragraph.listRendering.markerSuffix;
232
242
  if (paragraph.listRendering?.markerAllCaps) attrs.listMarkerAllCaps = paragraph.listRendering.markerAllCaps;
@@ -260,14 +270,17 @@ function paragraphFormattingToAttrs(paragraph, styleResolver, tableParagraphOver
260
270
  if (formatting?.spaceBefore === void 0 && tableParagraphOverlay?.spaceBefore === void 0 && paragraphStyle?.pPr?.spaceBefore === void 0 && docDefaultSpacing?.spaceBefore !== void 0) spacingFromDocDefaults.before = true;
261
271
  if (formatting?.spaceAfter === void 0 && tableParagraphOverlay?.spaceAfter === void 0 && paragraphStyle?.pPr?.spaceAfter === void 0 && docDefaultSpacing?.spaceAfter !== void 0) spacingFromDocDefaults.after = true;
262
272
  if (spacingFromDocDefaults.before || spacingFromDocDefaults.after) attrs.spacingFromDocDefaults = spacingFromDocDefaults;
263
- const numberingStyleIndent = formatting?.numPr?.numId === 0 && stylePpr?.numPr !== void 0 && stylePpr.numPr.numId !== 0 ? void 0 : stylePpr;
264
- set("indentLeft", formatting?.indentLeft ?? numberingStyleIndent?.indentLeft);
273
+ const effectiveIndent = mergeParagraphFormatting(formatting?.numPr?.numId === 0 && stylePpr?.numPr !== void 0 && stylePpr.numPr.numId !== 0 ? void 0 : stylePpr, formatting);
274
+ set("indentLeft", effectiveIndent?.indentLeft);
265
275
  set("indentRight", formatting?.indentRight ?? stylePpr?.indentRight);
266
- set("indentFirstLine", formatting?.indentFirstLine ?? numberingStyleIndent?.indentFirstLine);
267
- set("hangingIndent", formatting?.hangingIndent ?? numberingStyleIndent?.hangingIndent);
276
+ set("indentFirstLine", effectiveIndent?.indentFirstLine);
277
+ set("hangingIndent", effectiveIndent?.hangingIndent);
268
278
  set("borders", formatting?.borders ?? stylePpr?.borders);
269
279
  set("shading", formatting?.shading ?? stylePpr?.shading);
270
- set("tabs", formatting?.tabs ?? stylePpr?.tabs);
280
+ set("tabs", mergeParagraphTabStops(stylePpr?.tabs, formatting?.tabs));
281
+ set("kinsoku", formatting?.kinsoku ?? stylePpr?.kinsoku);
282
+ set("overflowPunctuation", formatting?.overflowPunctuation ?? stylePpr?.overflowPunctuation);
283
+ set("suppressAutoHyphens", formatting?.suppressAutoHyphens ?? stylePpr?.suppressAutoHyphens);
271
284
  set("pageBreakBefore", formatting?.pageBreakBefore ?? stylePpr?.pageBreakBefore);
272
285
  set("keepNext", formatting?.keepNext ?? stylePpr?.keepNext);
273
286
  set("keepLines", formatting?.keepLines ?? stylePpr?.keepLines);
@@ -295,6 +308,9 @@ function paragraphFormattingToAttrs(paragraph, styleResolver, tableParagraphOver
295
308
  set("borders", formatting?.borders);
296
309
  set("shading", formatting?.shading);
297
310
  set("tabs", formatting?.tabs);
311
+ set("kinsoku", formatting?.kinsoku);
312
+ set("overflowPunctuation", formatting?.overflowPunctuation);
313
+ set("suppressAutoHyphens", formatting?.suppressAutoHyphens);
298
314
  set("pageBreakBefore", formatting?.pageBreakBefore);
299
315
  set("keepNext", formatting?.keepNext);
300
316
  set("keepLines", formatting?.keepLines);
@@ -405,6 +421,12 @@ function stripParagraphMarkOnlyFormatting(formatting) {
405
421
  const { allCaps: _ac, highlight: _h, shading: _s, smallCaps: _sc, vertAlign: _va, ...rest } = formatting;
406
422
  return Object.keys(rest).length > 0 ? rest : void 0;
407
423
  }
424
+ function stripParagraphMarkFormattingForBodyRuns(formatting) {
425
+ const paragraphMarkFormatting = stripParagraphMarkOnlyFormatting(formatting);
426
+ if (!paragraphMarkFormatting) return;
427
+ const { fontFamily: _fontFamily, ...bodyRunFormatting } = paragraphMarkFormatting;
428
+ return Object.keys(bodyRunFormatting).length > 0 ? bodyRunFormatting : void 0;
429
+ }
408
430
  function suppressParagraphMarkFormatting(base, paragraphMark, direct, paragraphMarkPrecedesStyle = false) {
409
431
  if (!paragraphMark) return base;
410
432
  const result = (paragraphMarkPrecedesStyle ? mergeTextFormatting(paragraphMark, base) : mergeTextFormatting(base, paragraphMark)) ?? {};
@@ -702,83 +724,60 @@ function convertTableRow(row, styleResolver, context, isHeaderRow, columnWidths,
702
724
  if (cellIsFirstRow && cellIsLastCol && (tableLook?.firstRow || rowCnf?.firstRow || cellCnf?.firstRow) && (tableLook?.lastColumn || rowCnf?.lastColumn || cellCnf?.lastColumn)) cellConditionalStyle = mergeConditionalStyles(cellConditionalStyle, conditionalStyles?.neCell);
703
725
  if (cellIsLastRow && cellIsFirstCol && (tableLook?.lastRow || rowCnf?.lastRow || cellCnf?.lastRow) && (tableLook?.firstColumn || rowCnf?.firstColumn || cellCnf?.firstColumn)) cellConditionalStyle = mergeConditionalStyles(cellConditionalStyle, conditionalStyles?.swCell);
704
726
  if (cellIsLastRow && cellIsLastCol && (tableLook?.lastRow || rowCnf?.lastRow || cellCnf?.lastRow) && (tableLook?.lastColumn || rowCnf?.lastColumn || cellCnf?.lastColumn)) cellConditionalStyle = mergeConditionalStyles(cellConditionalStyle, conditionalStyles?.seCell);
705
- cells.push(convertTableCell(cell, styleResolver, context, isHeaderRow, gridWidth, cellConditionalStyle, tableBorders, isFirstRow, isLastRow, isFirstCol, isLastCol, calculatedRowSpan, preserveVMergeRestart, rowSpanInfo?.continuationCells, defaultCellMargins));
727
+ cells.push(convertTableCell({
728
+ cell,
729
+ styleResolver,
730
+ context,
731
+ isHeader: isHeaderRow,
732
+ gridWidthPercent: gridWidth,
733
+ conditionalStyle: cellConditionalStyle,
734
+ tableBorders,
735
+ position: {
736
+ isFirstRow,
737
+ isLastRow,
738
+ isFirstColumn: isFirstCol,
739
+ isLastColumn: isLastCol
740
+ },
741
+ calculatedRowSpan,
742
+ preserveVMergeRestart,
743
+ vMergeContinuationCells: rowSpanInfo?.continuationCells,
744
+ defaultCellMargins
745
+ }));
706
746
  }
707
747
  return schema.node("tableRow", attrs, cells);
708
748
  }
709
- const TABLE_BORDER_SIDES = [
710
- "top",
711
- "bottom",
712
- "left",
713
- "right",
714
- "insideH",
715
- "insideV"
716
- ];
717
- function resolveThemedBorderColors(borders, theme) {
718
- if (!borders || !theme?.colorScheme) return borders;
719
- let resolved;
720
- for (const side of TABLE_BORDER_SIDES) {
721
- const border = borders[side];
722
- if (!border?.color?.themeColor || border.color.auto) continue;
723
- resolved ??= { ...borders };
724
- resolved[side] = {
725
- ...border,
726
- color: { rgb: resolveColor(border.color, theme).replace(/^#/u, "") }
727
- };
728
- }
729
- return resolved ?? borders;
730
- }
731
749
  /**
732
750
  * Convert a TableCell to a ProseMirror table cell node
733
751
  */
734
- function convertTableCell(cell, styleResolver, context, isHeader, gridWidthPercent, conditionalStyle, tableBorders, isFirstRow, isLastRow, isFirstCol, isLastCol, calculatedRowSpan, preserveVMergeRestart, vMergeContinuationCells, defaultCellMargins) {
735
- const { theme } = context;
752
+ function convertTableCell({ cell, styleResolver, context, isHeader, gridWidthPercent, conditionalStyle, tableBorders, position, calculatedRowSpan, preserveVMergeRestart, vMergeContinuationCells, defaultCellMargins }) {
736
753
  const formatting = cell.formatting;
737
754
  const rowspan = calculatedRowSpan ?? 1;
738
- let width = formatting?.width?.value;
739
- let widthType = formatting?.width?.type;
740
- if (width === void 0 && gridWidthPercent !== void 0) {
741
- width = gridWidthPercent;
742
- widthType = "pct";
743
- }
744
- const backgroundColor = formatting?.shading?.fill?.rgb ?? conditionalStyle?.tcPr?.shading?.fill?.rgb;
745
- const baseBorders = (() => {
746
- if (tableBorders) return {
747
- top: isFirstRow ? tableBorders.top : tableBorders.insideH,
748
- bottom: isLastRow ? tableBorders.bottom : tableBorders.insideH,
749
- left: isFirstCol ? tableBorders.left : tableBorders.insideV,
750
- right: isLastCol ? tableBorders.right : tableBorders.insideV
751
- };
752
- })();
753
- const conditionalBorders = conditionalStyle?.tcPr?.borders;
754
- const cellBorders = formatting?.borders;
755
- const borders = resolveThemedBorderColors(baseBorders || conditionalBorders || cellBorders ? {
756
- ...baseBorders,
757
- ...conditionalBorders,
758
- ...cellBorders
759
- } : void 0, theme);
760
- const buildMarginsAttr = (src) => {
761
- const m = {};
762
- if (src.top?.value !== void 0) m.top = src.top.value;
763
- if (src.bottom?.value !== void 0) m.bottom = src.bottom.value;
764
- if (src.left?.value !== void 0) m.left = src.left.value;
765
- if (src.right?.value !== void 0) m.right = src.right.value;
766
- return m;
767
- };
755
+ const effectiveFormatting = resolveEffectiveTableCellFormatting({
756
+ directFormatting: formatting,
757
+ styleFormatting: conditionalStyle?.tcPr,
758
+ tableBorders,
759
+ position,
760
+ gridWidthPercent,
761
+ defaultMargins: defaultCellMargins,
762
+ theme: context.theme
763
+ });
768
764
  const attrs = {
769
765
  colspan: formatting?.gridSpan ?? 1,
770
766
  rowspan
771
767
  };
772
- if (width !== void 0) attrs.width = width;
773
- if (widthType) attrs.widthType = widthType;
768
+ if (effectiveFormatting.width.type === "value") {
769
+ attrs.width = effectiveFormatting.width.value;
770
+ if (effectiveFormatting.width.widthType) attrs.widthType = effectiveFormatting.width.widthType;
771
+ }
774
772
  if (formatting?.verticalAlign) attrs.verticalAlign = formatting.verticalAlign;
775
- if (backgroundColor) attrs.backgroundColor = backgroundColor;
773
+ if (effectiveFormatting.background.type === "color") {
774
+ attrs.backgroundColor = effectiveFormatting.background.rgb;
775
+ attrs._resolvedBackgroundColor = effectiveFormatting.background.rgb;
776
+ }
776
777
  if (formatting?.textDirection) attrs.textDirection = formatting.textDirection;
777
778
  if (formatting?.noWrap !== void 0) attrs.noWrap = formatting.noWrap;
778
- if (borders) attrs.borders = borders;
779
- if (formatting?.margins) attrs.margins = buildMarginsAttr(formatting.margins);
780
- else if (conditionalStyle?.tcPr?.margins) attrs.margins = buildMarginsAttr(conditionalStyle.tcPr.margins);
781
- else if (defaultCellMargins) attrs.margins = defaultCellMargins;
779
+ if (effectiveFormatting.borders) attrs.borders = effectiveFormatting.borders;
780
+ if (effectiveFormatting.margins) attrs.margins = effectiveFormatting.margins;
782
781
  if (formatting) attrs._originalFormatting = formatting;
783
782
  if (cell.propertyChanges && cell.propertyChanges.length > 0) attrs.tcPrChange = [...cell.propertyChanges];
784
783
  if (preserveVMergeRestart) attrs._preserveVMergeRestart = true;
@@ -851,7 +850,9 @@ function convertInlineSdt(sdt, getInheritedRunFormatting, styleResolver) {
851
850
  } else if (content.type === "inlineSdt") {
852
851
  const nestedSdt = convertInlineSdt(content, getInheritedRunFormatting, styleResolver);
853
852
  if (nestedSdt) inlineNodes.push(nestedSdt);
854
- } else {
853
+ } else if (content.type === "insertion") inlineNodes.push(...convertTrackedChange(content, "insertion", getInheritedRunFormatting, styleResolver));
854
+ else if (content.type === "deletion") inlineNodes.push(...convertTrackedChange(content, "deletion", getInheritedRunFormatting, styleResolver));
855
+ else {
855
856
  const mathNode = convertMathEquation(content);
856
857
  if (mathNode) inlineNodes.push(mathNode);
857
858
  }
@@ -1042,12 +1043,14 @@ function convertImage(image, rawXml) {
1042
1043
  cropBottom: image.crop?.bottom,
1043
1044
  cropLeft: image.crop?.left,
1044
1045
  position,
1046
+ layoutInCell: image.layoutInCell,
1045
1047
  borderWidth,
1046
1048
  borderColor,
1047
1049
  borderStyle,
1048
1050
  wrapText,
1049
1051
  hlinkHref: image.hlinkHref,
1050
- _docxRawXml: rawXml
1052
+ _docxRawXml: rawXml,
1053
+ _docxObjectPreview: rawXml !== void 0 && /<(?:[A-Za-z_][\w.-]*:)?object(?:\s|>)/u.test(rawXml)
1051
1054
  });
1052
1055
  }
1053
1056
  /**
@@ -1108,6 +1111,7 @@ function textFormattingToMarks(formatting) {
1108
1111
  eastAsiaTheme: formatting.fontFamily.eastAsiaTheme,
1109
1112
  csTheme: formatting.fontFamily.csTheme
1110
1113
  }));
1114
+ if (formatting.language) marks.push(schema.mark("language", formatting.language));
1111
1115
  if (formatting.vertAlign === "superscript") marks.push(schema.mark("superscript"));
1112
1116
  else if (formatting.vertAlign === "subscript") marks.push(schema.mark("subscript"));
1113
1117
  if (formatting.allCaps) marks.push(schema.mark("allCaps"));
@@ -31,6 +31,7 @@ import { HiddenTextExtension } from "./marks/HiddenTextExtension.js";
31
31
  import { HighlightExtension } from "./marks/HighlightExtension.js";
32
32
  import { HyperlinkExtension } from "./marks/HyperlinkExtension.js";
33
33
  import { ItalicExtension } from "./marks/ItalicExtension.js";
34
+ import { LanguageExtension } from "./marks/LanguageExtension.js";
34
35
  import { RtlExtension } from "./marks/RtlExtension.js";
35
36
  import { RunShadingExtension } from "./marks/RunShadingExtension.js";
36
37
  import { SmallCapsExtension } from "./marks/SmallCapsExtension.js";
@@ -79,6 +80,7 @@ function createStarterKit(options = {}) {
79
80
  add("highlight", HighlightExtension());
80
81
  add("fontSize", FontSizeExtension());
81
82
  add("fontFamily", FontFamilyExtension());
83
+ add("language", LanguageExtension());
82
84
  add("superscript", SuperscriptExtension());
83
85
  add("subscript", SubscriptExtension());
84
86
  add("hyperlink", HyperlinkExtension());
@@ -1,8 +1,8 @@
1
- import { paragraphToStyle } from "../../../utils/formatToStyle.js";
1
+ import { autospacingMatchesBase } from "../../autospacingBase.js";
2
2
  import { directionIsRtl } from "../../paragraphDirection.js";
3
3
  import { expectParagraphAttrs } from "../../attrs/index.js";
4
- import { autospacingMatchesBase } from "../../autospacingBase.js";
5
4
  import { createNodeExtension } from "../create.js";
5
+ import { paragraphToStyle } from "../../../utils/formatToStyle.js";
6
6
  import { collectHeadings } from "../../../utils/headingCollector.js";
7
7
  import { listAttrsFromResolvedStyle, paragraphAttrsFromResolvedStyle } from "../../styles/resolvedStyleAttrs.js";
8
8
  import { Fragment } from "prosemirror-model";
@@ -180,6 +180,9 @@ const paragraphNodeSpec = {
180
180
  paraId: { default: null },
181
181
  textId: { default: null },
182
182
  alignment: { default: null },
183
+ kinsoku: { default: null },
184
+ overflowPunctuation: { default: null },
185
+ suppressAutoHyphens: { default: null },
183
186
  spaceBefore: { default: null },
184
187
  spaceAfter: { default: null },
185
188
  lineSpacing: { default: null },
@@ -199,6 +202,7 @@ const paragraphNodeSpec = {
199
202
  listMarkerHidden: { default: null },
200
203
  listMarkerFontFamily: { default: null },
201
204
  listMarkerFontSize: { default: null },
205
+ listMarkerBold: { default: null },
202
206
  listMarkerAlignment: { default: null },
203
207
  listMarkerSuffix: { default: null },
204
208
  listMarkerAllCaps: { default: null },
@@ -214,6 +218,7 @@ const paragraphNodeSpec = {
214
218
  tabs: { default: null },
215
219
  pageBreakBefore: { default: null },
216
220
  renderedPageBreakBefore: { default: null },
221
+ _pageBreakCarrier: { default: null },
217
222
  keepNext: { default: null },
218
223
  keepLines: { default: null },
219
224
  widowControl: { default: null },
@@ -1,7 +1,7 @@
1
- import { detectBaseDirection } from "../../../utils/baseDirection.js";
2
1
  import { directionIsAutoManaged } from "../../paragraphDirection.js";
3
2
  import { createExtension } from "../create.js";
4
3
  import { getTransactionDirtyRange } from "../../../paged-layout/transactionDirtyRange.js";
4
+ import { detectBaseDirection } from "../../../utils/baseDirection.js";
5
5
  import { ignoreTrackedChanges } from "./ParagraphChangeTrackerExtension.js";
6
6
  import { Plugin, PluginKey } from "prosemirror-state";
7
7
  //#region src/prosemirror/extensions/features/AutoBidiDetectionExtension.ts
@@ -34,6 +34,7 @@ const LIST_FORMATTING_ATTRS = [
34
34
  "listMarkerHidden",
35
35
  "listMarkerFontFamily",
36
36
  "listMarkerFontSize",
37
+ "listMarkerBold",
37
38
  "listMarkerAlignment",
38
39
  "listMarkerSuffix",
39
40
  "listLevelNumFmts",
@@ -16,6 +16,7 @@ const FootnoteRefExtension = createMarkExtension({
16
16
  name: "footnoteRef",
17
17
  schemaMarkName: "footnoteRef",
18
18
  markSpec: {
19
+ inclusive: false,
19
20
  attrs: {
20
21
  id: {},
21
22
  noteType: { default: "footnote" },
@@ -1,7 +1,7 @@
1
1
  import { HIGHLIGHT_COLOR_VALUES } from "../../../types/documentEnumValues.js";
2
- import { resolveHighlightToCss } from "../../../utils/colorResolver.js";
3
2
  import { expectHighlightMarkAttrs } from "../../attrs/index.js";
4
3
  import { createMarkExtension } from "../create.js";
4
+ import { resolveHighlightToCss } from "../../../utils/colorResolver.js";
5
5
  import { removeMark, setMark } from "./markUtils.js";
6
6
  import { panic } from "better-result";
7
7
  //#region src/prosemirror/extensions/marks/HighlightExtension.ts
@@ -0,0 +1,7 @@
1
+ import { MarkExtension } from "../types.js";
2
+
3
+ //#region src/prosemirror/extensions/marks/LanguageExtension.d.ts
4
+ /** Preserve OOXML `w:lang` and expose its primary language to the editing DOM. */
5
+ declare const LanguageExtension: (options?: Partial<Record<string, unknown>> | undefined) => MarkExtension;
6
+ //#endregion
7
+ export { LanguageExtension };