@stll/folio-core 0.11.0 → 0.12.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 (194) hide show
  1. package/dist/ai-edits/apply.js +602 -50
  2. package/dist/ai-edits/block-identity.d.ts +4 -0
  3. package/dist/ai-edits/block-identity.js +9 -0
  4. package/dist/ai-edits/blockRange.d.ts +28 -1
  5. package/dist/ai-edits/blockRange.js +67 -1
  6. package/dist/ai-edits/headless.d.ts +4 -4
  7. package/dist/ai-edits/headless.js +9 -9
  8. package/dist/ai-edits/index.d.ts +2 -2
  9. package/dist/ai-edits/index.js +2 -2
  10. package/dist/ai-edits/read.d.ts +7 -7
  11. package/dist/ai-edits/read.js +110 -3
  12. package/dist/ai-edits/table-cell-mutations.d.ts +48 -0
  13. package/dist/ai-edits/table-cell-mutations.js +237 -0
  14. package/dist/ai-edits/table-mutation-plan.d.ts +38 -0
  15. package/dist/ai-edits/table-mutation-plan.js +90 -0
  16. package/dist/ai-edits/table-row-column-mutations.d.ts +100 -0
  17. package/dist/ai-edits/table-row-column-mutations.js +300 -0
  18. package/dist/ai-edits/table-targets.d.ts +32 -0
  19. package/dist/ai-edits/table-targets.js +70 -0
  20. package/dist/ai-edits/types.d.ts +34 -0
  21. package/dist/compat/eigenpal.js +1 -1
  22. package/dist/content-controls/mutateContentControls.js +1 -1
  23. package/dist/controller/activeEditorStory.d.ts +36 -0
  24. package/dist/controller/activeEditorStory.js +30 -0
  25. package/dist/controller/contentControlWidgetController.d.ts +55 -0
  26. package/dist/controller/contentControlWidgetController.js +141 -0
  27. package/dist/controller/fontReadiness.js +2 -0
  28. package/dist/controller/headerFooterEditorManager.js +1 -1
  29. package/dist/controller/hiddenEditorApi.js +2 -2
  30. package/dist/controller/hiddenEditorManager.d.ts +12 -1
  31. package/dist/controller/hiddenEditorManager.js +32 -11
  32. package/dist/controller/layoutPipeline.d.ts +2 -0
  33. package/dist/controller/layoutPipeline.js +16 -1
  34. package/dist/controller/noteEditorManager.d.ts +36 -0
  35. package/dist/controller/noteEditorManager.js +210 -0
  36. package/dist/document-operations.d.ts +35 -3
  37. package/dist/document-operations.js +161 -3
  38. package/dist/docx/blockContentParser.js +2 -2
  39. package/dist/docx/commentParser.js +6 -1
  40. package/dist/docx/conformance.js +8 -1
  41. package/dist/docx/documentGrid.d.ts +8 -0
  42. package/dist/docx/documentGrid.js +8 -0
  43. package/dist/docx/drawingUtils.js +1 -1
  44. package/dist/docx/ensureParaIds.js +1 -1
  45. package/dist/docx/fieldParser.js +1 -1
  46. package/dist/docx/notePropertiesParser.js +1 -1
  47. package/dist/docx/numberingParser.js +1 -1
  48. package/dist/docx/paragraphParser.js +63 -58
  49. package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
  50. package/dist/docx/paragraphTextBoxEnrichment.js +67 -13
  51. package/dist/docx/paragraphTraversal.js +1 -1
  52. package/dist/docx/parser.js +3 -3
  53. package/dist/docx/rezip.js +1 -1
  54. package/dist/docx/runParser.js +4 -2
  55. package/dist/docx/sdtProperties.js +1 -1
  56. package/dist/docx/sectionParser.js +1 -1
  57. package/dist/docx/selectiveSave.js +1 -1
  58. package/dist/docx/serializer/commentSerializer.js +1 -2
  59. package/dist/docx/serializer/documentSerializer.js +2 -2
  60. package/dist/docx/serializer/headerFooterSerializer.js +2 -2
  61. package/dist/docx/serializer/noteSerializer.js +2 -2
  62. package/dist/docx/serializer/paragraphSerializer.js +7 -1
  63. package/dist/docx/serializer/runSerializer.js +4 -2
  64. package/dist/docx/serializer/stylesSerializer.js +1 -1
  65. package/dist/docx/serializer/tableSerializer.d.ts +5 -4
  66. package/dist/docx/serializer/tableSerializer.js +17 -13
  67. package/dist/docx/server/applyDocxXmlPatchProposal.d.ts +87 -0
  68. package/dist/docx/server/applyDocxXmlPatchProposal.js +204 -0
  69. package/dist/docx/server/boundedArchive.d.ts +14 -3
  70. package/dist/docx/server/boundedArchive.js +56 -11
  71. package/dist/docx/server/evaluateDocxXmlPatchProposal.d.ts +85 -0
  72. package/dist/docx/server/evaluateDocxXmlPatchProposal.js +361 -0
  73. package/dist/docx/server/inspectDocxPackage.d.ts +70 -0
  74. package/dist/docx/server/inspectDocxPackage.js +217 -0
  75. package/dist/docx/server/validateDocxConformance.d.ts +41 -0
  76. package/dist/docx/server/validateDocxConformance.js +336 -0
  77. package/dist/docx/settingsParser.js +11 -1
  78. package/dist/docx/shapeParser.js +1 -1
  79. package/dist/docx/styleParser.js +4 -2
  80. package/dist/docx/tableParser.js +18 -7
  81. package/dist/docx/textBoxParser.d.ts +3 -3
  82. package/dist/docx/textBoxParser.js +16 -12
  83. package/dist/docx/xmlSafety.d.ts +5 -0
  84. package/dist/docx/xmlSafety.js +9 -0
  85. package/dist/fields/resolveFieldValues.js +1 -3
  86. package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
  87. package/dist/i18n/messages/catalogs.gen.js +17 -0
  88. package/dist/i18n/messages/messages.gen.d.ts +1 -0
  89. package/dist/index.js +1 -1
  90. package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
  91. package/dist/layout-bridge/convert/footnoteLayout.js +47 -40
  92. package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
  93. package/dist/layout-bridge/convert/headerFooterLayout.js +3 -0
  94. package/dist/layout-bridge/convert/templatePreviewFlow.js +3 -3
  95. package/dist/layout-bridge/convert/toFlowBlocks.d.ts +4 -2
  96. package/dist/layout-bridge/convert/toFlowBlocks.js +136 -20
  97. package/dist/layout-bridge/dom/noteStoryDom.d.ts +6 -0
  98. package/dist/layout-bridge/dom/noteStoryDom.js +17 -0
  99. package/dist/layout-bridge/engine/clickToPosition.js +2 -2
  100. package/dist/layout-engine/index.d.ts +2 -2
  101. package/dist/layout-engine/index.js +43 -28
  102. package/dist/layout-engine/justificationCompatibility.d.ts +6 -0
  103. package/dist/layout-engine/justificationCompatibility.js +8 -0
  104. package/dist/layout-engine/keep-together.js +11 -1
  105. package/dist/layout-engine/measure/cache.js +21 -5
  106. package/dist/layout-engine/measure/lineBreakProvider.js +53 -34
  107. package/dist/layout-engine/measure/measureBlocks.js +6 -3
  108. package/dist/layout-engine/measure/measureContainer.js +1 -1
  109. package/dist/layout-engine/measure/measureHelpers.d.ts +1 -1
  110. package/dist/layout-engine/measure/measureHelpers.js +3 -3
  111. package/dist/layout-engine/measure/measureParagraph.js +69 -25
  112. package/dist/layout-engine/measure/measureProvider.js +4 -3
  113. package/dist/layout-engine/measure/tableCellFlow.js +5 -2
  114. package/dist/layout-engine/measure/textBoxParagraphLayout.d.ts +9 -7
  115. package/dist/layout-engine/measure/textBoxParagraphLayout.js +22 -6
  116. package/dist/layout-engine/measure/textMeasurementPolicy.d.ts +3 -1
  117. package/dist/layout-engine/measure/textMeasurementPolicy.js +7 -1
  118. package/dist/layout-engine/paginator.js +5 -1
  119. package/dist/layout-engine/paragraphSpacing.d.ts +28 -4
  120. package/dist/layout-engine/paragraphSpacing.js +107 -13
  121. package/dist/layout-engine/renderedBreakReconciliation.js +1 -1
  122. package/dist/layout-engine/types.d.ts +26 -13
  123. package/dist/layout-painter/registry/modules/textBox.js +5 -1
  124. package/dist/layout-painter/renderPage.d.ts +5 -2
  125. package/dist/layout-painter/renderPage.js +56 -12
  126. package/dist/layout-painter/renderParagraph.js +22 -6
  127. package/dist/layout-painter/renderTable.d.ts +5 -1
  128. package/dist/layout-painter/renderTable.js +5 -2
  129. package/dist/layout-painter/renderTextBox.d.ts +2 -1
  130. package/dist/layout-painter/renderTextBox.js +25 -14
  131. package/dist/managers/DocumentLoaderManager.js +1 -1
  132. package/dist/model.js +1 -1
  133. package/dist/prosemirror/attrs/index.d.ts +4 -2
  134. package/dist/prosemirror/attrs/index.js +154 -18
  135. package/dist/prosemirror/commands/comments.d.ts +3 -3
  136. package/dist/prosemirror/commands/comments.js +248 -12
  137. package/dist/prosemirror/commands/contentControls.js +1 -1
  138. package/dist/prosemirror/commands/index.js +1 -1
  139. package/dist/prosemirror/commands/pageBreak.js +1 -1
  140. package/dist/prosemirror/commands/propertyChangeScope.d.ts +2 -2
  141. package/dist/prosemirror/commands/propertyChangeScope.js +3 -2
  142. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +9 -0
  143. package/dist/prosemirror/commands/tableCellMergeResolution.js +181 -0
  144. package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -1
  145. package/dist/prosemirror/conversion/fromProseDoc.js +286 -61
  146. package/dist/prosemirror/conversion/sdtAttrs.d.ts +9 -0
  147. package/dist/prosemirror/conversion/sdtAttrs.js +49 -0
  148. package/dist/prosemirror/conversion/toProseDoc.d.ts +2 -1
  149. package/dist/prosemirror/conversion/toProseDoc.js +347 -98
  150. package/dist/prosemirror/extensions/ExtensionManager.js +1 -1
  151. package/dist/prosemirror/extensions/StarterKit.js +6 -1
  152. package/dist/prosemirror/extensions/core/ParagraphExtension.js +4 -1
  153. package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +1 -0
  154. package/dist/prosemirror/extensions/features/ListExtension.js +1 -1
  155. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +10 -1
  156. package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +93 -2
  157. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +2 -1
  158. package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +6 -2
  159. package/dist/prosemirror/extensions/marks/CharacterSpacingExtension.js +1 -1
  160. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.d.ts +9 -1
  161. package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +24 -1
  162. package/dist/prosemirror/extensions/nodes/FieldExtension.js +1 -1
  163. package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.d.ts +7 -0
  164. package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.js +22 -0
  165. package/dist/prosemirror/extensions/nodes/TableExtension.js +9 -3
  166. package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.d.ts +13 -0
  167. package/dist/prosemirror/extensions/nodes/TextBoxAnchorExtension.js +41 -0
  168. package/dist/prosemirror/extensions/nodes/TextBoxExtension.d.ts +5 -2
  169. package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -1
  170. package/dist/prosemirror/plugins/contentControlWidgets.d.ts +34 -8
  171. package/dist/prosemirror/plugins/contentControlWidgets.js +125 -91
  172. package/dist/prosemirror/plugins/selectionTracker.js +1 -0
  173. package/dist/prosemirror/plugins/suggestionMode.js +1 -1
  174. package/dist/prosemirror/schema/index.d.ts +2 -2
  175. package/dist/prosemirror/schema/marks.d.ts +5 -1
  176. package/dist/prosemirror/schema/nodes.d.ts +64 -7
  177. package/dist/prosemirror/selectionState.js +1 -0
  178. package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
  179. package/dist/prosemirror/tableCellMergeRevision.d.ts +9 -0
  180. package/dist/prosemirror/tableCellMergeRevision.js +22 -0
  181. package/dist/prosemirror/textBoxAnchorAttrs.d.ts +9 -0
  182. package/dist/prosemirror/textBoxAnchorAttrs.js +33 -0
  183. package/dist/prosemirror/utils/extractTrackedChanges.d.ts +1 -1
  184. package/dist/prosemirror/utils/extractTrackedChanges.js +62 -14
  185. package/dist/prosemirror/validation.js +9 -1
  186. package/dist/server.d.ts +6 -2
  187. package/dist/server.js +5 -1
  188. package/dist/utils/fontFamilyMerge.js +9 -11
  189. package/dist/utils/fontLoader.js +3 -2
  190. package/dist/utils/fontResolver.js +22 -4
  191. package/dist/utils/fontWeights.d.ts +1 -1
  192. package/dist/utils/fontWeights.js +1 -1
  193. package/dist/utils/paragraphFormattingMerge.js +1 -0
  194. package/package.json +1 -1
@@ -19,18 +19,129 @@ import { Plugin, PluginKey } from "prosemirror-state";
19
19
  const contentControlWidgetsPluginKey = new PluginKey("contentControlWidgets");
20
20
  /**
21
21
  * CustomEvent name dispatched on the editor view DOM whenever the plugin
22
- * needs to surface a `ContentControlWidgetEvent` to the React shell. The
23
- * shell subscribes via `addEventListener` and renders the matching chrome.
22
+ * needs to surface a `ContentControlWidgetEvent` to an adapter shell. The
23
+ * adapter subscribes via `addEventListener` and renders the matching chrome.
24
24
  *
25
- * Using a CustomEvent keeps the plugin from owning a React reference and
26
- * makes the host's responsibility explicit: receive event → render UI →
25
+ * Using a CustomEvent keeps the plugin framework-neutral and makes the
26
+ * adapter's responsibility explicit: receive event → render UI →
27
27
  * call dispatchDropdownPick / dispatchDatePick.
28
28
  */
29
29
  const CONTENT_CONTROL_WIDGET_EVENT_NAME = "folio:content-control-widget";
30
- function findSdtAncestor(target) {
31
- if (!(target instanceof Element)) return null;
32
- return target.closest("[data-sdt-type]");
33
- }
30
+ const SDT_DATASET_KEY = {
31
+ checked: "sdtChecked",
32
+ listItems: "sdtListItems",
33
+ pmPos: "sdtPmPos",
34
+ tag: "sdtTag",
35
+ type: "sdtType"
36
+ };
37
+ const SDT_TYPE = {
38
+ checkbox: "checkbox",
39
+ comboBox: "comboBox",
40
+ date: "date",
41
+ dropdown: "dropdown"
42
+ };
43
+ const SDT_TYPE_SELECTOR = "[data-sdt-type]";
44
+ const findClosest = (target, selector) => {
45
+ if (typeof target !== "object" || target === null || !("closest" in target) || typeof target.closest !== "function") return null;
46
+ return target.closest(selector);
47
+ };
48
+ const isContentControlWidgetElement = (value) => {
49
+ if (typeof value !== "object" || value === null || !("dataset" in value) || typeof value.dataset !== "object" || value.dataset === null || !("getBoundingClientRect" in value) || typeof value.getBoundingClientRect !== "function") return false;
50
+ return true;
51
+ };
52
+ const findSdtAncestor = (target) => {
53
+ const candidate = findClosest(target, SDT_TYPE_SELECTOR);
54
+ return isContentControlWidgetElement(candidate) ? candidate : null;
55
+ };
56
+ /**
57
+ * Interpret one click from either the live ProseMirror DOM or the painted page
58
+ * tree. Both surfaces carry the same `data-sdt-*` projection, so adapters only
59
+ * need to forward the click and render the resulting typed event.
60
+ */
61
+ const handleContentControlWidgetClick = ({ event, onEvent, view }) => {
62
+ const anchor = findSdtAncestor(event.target);
63
+ if (!anchor) return false;
64
+ const tag = anchor.dataset[SDT_DATASET_KEY.tag] ?? "";
65
+ const sdtType = anchor.dataset[SDT_DATASET_KEY.type];
66
+ const pmPosRaw = anchor.dataset[SDT_DATASET_KEY.pmPos];
67
+ const pmPos = pmPosRaw ? Number.parseInt(pmPosRaw, 10) : NaN;
68
+ if (!sdtType || Number.isNaN(pmPos)) return false;
69
+ try {
70
+ if (sdtType === SDT_TYPE.checkbox) {
71
+ const current = anchor.dataset[SDT_DATASET_KEY.checked] === "true";
72
+ const tr = setContentControlValueTr(view.state, { pmPos }, {
73
+ kind: SDT_TYPE.checkbox,
74
+ checked: !current
75
+ });
76
+ if (tr) {
77
+ view.dispatch(tr);
78
+ event.preventDefault();
79
+ return true;
80
+ }
81
+ } else if (sdtType === SDT_TYPE.dropdown || sdtType === SDT_TYPE.comboBox) {
82
+ const refusal = lockRefusalFor(view, pmPos);
83
+ if (refusal) {
84
+ onEvent({
85
+ kind: "refused",
86
+ tag,
87
+ pmPos,
88
+ sdtType,
89
+ anchor,
90
+ error: refusal
91
+ });
92
+ event.preventDefault();
93
+ return true;
94
+ }
95
+ onEvent({
96
+ kind: "dropdownOpen",
97
+ tag,
98
+ pmPos,
99
+ sdtType,
100
+ anchor,
101
+ listItemsJson: anchor.dataset[SDT_DATASET_KEY.listItems]
102
+ });
103
+ event.preventDefault();
104
+ return true;
105
+ } else if (sdtType === SDT_TYPE.date) {
106
+ const refusal = lockRefusalFor(view, pmPos);
107
+ if (refusal) {
108
+ onEvent({
109
+ kind: "refused",
110
+ tag,
111
+ pmPos,
112
+ sdtType,
113
+ anchor,
114
+ error: refusal
115
+ });
116
+ event.preventDefault();
117
+ return true;
118
+ }
119
+ onEvent({
120
+ kind: "datePick",
121
+ tag,
122
+ pmPos,
123
+ anchor,
124
+ currentValue: findBlockSdtMatch(view.state.doc, { pmPos })?.node.textContent
125
+ });
126
+ event.preventDefault();
127
+ return true;
128
+ }
129
+ } catch (error) {
130
+ if (error instanceof ContentControlLockedError || error instanceof ContentControlTypeError) {
131
+ onEvent({
132
+ kind: "refused",
133
+ tag,
134
+ pmPos,
135
+ sdtType,
136
+ anchor,
137
+ error
138
+ });
139
+ return true;
140
+ }
141
+ throw error;
142
+ }
143
+ return false;
144
+ };
34
145
  function createContentControlWidgetsPlugin(onEvent = () => void 0) {
35
146
  const emit = (view, payload) => {
36
147
  onEvent(payload);
@@ -42,88 +153,11 @@ function createContentControlWidgetsPlugin(onEvent = () => void 0) {
42
153
  return new Plugin({
43
154
  key: contentControlWidgetsPluginKey,
44
155
  props: { handleDOMEvents: { click(view, event) {
45
- const anchor = findSdtAncestor(event.target);
46
- if (!anchor) return false;
47
- const tag = anchor.dataset["sdtTag"] ?? "";
48
- const sdtType = anchor.dataset["sdtType"];
49
- const pmPosRaw = anchor.dataset["sdtPmPos"];
50
- const pmPos = pmPosRaw ? Number.parseInt(pmPosRaw, 10) : NaN;
51
- if (!sdtType || Number.isNaN(pmPos)) return false;
52
- try {
53
- if (sdtType === "checkbox") {
54
- const current = anchor.dataset["sdtChecked"] === "true";
55
- const tr = setContentControlValueTr(view.state, { pmPos }, {
56
- kind: "checkbox",
57
- checked: !current
58
- });
59
- if (tr) {
60
- view.dispatch(tr);
61
- event.preventDefault();
62
- return true;
63
- }
64
- } else if (sdtType === "dropdown" || sdtType === "comboBox") {
65
- const refusal = lockRefusalFor(view, pmPos);
66
- if (refusal) {
67
- emit(view, {
68
- kind: "refused",
69
- tag,
70
- pmPos,
71
- sdtType,
72
- anchor,
73
- error: refusal
74
- });
75
- event.preventDefault();
76
- return true;
77
- }
78
- emit(view, {
79
- kind: "dropdownOpen",
80
- tag,
81
- pmPos,
82
- sdtType,
83
- anchor,
84
- listItemsJson: anchor.dataset["sdtListItems"]
85
- });
86
- event.preventDefault();
87
- return true;
88
- } else if (sdtType === "date") {
89
- const refusal = lockRefusalFor(view, pmPos);
90
- if (refusal) {
91
- emit(view, {
92
- kind: "refused",
93
- tag,
94
- pmPos,
95
- sdtType,
96
- anchor,
97
- error: refusal
98
- });
99
- event.preventDefault();
100
- return true;
101
- }
102
- emit(view, {
103
- kind: "datePick",
104
- tag,
105
- pmPos,
106
- anchor,
107
- currentValue: void 0
108
- });
109
- event.preventDefault();
110
- return true;
111
- }
112
- } catch (error) {
113
- if (error instanceof ContentControlLockedError || error instanceof ContentControlTypeError) {
114
- emit(view, {
115
- kind: "refused",
116
- tag,
117
- pmPos,
118
- sdtType,
119
- anchor,
120
- error
121
- });
122
- return true;
123
- }
124
- throw error;
125
- }
126
- return false;
156
+ return handleContentControlWidgetClick({
157
+ view,
158
+ event,
159
+ onEvent: (payload) => emit(view, payload)
160
+ });
127
161
  } } },
128
162
  view() {
129
163
  return {};
@@ -189,4 +223,4 @@ function lockRefusalFor(view, pmPos) {
189
223
  });
190
224
  }
191
225
  //#endregion
192
- export { CONTENT_CONTROL_WIDGET_EVENT_NAME, contentControlWidgetsPluginKey, createContentControlWidgetsPlugin, dispatchDatePick, dispatchDropdownPick };
226
+ export { CONTENT_CONTROL_WIDGET_EVENT_NAME, contentControlWidgetsPluginKey, createContentControlWidgetsPlugin, dispatchDatePick, dispatchDropdownPick, handleContentControlWidgetClick };
@@ -36,6 +36,7 @@ function extractSelectionContext(state) {
36
36
  paragraphFormatting.lineSpacing = paragraph.attrs["lineSpacing"];
37
37
  paragraphFormatting.lineSpacingRule = paragraph.attrs["lineSpacingRule"];
38
38
  }
39
+ if (typeof paragraph.attrs["snapToGrid"] === "boolean") paragraphFormatting.snapToGrid = paragraph.attrs["snapToGrid"];
39
40
  if (paragraph.attrs["indentLeft"]) paragraphFormatting.indentLeft = paragraph.attrs["indentLeft"];
40
41
  if (paragraph.attrs["indentRight"]) paragraphFormatting.indentRight = paragraph.attrs["indentRight"];
41
42
  if (paragraph.attrs["indentFirstLine"]) paragraphFormatting.indentFirstLine = paragraph.attrs["indentFirstLine"];
@@ -1,6 +1,6 @@
1
1
  import { splitBlockClearBorders } from "../extensions/features/BaseKeymapExtension.js";
2
- import { Plugin, PluginKey, TextSelection } from "prosemirror-state";
3
2
  import { isHistoryTransaction } from "prosemirror-history";
3
+ import { Plugin, PluginKey, TextSelection } from "prosemirror-state";
4
4
  //#region src/prosemirror/plugins/suggestionMode.ts
5
5
  /**
6
6
  * Suggestion Mode Plugin
@@ -1,6 +1,6 @@
1
1
  import { ExtensionManager } from "../extensions/ExtensionManager.js";
2
2
  import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "./nodes.js";
3
- import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "./marks.js";
3
+ import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "./marks.js";
4
4
 
5
5
  //#region src/prosemirror/schema/index.d.ts
6
6
  declare const singletonManager: ExtensionManager;
@@ -12,4 +12,4 @@ type DocxSchema = typeof schema;
12
12
  type DocxNode = ReturnType<typeof schema.node>;
13
13
  type DocxMark = ReturnType<typeof schema.mark>;
14
14
  //#endregion
15
- export { type BlockSdtAttrs, type CharacterSpacingAttrs, type CharacterStyleAttrs, type CommentAttrs, DocxMark, DocxNode, DocxSchema, type EmphasisMarkAttrs, type FieldAttrs, type FontFamilyAttrs, type FontSizeAttrs, type FootnoteRefAttrs, type HardBreakAttrs, type HighlightAttrs, type HyperlinkAttrs, type ImageAttrs, type ImagePositionAttrs, type LanguageAttrs, type MathAttrs, type ParagraphAttrs, type RunFormattingOverrideAttrs, type RunShadingAttrs, type SdtAttrs, type ShapeAttrs, type StrikeAttrs, type TableAttrs, type TableCellAttrs, type TableRowAttrs, type TextBoxAttrs, type TextColorAttrs, type TextEffectAttrs, type TrackedChangeMarkAttrs, type UnderlineAttrs, schema, singletonManager };
15
+ export { type BlockSdtAttrs, type CharacterSpacingAttrs, type CharacterStyleAttrs, type CommentAttrs, DocxMark, DocxNode, DocxSchema, type EmphasisMarkAttrs, type FieldAttrs, type FontFamilyAttrs, type FontSizeAttrs, type FootnoteRefAttrs, type HardBreakAttrs, type HighlightAttrs, type HyperlinkAttrs, type ImageAttrs, type ImagePositionAttrs, type LanguageAttrs, type MathAttrs, type ParagraphAttrs, type RunFormattingOverrideAttrs, type RunPropertyChangeMarkAttrs, type RunShadingAttrs, type SdtAttrs, type ShapeAttrs, type StrikeAttrs, type TableAttrs, type TableCellAttrs, type TableRowAttrs, type TextBoxAttrs, type TextColorAttrs, type TextEffectAttrs, type TrackedChangeMarkAttrs, type UnderlineAttrs, schema, singletonManager };
@@ -91,6 +91,10 @@ type TrackedChangeMarkAttrs = {
91
91
  date?: string;
92
92
  moveKind?: "moveTo" | "moveFrom";
93
93
  };
94
+ /** Run-property revisions carried through the editable model. */
95
+ type RunPropertyChangeMarkAttrs = {
96
+ changes: document_d_exports.RunPropertyChange[];
97
+ };
94
98
  type RunFormattingOverrideAttrs = { [K in keyof Pick<document_d_exports.TextFormatting, "bold" | "italic" | "strike" | "doubleStrike" | "allCaps" | "smallCaps" | "hidden" | "emboss" | "imprint" | "shadow" | "outline" | "rtl">]?: false } & {
95
99
  underline?: "none";
96
100
  };
@@ -120,4 +124,4 @@ type HyperlinkAttrs = {
120
124
  _docxHyperlinkIndex?: number;
121
125
  };
122
126
  //#endregion
123
- export { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs };
127
+ export { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs };
@@ -21,8 +21,10 @@ type ParagraphAttrs = {
21
21
  spaceAfter?: number;
22
22
  lineSpacing?: number;
23
23
  lineSpacingRule?: document_d_exports.LineSpacingRule;
24
+ snapToGrid?: boolean;
24
25
  spacingExplicit?: SpacingExplicit; /** Layout provenance: document defaults survive on empty paragraphs. */
25
- spacingFromDocDefaults?: SpacingExplicit;
26
+ spacingFromDocDefaults?: SpacingExplicit; /** Layout provenance: implicit default-style spacing survives on empty paragraphs. */
27
+ spacingFromImplicitDefaultStyle?: SpacingExplicit;
26
28
  indentLeft?: number;
27
29
  indentRight?: number;
28
30
  indentFirstLine?: number;
@@ -88,7 +90,8 @@ type ParagraphAttrs = {
88
90
  tabs?: document_d_exports.TabStop[];
89
91
  pageBreakBefore?: boolean; /** Word's cached rendered-page-break marker; preserved for round-trip only. */
90
92
  renderedPageBreakBefore?: boolean; /** Internal import marker for a paragraph whose only run content is a hard page break. */
91
- _pageBreakCarrier?: boolean;
93
+ _pageBreakCarrier?: boolean; /** Internal import marker for a hard page break after this paragraph's text. */
94
+ _trailingPageBreak?: boolean;
92
95
  keepNext?: boolean;
93
96
  keepLines?: boolean;
94
97
  widowControl?: boolean; /** Contextual spacing — suppress space between same-style paragraphs */
@@ -337,7 +340,26 @@ type TextBoxAttrs = {
337
340
  distRight?: number; /** Position for floating/anchored text boxes */
338
341
  position?: ImagePositionAttrs; /** Original DOCX placement hint for save-path reconstruction. */
339
342
  _docxPlacement?: "standalone" | "inlineWithPrevious"; /** Original DOCX paragraph group for standalone text-box reconstruction. */
340
- _docxGroupId?: string;
343
+ _docxGroupId?: string; /** Inline anchor linking this block node to its source run position. */
344
+ _docxAnchorId?: string; /** Original run-level revision wrapper for save-path reconstruction. */
345
+ _docxTrackedChange?: {
346
+ type: "insertion";
347
+ info: document_d_exports.TrackedChangeInfo;
348
+ } | {
349
+ type: "deletion";
350
+ info: document_d_exports.TrackedChangeInfo;
351
+ } | {
352
+ type: "moveFrom";
353
+ info: document_d_exports.TrackedChangeInfo;
354
+ } | {
355
+ type: "moveTo";
356
+ info: document_d_exports.TrackedChangeInfo;
357
+ }; /** Original inline content-control ancestry for save-path reconstruction. */
358
+ _docxInlineSdts?: SdtAttrs[];
359
+ };
360
+ /** Internal inline position marker for an extracted text box block. */
361
+ type TextBoxAnchorAttrs = {
362
+ anchorId: string;
341
363
  };
342
364
  /**
343
365
  * Table node attributes
@@ -371,7 +393,24 @@ type TableRowAttrs = {
371
393
  hidden?: boolean; /** Original row formatting from DOCX for lossless round-trip serialization */
372
394
  _originalFormatting?: document_d_exports.TableRowFormatting; /** Tracked row property changes (w:trPrChange) for round-trip + accept/reject */
373
395
  trPrChange?: document_d_exports.TableRowPropertyChange[];
374
- };
396
+ } & ({
397
+ /** Tracked structural row insertion (w:trPr/w:ins). */trIns: {
398
+ revisionId: number;
399
+ author: string;
400
+ date?: string | null;
401
+ };
402
+ trDel?: never;
403
+ } | {
404
+ trIns?: never; /** Tracked structural row deletion (w:trPr/w:del). */
405
+ trDel: {
406
+ revisionId: number;
407
+ author: string;
408
+ date?: string | null;
409
+ };
410
+ } | {
411
+ trIns?: never;
412
+ trDel?: never;
413
+ });
375
414
  /**
376
415
  * Table cell attributes
377
416
  */
@@ -385,7 +424,8 @@ type TableCellAttrs = {
385
424
  backgroundColor?: string; /** Resolved source color. PM-only; distinguishes theme rendering from a user override. */
386
425
  _resolvedBackgroundColor?: string; /** OOXML text direction (e.g. 'tbRl', 'btLr') */
387
426
  textDirection?: NonNullable<document_d_exports.TableCellFormatting["textDirection"]>; /** No text wrapping in cell */
388
- noWrap?: boolean; /** Cell borders full BorderSpec per side (style, color, size) */
427
+ noWrap?: boolean; /** Effective end-of-cell marker suppression (`w:hideMark`). */
428
+ hideMark?: boolean; /** Cell borders — full BorderSpec per side (style, color, size) */
389
429
  borders?: document_d_exports.TableCellBorders; /** Cell margins/padding in twips per side */
390
430
  margins?: {
391
431
  top?: number;
@@ -394,9 +434,26 @@ type TableCellAttrs = {
394
434
  right?: number;
395
435
  }; /** Original cell formatting from DOCX for lossless round-trip serialization */
396
436
  _originalFormatting?: document_d_exports.TableCellFormatting; /** Tracked cell property changes (w:tcPrChange) for round-trip + accept/reject */
397
- tcPrChange?: document_d_exports.TableCellPropertyChange[]; /** Preserve a DOCX vMerge restart even when PM cannot model it as a rowspan. */
437
+ tcPrChange?: document_d_exports.TableCellPropertyChange[]; /** Tracked cell structural revision for round-trip + accept/reject. */
438
+ cellMarker?: {
439
+ kind: "ins" | "del";
440
+ info: {
441
+ revisionId: number;
442
+ author: string;
443
+ date?: string | null;
444
+ };
445
+ } | {
446
+ kind: "merge";
447
+ info: {
448
+ revisionId: number;
449
+ author: string;
450
+ date?: string | null;
451
+ };
452
+ verticalMerge?: "continue" | "rest";
453
+ verticalMergeOriginal?: "continue" | "rest";
454
+ }; /** Preserve a DOCX vMerge restart even when PM cannot model it as a rowspan. */
398
455
  _preserveVMergeRestart?: boolean; /** Original DOCX vMerge continuation cells skipped into this PM rowspan. */
399
456
  _docxVMergeContinuationCells?: document_d_exports.TableCell[];
400
457
  };
401
458
  //#endregion
402
- export { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs };
459
+ export { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAnchorAttrs, TextBoxAttrs };
@@ -71,6 +71,7 @@ function extractSelectionState(state) {
71
71
  paragraphFormatting.lineSpacing = paragraph.attrs["lineSpacing"];
72
72
  paragraphFormatting.lineSpacingRule = paragraph.attrs["lineSpacingRule"];
73
73
  }
74
+ if (typeof paragraph.attrs["snapToGrid"] === "boolean") paragraphFormatting.snapToGrid = paragraph.attrs["snapToGrid"];
74
75
  if (paragraph.attrs["numPr"]) paragraphFormatting.numPr = paragraph.attrs["numPr"];
75
76
  if (paragraph.attrs["indentLeft"]) paragraphFormatting.indentLeft = paragraph.attrs["indentLeft"];
76
77
  if (paragraph.attrs["indentRight"]) paragraphFormatting.indentRight = paragraph.attrs["indentRight"];
@@ -27,6 +27,7 @@ function paragraphAttrsFromResolvedStyle(resolved) {
27
27
  spaceAfter: ppr?.spaceAfter ?? null,
28
28
  lineSpacing: ppr?.lineSpacing ?? null,
29
29
  lineSpacingRule: ppr?.lineSpacingRule ?? null,
30
+ snapToGrid: ppr?.snapToGrid ?? null,
30
31
  indentLeft: ppr?.indentLeft ?? null,
31
32
  indentRight: ppr?.indentRight ?? null,
32
33
  indentFirstLine: ppr?.indentFirstLine ?? null,
@@ -0,0 +1,9 @@
1
+ import { document_d_exports } from "../types/document.js";
2
+
3
+ //#region src/prosemirror/tableCellMergeRevision.d.ts
4
+ type TableCellMergeChange = Extract<NonNullable<document_d_exports.TableCell["structuralChange"]>, {
5
+ type: "tableCellMerge";
6
+ }>;
7
+ declare const getTableCellMergeChange: (value: unknown) => TableCellMergeChange | null;
8
+ //#endregion
9
+ export { TableCellMergeChange, getTableCellMergeChange };
@@ -0,0 +1,22 @@
1
+ //#region src/prosemirror/tableCellMergeRevision.ts
2
+ const isRecord = (value) => typeof value === "object" && value !== null;
3
+ const isVerticalMergeRevisionValue = (value) => value === "continue" || value === "rest";
4
+ const getTableCellMergeChange = (value) => {
5
+ if (!isRecord(value)) return null;
6
+ const change = value["structuralChange"];
7
+ if (!isRecord(change) || change["type"] !== "tableCellMerge") return null;
8
+ const info = change["info"];
9
+ if (!isRecord(info) || typeof info["id"] !== "number" || typeof info["author"] !== "string") return null;
10
+ return {
11
+ type: "tableCellMerge",
12
+ info: {
13
+ id: info["id"],
14
+ author: info["author"],
15
+ ...typeof info["date"] === "string" ? { date: info["date"] } : {}
16
+ },
17
+ ...isVerticalMergeRevisionValue(change["verticalMerge"]) ? { verticalMerge: change["verticalMerge"] } : {},
18
+ ...isVerticalMergeRevisionValue(change["verticalMergeOriginal"]) ? { verticalMergeOriginal: change["verticalMergeOriginal"] } : {}
19
+ };
20
+ };
21
+ //#endregion
22
+ export { getTableCellMergeChange };
@@ -0,0 +1,9 @@
1
+ import { TextBoxAnchorAttrs } from "./schema/nodes.js";
2
+ import { ReadProseMirrorAttrsResult } from "./attrs/index.js";
3
+ import { Node } from "prosemirror-model";
4
+
5
+ //#region src/prosemirror/textBoxAnchorAttrs.d.ts
6
+ declare const readTextBoxAnchorAttrs: (node: Node) => ReadProseMirrorAttrsResult<TextBoxAnchorAttrs>;
7
+ declare const expectTextBoxAnchorAttrs: (node: Node) => TextBoxAnchorAttrs;
8
+ //#endregion
9
+ export { expectTextBoxAnchorAttrs, readTextBoxAnchorAttrs };
@@ -0,0 +1,33 @@
1
+ import { panic } from "better-result";
2
+ //#region src/prosemirror/textBoxAnchorAttrs.ts
3
+ const attrsCache = /* @__PURE__ */ new WeakMap();
4
+ const readTextBoxAnchorAttrs = (node) => {
5
+ const issues = [];
6
+ if (node.type.name !== "textBoxAnchor") issues.push({
7
+ path: "textBoxAnchor.type.name",
8
+ message: `Expected textBoxAnchor, got ${node.type.name}.`
9
+ });
10
+ const anchorId = node.attrs["anchorId"];
11
+ if (typeof anchorId !== "string" || anchorId.length === 0) issues.push({
12
+ path: "textBoxAnchor.attrs.anchorId",
13
+ message: "Expected a non-empty string."
14
+ });
15
+ if (issues.length > 0 || typeof anchorId !== "string") return {
16
+ ok: false,
17
+ issues
18
+ };
19
+ return {
20
+ ok: true,
21
+ value: { anchorId }
22
+ };
23
+ };
24
+ const expectTextBoxAnchorAttrs = (node) => {
25
+ const cached = attrsCache.get(node);
26
+ if (cached) return cached;
27
+ const result = readTextBoxAnchorAttrs(node);
28
+ if (!result.ok) panic(`Invalid ProseMirror text box anchor attrs:\n${result.issues.map((issue) => `${issue.path}: ${issue.message}`).join("\n")}`);
29
+ attrsCache.set(node, result.value);
30
+ return result.value;
31
+ };
32
+ //#endregion
33
+ export { expectTextBoxAnchorAttrs, readTextBoxAnchorAttrs };
@@ -32,7 +32,7 @@ type TrackedChangeEntry = {
32
32
  * - `tablePropertiesChanged` — table-level formatting
33
33
  * (`<w:tblPrChange>`).
34
34
  */
35
- type: "insertion" | "deletion" | "replacement" | "paragraphMarkInsertion" | "paragraphMarkDeletion" | "paragraphPropertiesChanged" | "rowInserted" | "rowDeleted" | "rowPropertiesChanged" | "cellInserted" | "cellDeleted" | "cellMerged" | "cellPropertiesChanged" | "tableInserted" | "tableDeleted" | "tablePropertiesChanged";
35
+ type: "insertion" | "deletion" | "replacement" | "runPropertiesChanged" | "paragraphMarkInsertion" | "paragraphMarkDeletion" | "paragraphPropertiesChanged" | "rowInserted" | "rowDeleted" | "rowPropertiesChanged" | "cellInserted" | "cellDeleted" | "cellMerged" | "cellPropertiesChanged" | "tableInserted" | "tableDeleted" | "tablePropertiesChanged";
36
36
  /**
37
37
  * Affected text. For inline types this is the run's text; for
38
38
  * structural types it's the surrounding paragraph / cell content
@@ -1,3 +1,5 @@
1
+ import { expectRunPropertyChangeMarkAttrs } from "../attrs/index.js";
2
+ import { getTableCellMergeChange } from "../tableCellMergeRevision.js";
1
3
  //#region src/prosemirror/utils/extractTrackedChanges.ts
2
4
  const EMPTY_RESULT = {
3
5
  entries: [],
@@ -23,7 +25,8 @@ function extractTrackedChanges(state) {
23
25
  const insertionType = schema.marks["insertion"];
24
26
  const deletionType = schema.marks["deletion"];
25
27
  const commentType = schema.marks["comment"];
26
- if (!insertionType && !deletionType) return EMPTY_RESULT;
28
+ const runPropertyChangeType = schema.marks["runPropertyChange"];
29
+ if (!insertionType && !deletionType && !runPropertyChangeType) return EMPTY_RESULT;
27
30
  const raw = [];
28
31
  const commentToRevision = /* @__PURE__ */ new Map();
29
32
  const commentMetadata = /* @__PURE__ */ new Map();
@@ -116,6 +119,20 @@ function extractTrackedChanges(state) {
116
119
  revisionId: cellMarker.info.revisionId
117
120
  });
118
121
  }
122
+ const continuationCells = node.attrs["_docxVMergeContinuationCells"];
123
+ if (Array.isArray(continuationCells)) for (const continuationCell of continuationCells) {
124
+ const change = getTableCellMergeChange(continuationCell);
125
+ if (!change) continue;
126
+ raw.push({
127
+ type: "cellMerged",
128
+ text: node.textContent || "",
129
+ author: change.info.author,
130
+ date: change.info.date,
131
+ from: pos,
132
+ to: pos + node.nodeSize,
133
+ revisionId: change.info.id
134
+ });
135
+ }
119
136
  const tcPrChange = node.attrs["tcPrChange"];
120
137
  if (Array.isArray(tcPrChange)) for (const entry of tcPrChange) {
121
138
  if (!entry?.info || typeof entry.info.id !== "number") continue;
@@ -193,17 +210,31 @@ function extractTrackedChanges(state) {
193
210
  else if (node.type.name === "image") inlineText = node.attrs["alt"] || "image";
194
211
  else inlineText = node.type.name;
195
212
  let tcMark = null;
196
- for (const mark of node.marks) if (mark.type === insertionType || mark.type === deletionType) {
197
- raw.push({
198
- type: mark.type === insertionType ? "insertion" : "deletion",
199
- text: inlineText,
200
- author: mark.attrs["author"] || "",
201
- date: mark.attrs["date"],
202
- from: pos,
203
- to: pos + node.nodeSize,
204
- revisionId: mark.attrs["revisionId"]
205
- });
206
- tcMark = mark;
213
+ for (const mark of node.marks) {
214
+ if (mark.type === runPropertyChangeType) {
215
+ for (const change of expectRunPropertyChangeMarkAttrs(mark).changes) raw.push({
216
+ type: "runPropertiesChanged",
217
+ text: inlineText,
218
+ author: change.info.author,
219
+ date: change.info.date,
220
+ from: pos,
221
+ to: pos + node.nodeSize,
222
+ revisionId: change.info.id
223
+ });
224
+ continue;
225
+ }
226
+ if (mark.type === insertionType || mark.type === deletionType) {
227
+ raw.push({
228
+ type: mark.type === insertionType ? "insertion" : "deletion",
229
+ text: inlineText,
230
+ author: mark.attrs["author"] || "",
231
+ date: mark.attrs["date"],
232
+ from: pos,
233
+ to: pos + node.nodeSize,
234
+ revisionId: mark.attrs["revisionId"]
235
+ });
236
+ tcMark = mark;
237
+ }
207
238
  }
208
239
  if (commentType) {
209
240
  const commentMark = node.marks.find((m) => m.type === commentType);
@@ -239,7 +270,24 @@ function extractTrackedChanges(state) {
239
270
  cellPropertiesChanged: 3,
240
271
  paragraphMarkInsertion: 2,
241
272
  paragraphMarkDeletion: 2,
242
- paragraphPropertiesChanged: 2
273
+ paragraphPropertiesChanged: 2,
274
+ runPropertiesChanged: 1
275
+ };
276
+ const STRUCTURAL_FAMILY_BY_TYPE = {
277
+ tableInserted: "insertion",
278
+ rowInserted: "insertion",
279
+ cellInserted: "insertion",
280
+ paragraphMarkInsertion: "insertion",
281
+ tableDeleted: "deletion",
282
+ rowDeleted: "deletion",
283
+ cellDeleted: "deletion",
284
+ paragraphMarkDeletion: "deletion",
285
+ tablePropertiesChanged: "properties",
286
+ rowPropertiesChanged: "properties",
287
+ cellPropertiesChanged: "properties",
288
+ paragraphPropertiesChanged: "properties",
289
+ runPropertiesChanged: "properties",
290
+ cellMerged: "merge"
243
291
  };
244
292
  const isStructuralType = (t) => t in STRUCTURAL_PRIORITY;
245
293
  const slotByKey = /* @__PURE__ */ new Map();
@@ -256,7 +304,7 @@ function extractTrackedChanges(state) {
256
304
  ordered.push(entry);
257
305
  continue;
258
306
  }
259
- const key = `${entry.author}|${entry.date ?? ""}`;
307
+ const key = `${STRUCTURAL_FAMILY_BY_TYPE[entry.type] ?? entry.type}|${entry.author}|${entry.date ?? ""}`;
260
308
  const slot = slotByKey.get(key);
261
309
  if (slot === void 0) {
262
310
  slotByKey.set(key, ordered.push(entry) - 1);
@@ -1,4 +1,5 @@
1
- import { readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs } from "./attrs/index.js";
1
+ import { readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs } from "./attrs/index.js";
2
+ import { readTextBoxAnchorAttrs } from "./textBoxAnchorAttrs.js";
2
3
  //#region src/prosemirror/validation.ts
3
4
  var ProseMirrorDocumentValidationError = class extends Error {
4
5
  issues;
@@ -48,6 +49,7 @@ const validateNodeAttrs = (node, path, issues) => {
48
49
  case "text":
49
50
  case "horizontalRule":
50
51
  case "pageBreak":
52
+ case "renderedPageBreak":
51
53
  case "tab": return;
52
54
  case "hardBreak":
53
55
  appendAttrIssues(path, readHardBreakAttrs(node), issues);
@@ -87,6 +89,9 @@ const validateNodeAttrs = (node, path, issues) => {
87
89
  case "textBox":
88
90
  appendAttrIssues(path, readTextBoxAttrs(node), issues);
89
91
  return;
92
+ case "textBoxAnchor":
93
+ appendAttrIssues(path, readTextBoxAnchorAttrs(node), issues);
94
+ return;
90
95
  default: issues.push({
91
96
  path: `${path}.type.name`,
92
97
  message: `Unsupported ProseMirror node type ${node.type.name}.`
@@ -155,6 +160,9 @@ const validateMarks = (marks, path, issues) => {
155
160
  case "deletion":
156
161
  appendAttrIssues(markPath, readTrackedChangeMarkAttrs(mark), issues);
157
162
  continue;
163
+ case "runPropertyChange":
164
+ appendAttrIssues(markPath, readRunPropertyChangeMarkAttrs(mark), issues);
165
+ continue;
158
166
  case "runFormattingOverride":
159
167
  appendAttrIssues(markPath, readRunFormattingOverrideMarkAttrs(mark), issues);
160
168
  continue;