@stll/folio-core 0.74.0 → 0.76.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 (174) hide show
  1. package/dist/ai-edits/clean-text.d.ts +4 -1
  2. package/dist/ai-edits/clean-text.js +21 -7
  3. package/dist/ai-edits/headless.d.ts +7 -3
  4. package/dist/ai-edits/headless.js +36 -21
  5. package/dist/ai-edits/note-references.d.ts +1 -1
  6. package/dist/ai-edits/note-references.js +1 -1
  7. package/dist/ai-edits/pending-suggestions.d.ts +9 -7
  8. package/dist/ai-edits/pending-suggestions.js +135 -90
  9. package/dist/ai-edits/pendingJoin.d.ts +5 -1
  10. package/dist/ai-edits/pendingJoin.js +6 -2
  11. package/dist/ai-edits/read.js +9 -3
  12. package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
  13. package/dist/ai-edits/retired-comment-receipts.js +3 -18
  14. package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
  15. package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
  16. package/dist/ai-edits/types.d.ts +9 -4
  17. package/dist/canonical/batchCommentReferences.js +2 -1
  18. package/dist/canonical/canonicalBatchReview.d.ts +4 -1
  19. package/dist/canonical/canonicalBatchReview.js +37 -22
  20. package/dist/canonical/canonicalComments.d.ts +6 -2
  21. package/dist/canonical/canonicalComments.js +16 -6
  22. package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
  23. package/dist/canonical/canonicalCompilerRefusal.js +20 -14
  24. package/dist/canonical/canonicalPublicOperations.js +231 -79
  25. package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
  26. package/dist/canonical/canonicalRefusalGrounds.js +56 -0
  27. package/dist/canonical/canonicalSession.d.ts +12 -6
  28. package/dist/canonical/canonicalSession.js +119 -122
  29. package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
  30. package/dist/compare/inline-atoms.d.ts +35 -41
  31. package/dist/compare/inline-atoms.js +2 -465
  32. package/dist/compare/section-boundary-properties.d.ts +3 -30
  33. package/dist/compare/section-boundary-properties.js +4 -72
  34. package/dist/controller/canonicalClipboard.d.ts +1 -1
  35. package/dist/controller/canonicalClipboard.js +110 -55
  36. package/dist/controller/canonicalComposition.d.ts +1 -1
  37. package/dist/controller/canonicalComposition.js +5 -5
  38. package/dist/controller/canonicalContentControlValue.js +7 -7
  39. package/dist/controller/canonicalInput.d.ts +4 -2
  40. package/dist/controller/canonicalInput.js +33 -16
  41. package/dist/controller/canonicalReview.d.ts +21 -0
  42. package/dist/controller/canonicalReview.js +44 -9
  43. package/dist/controller/canonicalStoryEditor.d.ts +2 -3
  44. package/dist/controller/canonicalStoryEditor.js +43 -25
  45. package/dist/controller/canonicalStructure.d.ts +19 -3
  46. package/dist/controller/canonicalStructure.js +182 -58
  47. package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
  48. package/dist/controller/deferredDisplayListPainter.js +34 -0
  49. package/dist/controller/folioEditor.js +4 -2
  50. package/dist/controller/fontReadiness.js +50 -23
  51. package/dist/controller/headerFooterEditorManager.js +3 -17
  52. package/dist/controller/hiddenEditorApi.d.ts +24 -3
  53. package/dist/controller/hiddenEditorApi.js +2 -0
  54. package/dist/controller/hiddenEditorManager.js +135 -207
  55. package/dist/controller/layoutPipeline.d.ts +4 -86
  56. package/dist/controller/layoutPipeline.js +8 -727
  57. package/dist/controller/layoutPipelineExecution.d.ts +94 -0
  58. package/dist/controller/layoutPipelineExecution.js +730 -0
  59. package/dist/controller/noteEditorManager.js +3 -16
  60. package/dist/docx/blockContentParser.d.ts +1 -3
  61. package/dist/docx/blockContentParser.js +3 -10
  62. package/dist/docx/bulletMarkers.d.ts +8 -0
  63. package/dist/docx/bulletMarkers.js +9 -1
  64. package/dist/docx/canonicalSave.d.ts +4 -3
  65. package/dist/docx/canonicalSave.js +4 -3
  66. package/dist/docx/canonicalSessionInput.js +25 -11
  67. package/dist/docx/ensureParaIds.d.ts +31 -0
  68. package/dist/docx/ensureParaIds.js +57 -32
  69. package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
  70. package/dist/docx/ensureUniqueControlIds.js +47 -29
  71. package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
  72. package/dist/docx/ensureUniqueRevisionIds.js +52 -29
  73. package/dist/docx/listMarkerComputation.d.ts +24 -17
  74. package/dist/docx/listMarkerComputation.js +31 -60
  75. package/dist/docx/listModelNormalization.js +8 -15
  76. package/dist/docx/rezip.d.ts +16 -3
  77. package/dist/docx/rezip.js +35 -9
  78. package/dist/docx/selectiveSave.js +13 -5
  79. package/dist/docx/server/templatePlan/apply.js +96 -7
  80. package/dist/docx/server/templatePlan/blocks.d.ts +70 -3
  81. package/dist/docx/server/templatePlan/blocks.js +272 -10
  82. package/dist/docx/server/templatePlan/builders.d.ts +52 -2
  83. package/dist/docx/server/templatePlan/builders.js +224 -5
  84. package/dist/docx/server/templatePlan/effects.d.ts +27 -0
  85. package/dist/docx/server/templatePlan/effects.js +188 -0
  86. package/dist/docx/server/templatePlan/emit.d.ts +4 -1
  87. package/dist/docx/server/templatePlan/emit.js +46 -2
  88. package/dist/docx/server/templatePlan/inspect.js +39 -52
  89. package/dist/docx/server/templatePlan/labels.d.ts +7 -2
  90. package/dist/docx/server/templatePlan/labels.js +120 -23
  91. package/dist/docx/server/templatePlan/plan.d.ts +24 -3
  92. package/dist/docx/server/templatePlan/plan.js +54 -15
  93. package/dist/docx/server/templatePlan/planShape.js +76 -22
  94. package/dist/docx/server/templatePlan/revisions.d.ts +46 -0
  95. package/dist/docx/server/templatePlan/revisions.js +407 -0
  96. package/dist/docx/server/templatePlan/story.d.ts +23 -1
  97. package/dist/docx/server/templatePlan/story.js +60 -2
  98. package/dist/docx/server/templatePlan/types.d.ts +354 -16
  99. package/dist/docx/server/templatePlan/verify.js +164 -14
  100. package/dist/docx/server/templatePlan/xml.d.ts +3 -0
  101. package/dist/docx/server/templatePlan/xml.js +4 -1
  102. package/dist/i18n/messages/ar.gen.js +1 -0
  103. package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
  104. package/dist/i18n/messages/catalogs.gen.js +17 -0
  105. package/dist/i18n/messages/cs.gen.js +1 -0
  106. package/dist/i18n/messages/de.gen.js +1 -0
  107. package/dist/i18n/messages/en.gen.js +1 -0
  108. package/dist/i18n/messages/es.gen.js +1 -0
  109. package/dist/i18n/messages/et.gen.js +1 -0
  110. package/dist/i18n/messages/fr.gen.js +1 -0
  111. package/dist/i18n/messages/he.gen.js +1 -0
  112. package/dist/i18n/messages/hi.gen.js +1 -0
  113. package/dist/i18n/messages/hu.gen.js +1 -0
  114. package/dist/i18n/messages/lt.gen.js +1 -0
  115. package/dist/i18n/messages/lv.gen.js +1 -0
  116. package/dist/i18n/messages/messages.gen.d.ts +1 -0
  117. package/dist/i18n/messages/pl.gen.js +1 -0
  118. package/dist/i18n/messages/pt-BR.gen.js +1 -0
  119. package/dist/i18n/messages/sk.gen.js +1 -0
  120. package/dist/i18n/messages/tr.gen.js +1 -0
  121. package/dist/i18n/messages/zh-CN.gen.js +1 -0
  122. package/dist/internal/revisionResolutionStep.d.ts +2 -31
  123. package/dist/internal/revisionResolutionStep.js +2 -171
  124. package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
  125. package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
  126. package/dist/prosemirror/commands/comments.d.ts +6 -234
  127. package/dist/prosemirror/commands/comments.js +5 -2464
  128. package/dist/prosemirror/commands/index.d.ts +4 -2
  129. package/dist/prosemirror/commands/index.js +4 -2
  130. package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -11
  131. package/dist/prosemirror/commands/tableCellMergeResolution.js +3 -154
  132. package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
  133. package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
  134. package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
  135. package/dist/prosemirror/hyperlinkRemoval.js +24 -15
  136. package/dist/prosemirror/listMarker.d.ts +1 -6
  137. package/dist/prosemirror/listMarker.js +4 -56
  138. package/dist/prosemirror/paraIds.d.ts +1 -14
  139. package/dist/prosemirror/paraIds.js +1 -14
  140. package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
  141. package/dist/prosemirror/paragraphMarkJoin.js +3 -46
  142. package/dist/prosemirror/projectionReview.d.ts +49 -0
  143. package/dist/prosemirror/projectionReview.js +292 -0
  144. package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
  145. package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
  146. package/dist/prosemirror/replacedAnnotations.d.ts +2 -5
  147. package/dist/prosemirror/replacedAnnotations.js +1 -10
  148. package/dist/prosemirror/revisionCarriers.d.ts +9 -1
  149. package/dist/prosemirror/revisionCarriers.js +15 -1
  150. package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
  151. package/dist/prosemirror/revisionRangeQueries.js +76 -0
  152. package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
  153. package/dist/prosemirror/runFormattingMarkNames.js +1 -1
  154. package/dist/prosemirror/suggestionQueries.d.ts +114 -0
  155. package/dist/prosemirror/suggestionQueries.js +320 -0
  156. package/dist/prosemirror/tableGridMutation.d.ts +1 -16
  157. package/dist/prosemirror/tableGridMutation.js +1 -78
  158. package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
  159. package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
  160. package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
  161. package/dist/server.d.ts +2 -2
  162. package/dist/types/canonicalCapabilities.d.ts +40 -69
  163. package/dist/types/canonicalCapabilities.js +51 -65
  164. package/dist/types/canonicalComments.d.ts +2 -2
  165. package/dist/types/canonicalSections.d.ts +2 -2
  166. package/dist/utils/clipboard.d.ts +2 -28
  167. package/dist/utils/clipboard.js +1 -96
  168. package/dist/utils/clipboardFiles.d.ts +27 -0
  169. package/dist/utils/clipboardFiles.js +98 -0
  170. package/dist/utils/rulerControl.d.ts +1 -0
  171. package/dist/utils/rulerControl.js +2 -1
  172. package/package.json +2 -2
  173. package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
  174. package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
@@ -8,11 +8,13 @@ import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
8
8
  import { getHyperlinkAttrs, getSelectedText, isHyperlinkActive } from "../extensions/marks/HyperlinkExtension.js";
9
9
  import { clearFormatting, createRemoveMarkCommand, createSetMarkCommand, getMarkAttr, isMarkActive } from "../extensions/marks/markUtils.js";
10
10
  import { BorderPreset, TableBorderPreset, TableContextInfo, getTableContext, isInTable as isInTableCell } from "../extensions/nodes/TableExtension.js";
11
- import { AcceptSuggestionOptions, FolioSuggestion, SuggestionAppliedAs, SuggestionKind, acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addCommentMark, findAIEditRevisionRange, findNextChange, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark } from "./comments.js";
11
+ import { addCommentMark, findNextChange, findPreviousChange, removeCommentMark } from "../projectionReview.js";
12
+ import { findAIEditRevisionRange } from "../revisionRangeQueries.js";
13
+ import { FolioSuggestion, SuggestionAppliedAs, SuggestionKind, findSuggestionRange, getSuggestions } from "../suggestionQueries.js";
12
14
  import { CapturedTextFormatting, PAINTABLE_MARK_NAMES, applyFormatMarks, captureFormatMarks } from "./formatPainter.js";
13
15
  import { clearFontFamily, clearFontSize, clearHighlight, clearTextColor, insertHyperlink, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, setUnderlineStyle, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "./formatting.js";
14
16
  import { insertPageBreak } from "./pageBreak.js";
15
17
  import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, continueNumbering, decreaseIndent, decreaseListLevel, doubleSpacing, generateTableOfContents, increaseIndent, increaseListLevel, oneAndHalfSpacing, removeList, removeTabStop, restartNumbering, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setNumberingValue, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList } from "./paragraph.js";
16
18
  import { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice, pasteWithoutFormatting } from "./pastePlainText.js";
17
19
  import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyle, autoFitContents, deleteColumn, deleteRow, deleteTable, distributeColumns, insertTable, mergeCells, removeTableBorders, selectColumn, selectRow, selectTable, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setInsideTableBorders, setOutsideTableBorders, setRowHeight, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, splitCell, toggleHeaderRow, toggleNoWrap } from "./table.js";
18
- export { type AcceptSuggestionOptions, type BorderPreset, CLIPBOARD_READ_ERROR_EVENT, type CapturedTextFormatting, type FolioSuggestion, type GenerateTableOfContentsOptions, PAINTABLE_MARK_NAMES, type ResolvedStyleAttrs, type SuggestionAppliedAs, type SuggestionKind, type TableBorderPreset, type TableContextInfo, acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addColumnLeft, addColumnRight, addCommentMark, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, buildPlainTextSlice, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createRemoveMarkCommand, createSetMarkCommand, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, doubleSpacing, findAIEditRevisionRange, findNextChange, findPreviousChange, findSuggestionRange, generateTableOfContents, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getStyleId, getSuggestions, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertPageBreak, insertTable, isHyperlinkActive, isInList, isInTableCell as isInTable, isMarkActive, mergeCells, oneAndHalfSpacing, pasteWithoutFormatting, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark, removeHyperlink, removeList, removeTabStop, removeTableBorders, restartNumbering, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setSpaceAfter, setSpaceBefore, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, setUnderlineStyle, singleSpacing, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline };
20
+ export { type BorderPreset, CLIPBOARD_READ_ERROR_EVENT, type CapturedTextFormatting, type FolioSuggestion, type GenerateTableOfContentsOptions, PAINTABLE_MARK_NAMES, type ResolvedStyleAttrs, type SuggestionAppliedAs, type SuggestionKind, type TableBorderPreset, type TableContextInfo, addColumnLeft, addColumnRight, addCommentMark, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, buildPlainTextSlice, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createRemoveMarkCommand, createSetMarkCommand, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, doubleSpacing, findAIEditRevisionRange, findNextChange, findPreviousChange, findSuggestionRange, generateTableOfContents, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getStyleId, getSuggestions, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertPageBreak, insertTable, isHyperlinkActive, isInList, isInTableCell as isInTable, isMarkActive, mergeCells, oneAndHalfSpacing, pasteWithoutFormatting, removeCommentMark, removeHyperlink, removeList, removeTabStop, removeTableBorders, restartNumbering, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setSpaceAfter, setSpaceBefore, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, setUnderlineStyle, singleSpacing, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline };
@@ -3,11 +3,13 @@ import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
3
3
  import { getHyperlinkAttrs, getSelectedText, isHyperlinkActive } from "../extensions/marks/HyperlinkExtension.js";
4
4
  import { clearFormatting, createRemoveMarkCommand, createSetMarkCommand, getMarkAttr, isMarkActive } from "../extensions/marks/markUtils.js";
5
5
  import { getTableContext, isInTable as isInTableCell } from "../extensions/nodes/TableExtension.js";
6
- import { acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addCommentMark, findAIEditRevisionRange, findNextChange, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark } from "./comments.js";
6
+ import { addCommentMark, findNextChange, findPreviousChange, removeCommentMark } from "../projectionReview.js";
7
+ import { findAIEditRevisionRange } from "../revisionRangeQueries.js";
8
+ import { findSuggestionRange, getSuggestions } from "../suggestionQueries.js";
7
9
  import { PAINTABLE_MARK_NAMES, applyFormatMarks, captureFormatMarks } from "./formatPainter.js";
8
10
  import { clearFontFamily, clearFontSize, clearHighlight, clearTextColor, insertHyperlink, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, setUnderlineStyle, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "./formatting.js";
9
11
  import { insertPageBreak } from "./pageBreak.js";
10
12
  import { addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyStyle, clearStyle, continueNumbering, decreaseIndent, decreaseListLevel, doubleSpacing, generateTableOfContents, increaseIndent, increaseListLevel, oneAndHalfSpacing, removeList, removeTabStop, restartNumbering, setAlignment, setIndentFirstLine, setIndentLeft, setIndentRight, setLineSpacing, setLtr, setNumberingValue, setRtl, setSpaceAfter, setSpaceBefore, singleSpacing, toggleBidi, toggleBulletList, toggleNumberedList } from "./paragraph.js";
11
13
  import { CLIPBOARD_READ_ERROR_EVENT, buildPlainTextSlice, pasteWithoutFormatting } from "./pastePlainText.js";
12
14
  import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyle, autoFitContents, deleteColumn, deleteRow, deleteTable, distributeColumns, insertTable, mergeCells, removeTableBorders, selectColumn, selectRow, selectTable, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setInsideTableBorders, setOutsideTableBorders, setRowHeight, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, splitCell, toggleHeaderRow, toggleNoWrap } from "./table.js";
13
- export { CLIPBOARD_READ_ERROR_EVENT, PAINTABLE_MARK_NAMES, acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addColumnLeft, addColumnRight, addCommentMark, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, buildPlainTextSlice, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createRemoveMarkCommand, createSetMarkCommand, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, doubleSpacing, findAIEditRevisionRange, findNextChange, findPreviousChange, findSuggestionRange, generateTableOfContents, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getStyleId, getSuggestions, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertPageBreak, insertTable, isHyperlinkActive, isInList, isInTableCell as isInTable, isMarkActive, mergeCells, oneAndHalfSpacing, pasteWithoutFormatting, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark, removeHyperlink, removeList, removeTabStop, removeTableBorders, restartNumbering, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setSpaceAfter, setSpaceBefore, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, setUnderlineStyle, singleSpacing, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline };
15
+ export { CLIPBOARD_READ_ERROR_EVENT, PAINTABLE_MARK_NAMES, addColumnLeft, addColumnRight, addCommentMark, addRowAbove, addRowBelow, addTabStop, alignCenter, alignJustify, alignLeft, alignRight, applyFormatMarks, applyStyle, applyTableStyle, autoFitContents, buildPlainTextSlice, captureFormatMarks, clearFontFamily, clearFontSize, clearFormatting, clearHighlight, clearStyle, clearTextColor, continueNumbering, createRemoveMarkCommand, createSetMarkCommand, decreaseIndent, decreaseListLevel, deleteColumn, deleteRow, deleteTable, distributeColumns, doubleSpacing, findAIEditRevisionRange, findNextChange, findPreviousChange, findSuggestionRange, generateTableOfContents, getHyperlinkAttrs, getListInfo, getMarkAttr, getParagraphAlignment, getParagraphBidi, getSelectedText, getStyleId, getSuggestions, getTableContext, increaseIndent, increaseListLevel, insertHyperlink, insertPageBreak, insertTable, isHyperlinkActive, isInList, isInTableCell as isInTable, isMarkActive, mergeCells, oneAndHalfSpacing, pasteWithoutFormatting, removeCommentMark, removeHyperlink, removeList, removeTabStop, removeTableBorders, restartNumbering, selectColumn, selectRow, selectTable, setAlignment, setAllTableBorders, setCellBorder, setCellFillColor, setCellMargins, setCellTextDirection, setCellVerticalAlign, setFontFamily, setFontSize, setHighlight, setHyperlink, setIndentFirstLine, setIndentLeft, setIndentRight, setInsideTableBorders, setLineSpacing, setLtr, setNumberingValue, setOutsideTableBorders, setRowHeight, setRtl, setSpaceAfter, setSpaceBefore, setTableBorderColor, setTableBorderPreset, setTableBorderWidth, setTableBorders, setTableProperties, setTextColor, setUnderlineStyle, singleSpacing, splitCell, toggleBidi, toggleBold, toggleBulletList, toggleHeaderRow, toggleItalic, toggleNoWrap, toggleNumberedList, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline };
@@ -1,18 +1,8 @@
1
1
  import { DecodedTableCellParagraphSourcePayload } from "../../docx/paragraphPropertySource.js";
2
2
  import { document_d_exports } from "../../types/document.js";
3
- import { Transaction } from "prosemirror-state";
4
3
  import { Node } from "prosemirror-model";
5
4
  export declare const tableCellContinuationPayload: (node: Node) => DecodedTableCellParagraphSourcePayload | null;
6
5
  export declare const hasMatchingCollapsedTableCellMerge: (node: Node, revisionSet: Set<number> | null) => boolean;
7
- type ResolveVisibleTableCellMergeOptions = {
8
- tr: Transaction;
9
- cellPos: number;
10
- mode: "accept" | "reject";
11
- revisionSet: ReadonlySet<number> | null;
12
- };
13
- export declare const resolveVisibleTableCellMerge: ({ tr, cellPos, mode, revisionSet }: ResolveVisibleTableCellMergeOptions) => boolean;
14
6
  export declare const tableCellContinuationCells: (cell: Node, rowspan: number) => document_d_exports.TableCell[];
15
7
  export declare const tableCellContinuationFromNode: (cell: Node) => document_d_exports.TableCell;
16
- export declare const resolveCollapsedTableCellMerge: (tr: Transaction, cellPos: number, mode: "accept" | "reject", revisionSet: Set<number> | null) => boolean;
17
- export declare const createRestoredTableCell: (origin: Node, source: document_d_exports.TableCell) => Node | null;
18
- export {};
8
+ export declare const createRestoredTableCell: (origin: Node, source: document_d_exports.TableCell) => Node | null;
@@ -1,12 +1,8 @@
1
- import { decodeTableCellParagraphSourcePayload, restoreTableCellsWithParagraphPropertySources, transportTableCellsWithParagraphPropertySources } from "../../docx/paragraphPropertySource.js";
2
- import { isTableCellMergeRevisionContinuation } from "../../docx/tableParser.js";
1
+ import { decodeTableCellParagraphSourcePayload } from "../../docx/paragraphPropertySource.js";
3
2
  import { standaloneTableCellFromProseMirror } from "../conversion/fromProseDoc.js";
4
3
  import { standaloneTableCellToProseMirror } from "../conversion/toProseDoc.js";
5
4
  import { getTableCellMergeChange } from "../tableCellMergeRevision.js";
6
- import { removeRowsWithoutCellsInRange } from "../tableGridMutation.js";
7
- import { resolvedTableMergeOriginAttrs, resolvedVisibleTableCellMergeAttrs, tableMergeFoldDecisions } from "./tableMergeFoldDecisions.js";
8
- import { Result, panic } from "better-result";
9
- import { TableMap } from "prosemirror-tables";
5
+ import { Result } from "better-result";
10
6
  // src/prosemirror/commands/tableCellMergeResolution.ts
11
7
  const tableCellContinuationPayload = (node) => {
12
8
  const value = node.attrs["_docxVMergeContinuationCells"];
@@ -19,91 +15,6 @@ const hasMatchingCollapsedTableCellMerge = (node, revisionSet) => {
19
15
  return change !== null && (revisionSet === null || revisionSet.has(change.info.id));
20
16
  });
21
17
  };
22
- const isTableCellMergeRevisionAttr = (value) => {
23
- if (typeof value !== "object" || value === null || !("kind" in value) || value.kind !== "merge" || !("info" in value)) return false;
24
- const info = value.info;
25
- return typeof info === "object" && info !== null && "revisionId" in info && typeof info.revisionId === "number";
26
- };
27
- const tableCellContext = (doc, cellPos) => {
28
- const resolved = doc.resolve(cellPos);
29
- for (let depth = resolved.depth; depth > 0; depth -= 1) {
30
- const node = resolved.node(depth);
31
- if (node.type.spec["tableRole"] !== "table") continue;
32
- const tablePos = resolved.before(depth);
33
- return {
34
- table: node,
35
- tableStart: tablePos + 1,
36
- relativeCellPos: cellPos - tablePos - 1
37
- };
38
- }
39
- return null;
40
- };
41
- const resolveVisibleTableCellMerge = ({ tr, cellPos, mode, revisionSet }) => {
42
- const cell = tr.doc.nodeAt(cellPos);
43
- const marker = cell?.attrs["cellMarker"];
44
- if (!cell || !isTableCellMergeRevisionAttr(marker)) return false;
45
- const context = tableCellContext(tr.doc, cellPos);
46
- if (!context) return false;
47
- const rectangle = TableMap.get(context.table).findCell(context.relativeCellPos);
48
- if (mode === "reject" && isTableCellMergeRevisionContinuation(marker.verticalMergeOriginal) && rectangle.top === 0) return false;
49
- const decisions = tableMergeFoldDecisions({
50
- table: context.table,
51
- mode,
52
- revisionSet
53
- });
54
- if (decisions.invalid.has(context.relativeCellPos)) return false;
55
- const folds = decisions.folds.get(context.relativeCellPos);
56
- if (folds === void 0) return panic("Merge resolution lost its cell");
57
- for (const origin of decisions.origins) {
58
- if (origin === context.relativeCellPos) continue;
59
- const originPos = context.tableStart + origin;
60
- const originCell = tr.doc.nodeAt(originPos);
61
- if (!originCell) return panic("Merge resolution lost its origin");
62
- tr.setNodeMarkup(originPos, void 0, resolvedTableMergeOriginAttrs(originCell));
63
- }
64
- if (folds) return mergeTableCellWithCellAbove(tr, cellPos);
65
- tr.setNodeMarkup(cellPos, void 0, resolvedVisibleTableCellMergeAttrs({
66
- cell,
67
- mode,
68
- origin: decisions.origins.has(context.relativeCellPos)
69
- }));
70
- return true;
71
- };
72
- const mergeTableCellWithCellAbove = (tr, cellPos) => {
73
- const context = tableCellContext(tr.doc, cellPos);
74
- const cell = tr.doc.nodeAt(cellPos);
75
- if (!context || !cell) return false;
76
- const map = TableMap.get(context.table);
77
- const rectangle = map.findCell(context.relativeCellPos);
78
- if (rectangle.top === 0) return false;
79
- const aboveRelativePos = map.map[(rectangle.top - 1) * map.width + rectangle.left];
80
- if (aboveRelativePos === void 0 || aboveRelativePos === context.relativeCellPos) return false;
81
- const aboveRectangle = map.findCell(aboveRelativePos);
82
- if (aboveRectangle.left !== rectangle.left || aboveRectangle.right !== rectangle.right || aboveRectangle.bottom !== rectangle.top) return false;
83
- const abovePos = context.tableStart + aboveRelativePos;
84
- const aboveCell = tr.doc.nodeAt(abovePos);
85
- const aboveRowspan = aboveCell?.attrs["rowspan"];
86
- const cellRowspan = cell.attrs["rowspan"];
87
- if (!aboveCell || typeof aboveRowspan !== "number" || typeof cellRowspan !== "number" || aboveRowspan < 1 || cellRowspan < 1) return false;
88
- removeRowsWithoutCellsInRange({
89
- tr,
90
- from: cellPos + 1,
91
- to: cellPos + cell.nodeSize - 1
92
- });
93
- const capturedCell = tr.doc.nodeAt(cellPos);
94
- if (!capturedCell) panic("Nested table cleanup removed its owning cell");
95
- const continuationCells = tableCellContinuationCells(aboveCell, aboveRowspan);
96
- continuationCells.push(tableCellContinuationFromNode(capturedCell));
97
- const nestedPayload = tableCellContinuationPayload(capturedCell);
98
- if (nestedPayload) continuationCells.push(...nestedPayload.cells);
99
- tr.delete(cellPos, cellPos + capturedCell.nodeSize);
100
- tr.setNodeMarkup(abovePos, void 0, {
101
- ...aboveCell.attrs,
102
- rowspan: aboveRowspan + cellRowspan,
103
- _docxVMergeContinuationCells: transportTableCellsWithParagraphPropertySources(continuationCells)
104
- });
105
- return true;
106
- };
107
18
  const tableCellContinuationCells = (cell, rowspan) => {
108
19
  const payload = tableCellContinuationPayload(cell);
109
20
  const cells = payload ? [...payload.cells] : [];
@@ -130,68 +41,6 @@ const emptyVerticalMergeContinuation = () => ({
130
41
  content: []
131
42
  }]
132
43
  });
133
- const resolveCollapsedTableCellMerge = (tr, cellPos, mode, revisionSet) => {
134
- const cell = tr.doc.nodeAt(cellPos);
135
- if (!cell) return false;
136
- const payload = tableCellContinuationPayload(cell);
137
- if (!payload) return false;
138
- const stored = payload.cells;
139
- const matchingIndices = [];
140
- const nextCells = stored.map((continuationCell, index) => {
141
- const change = getTableCellMergeChange(continuationCell);
142
- if (!change || revisionSet !== null && !revisionSet.has(change.info.id)) return continuationCell;
143
- matchingIndices.push(index);
144
- const nextCell = { ...continuationCell };
145
- delete nextCell.structuralChange;
146
- return nextCell;
147
- });
148
- if (matchingIndices.length === 0) return false;
149
- if (mode === "accept") {
150
- tr.setNodeAttribute(cellPos, "_docxVMergeContinuationCells", nextCells);
151
- return true;
152
- }
153
- const splitIndices = matchingIndices.filter((index) => {
154
- const change = getTableCellMergeChange(stored[index]);
155
- return change?.verticalMerge === "continue" && (change.verticalMergeOriginal ?? "rest") === "rest";
156
- });
157
- if (splitIndices.length === 0) {
158
- tr.setNodeAttribute(cellPos, "_docxVMergeContinuationCells", nextCells);
159
- return true;
160
- }
161
- const firstSplitIndex = splitIndices.at(0);
162
- if (firstSplitIndex === void 0 || splitIndices.length !== stored.length - firstSplitIndex || splitIndices.some((index, offset) => index !== firstSplitIndex + offset)) return false;
163
- const context = tableCellContext(tr.doc, cellPos);
164
- if (!context) return false;
165
- const map = TableMap.get(context.table);
166
- const rectangle = map.findCell(context.relativeCellPos);
167
- const rowspan = cell.attrs["rowspan"];
168
- if (typeof rowspan !== "number" || rowspan !== stored.length + 1 || rectangle.bottom - rectangle.top !== rowspan) return false;
169
- const restorations = [];
170
- const restoredCells = restoreTableCellsWithParagraphPropertySources(payload);
171
- for (const index of splitIndices) {
172
- const source = restoredCells[index];
173
- if (!source) return false;
174
- const restoredCell = createRestoredTableCell(cell, source);
175
- if (!restoredCell) return false;
176
- restorations.push({
177
- index,
178
- cell: restoredCell
179
- });
180
- }
181
- const mapFrom = tr.mapping.maps.length;
182
- for (const restoration of restorations) {
183
- const row = rectangle.top + restoration.index + 1;
184
- const insertionPos = context.tableStart + map.positionAt(row, rectangle.left, context.table);
185
- tr.insert(tr.mapping.slice(mapFrom).map(insertionPos, 1), restoration.cell);
186
- }
187
- const remainingCells = nextCells.slice(0, firstSplitIndex);
188
- tr.setNodeMarkup(cellPos, void 0, {
189
- ...cell.attrs,
190
- rowspan: firstSplitIndex + 1,
191
- _docxVMergeContinuationCells: remainingCells.length > 0 ? remainingCells : null
192
- });
193
- return true;
194
- };
195
44
  const createRestoredTableCell = (origin, source) => {
196
45
  const formatting = source.formatting ? { ...source.formatting } : void 0;
197
46
  if (formatting) delete formatting.vMerge;
@@ -204,4 +53,4 @@ const createRestoredTableCell = (origin, source) => {
204
53
  const restored = standaloneTableCellToProseMirror(restoredSource, origin.type.name === "tableHeader" ? "tableHeader" : "tableCell");
205
54
  return Result.try(() => origin.type.schema.nodeFromJSON(restored.toJSON())).unwrapOr(null);
206
55
  };
207
- export { createRestoredTableCell, hasMatchingCollapsedTableCellMerge, resolveCollapsedTableCellMerge, resolveVisibleTableCellMerge, tableCellContinuationCells, tableCellContinuationFromNode, tableCellContinuationPayload };
56
+ export { createRestoredTableCell, hasMatchingCollapsedTableCellMerge, tableCellContinuationCells, tableCellContinuationFromNode, tableCellContinuationPayload };
@@ -1,5 +1,5 @@
1
1
  import { FOLIO_INSERTED_PICTURE_FRAME_LOCKS } from "../../../docx/graphicFrameLocks.js";
2
- import { getStandaloneClipboardImageFiles } from "../../../utils/clipboard.js";
2
+ import { getStandaloneClipboardImageFiles } from "../../../utils/clipboardFiles.js";
3
3
  import { isSafeImageFile } from "../../../utils/imageValidation.js";
4
4
  import { sanitizeImageSrc } from "../../../utils/sanitizeImageSrc.js";
5
5
  import { createExtension } from "../create.js";
@@ -3,7 +3,7 @@ import { anchorTargetAttrs, normalizeUserUrl, sanitizeExternalUrl } from "../../
3
3
  import { expectHyperlinkMarkAttrs } from "../../attrs/index.js";
4
4
  import { withCanonicalCommand } from "../../canonicalCommands.js";
5
5
  import { canonicalSelectionRange } from "../../canonicalSelectionRange.js";
6
- import { assertHyperlinkRemovalRange, removeHyperlinkInRange } from "../../hyperlinkRemoval.js";
6
+ import { removeHyperlinkInRange, widenHyperlinkRemovalRange } from "../../hyperlinkRemoval.js";
7
7
  import { getDocumentBuiltInStyles } from "../../plugins/documentStyleState.js";
8
8
  import { createMarkExtension } from "../create.js";
9
9
  import { isMarkActive } from "./markUtils.js";
@@ -158,18 +158,16 @@ const HyperlinkExtension = createMarkExtension({
158
158
  }]);
159
159
  const removalRange = (state) => {
160
160
  if (state.selection instanceof CellSelection) return void 0;
161
- const { empty, $from } = state.selection;
162
- const { from, to } = canonicalSelectionRange(state);
163
- assertHyperlinkRemovalRange({
161
+ const { from, to } = widenHyperlinkRemovalRange({
164
162
  doc: state.doc,
165
- from,
166
- to
163
+ ...canonicalSelectionRange(state)
167
164
  });
168
- if (!empty) return {
165
+ if (!state.selection.empty) return {
169
166
  from,
170
167
  to
171
168
  };
172
- const linkMark = $from.marks().find((mark) => mark.type === documentHyperlinkType(state));
169
+ const $from = state.doc.resolve(from);
170
+ const linkMark = (from === to ? $from.marks() : state.doc.nodeAt(from)?.marks ?? []).find((mark) => mark.type === documentHyperlinkType(state));
173
171
  if (!linkMark) return void 0;
174
172
  let contiguous;
175
173
  let selected;
@@ -10,23 +10,26 @@
10
10
  * text never did. Rejecting brings the link back as it was; accepting leaves
11
11
  * the plain text an untracked removal leaves.
12
12
  */
13
- import { TaggedErrorClass } from "better-result";
14
13
  import { EditorState, Transaction } from "prosemirror-state";
15
14
  import { Node } from "prosemirror-model";
16
- declare const HyperlinkRemovalRefusalBase: TaggedErrorClass<"HyperlinkRemovalRefusal">;
17
- export declare class HyperlinkRemovalRefusal extends HyperlinkRemovalRefusalBase<{
18
- message: string;
19
- }> {}
20
15
  type HyperlinkRemovalRangeOptions = {
21
16
  doc: Node;
22
17
  from: number;
23
18
  to: number;
24
19
  };
25
- /** Canonical inline elements have no addressable interior gaps. */
26
- export declare const assertHyperlinkRemovalRange: ({ doc, from, to }: HyperlinkRemovalRangeOptions) => void;
20
+ /**
21
+ * The removal range widened to the edges of every linked inline element an
22
+ * endpoint falls inside. Such an element, a field result a link holds whole
23
+ * (a contents entry's page number), carries the link as one mark: the link
24
+ * leaves all of it or none of it, as Remove Hyperlink takes the whole link.
25
+ */
26
+ export declare const widenHyperlinkRemovalRange: ({ doc, from, to }: HyperlinkRemovalRangeOptions) => {
27
+ from: number;
28
+ to: number;
29
+ };
27
30
  /**
28
31
  * Remove the hyperlinks from [`from`, `to`) of `tr.doc`: directly, or, with
29
32
  * suggestions on, as a tracked replacement of the linked text by plain text.
30
33
  */
31
- export declare const removeHyperlinkInRange: (state: EditorState, tr: Transaction, from: number, to: number) => Transaction;
34
+ export declare const removeHyperlinkInRange: (state: EditorState, tr: Transaction, requestedFrom: number, requestedTo: number) => Transaction;
32
35
  export {};
@@ -3,7 +3,7 @@ import { getDocumentBuiltInStyles, getDocumentStyleResolver } from "./plugins/do
3
3
  import { readAuthoredRunFormatting, reconcileRunFormattingMarks } from "./runFormattingReconciliation.js";
4
4
  import { paragraphRunStyleContextAt } from "./runStyleFormatting.js";
5
5
  import { isSuggestionModeActive, makeRevisionInfo, suggestRangeDeletion } from "./suggestionCommands.js";
6
- import { TaggedError } from "better-result";
6
+ import { panic } from "better-result";
7
7
  // src/prosemirror/hyperlinkRemoval.ts
8
8
  /**
9
9
  * Removing a hyperlink takes the link and its Hyperlink character style off
@@ -17,18 +17,27 @@ import { TaggedError } from "better-result";
17
17
  * text never did. Rejecting brings the link back as it was; accepting leaves
18
18
  * the plain text an untracked removal leaves.
19
19
  */
20
- const HyperlinkRemovalRefusalBase = TaggedError("HyperlinkRemovalRefusal");
21
- var HyperlinkRemovalRefusal = class extends HyperlinkRemovalRefusalBase {};
22
- const partialInlineRefusal = () => new HyperlinkRemovalRefusal({ message: "Hyperlink removal cannot split an indivisible inline element." });
23
- /** Canonical inline elements have no addressable interior gaps. */
24
- const assertHyperlinkRemovalRange = ({ doc, from, to }) => {
25
- for (const position of [from, to]) {
20
+ /**
21
+ * The removal range widened to the edges of every linked inline element an
22
+ * endpoint falls inside. Such an element, a field result a link holds whole
23
+ * (a contents entry's page number), carries the link as one mark: the link
24
+ * leaves all of it or none of it, as Remove Hyperlink takes the whole link.
25
+ */
26
+ const widenHyperlinkRemovalRange = ({ doc, from, to }) => {
27
+ const outermostLinked = (position) => {
26
28
  const resolved = doc.resolve(position);
27
29
  for (let depth = 1; depth <= resolved.depth; depth += 1) {
28
30
  const node = resolved.node(depth);
29
- if (node.isInline && node.marks.some(({ type }) => type.name === "hyperlink")) throw partialInlineRefusal();
31
+ if (node.isInline && node.marks.some(({ type }) => type.name === "hyperlink")) return {
32
+ from: resolved.before(depth),
33
+ to: resolved.after(depth)
34
+ };
30
35
  }
31
- }
36
+ };
37
+ return {
38
+ from: outermostLinked(from)?.from ?? from,
39
+ to: outermostLinked(to)?.to ?? to
40
+ };
32
41
  };
33
42
  /** Contiguous stretches of linked, not yet deleted, inline content in [`from`, `to`) of `doc`. */
34
43
  const linkedRanges = (doc, from, to) => {
@@ -38,7 +47,7 @@ const linkedRanges = (doc, from, to) => {
38
47
  const start = Math.max(position, from);
39
48
  const end = Math.min(position + node.nodeSize, to);
40
49
  if (start >= end) return true;
41
- if (!node.isText && (start !== position || end !== position + node.nodeSize)) throw partialInlineRefusal();
50
+ if (!node.isText && (start !== position || end !== position + node.nodeSize)) panic("A widened removal range cut a linked inline element.");
42
51
  const piece = {
43
52
  from: start,
44
53
  to: end,
@@ -96,11 +105,11 @@ const setInlineMarks = (tr, from, to, current, marks) => {
96
105
  * Remove the hyperlinks from [`from`, `to`) of `tr.doc`: directly, or, with
97
106
  * suggestions on, as a tracked replacement of the linked text by plain text.
98
107
  */
99
- const removeHyperlinkInRange = (state, tr, from, to) => {
100
- assertHyperlinkRemovalRange({
108
+ const removeHyperlinkInRange = (state, tr, requestedFrom, requestedTo) => {
109
+ const { from, to } = widenHyperlinkRemovalRange({
101
110
  doc: tr.doc,
102
- from,
103
- to
111
+ from: requestedFrom,
112
+ to: requestedTo
104
113
  });
105
114
  const { schema } = state;
106
115
  const hyperlinkType = schema.marks["hyperlink"];
@@ -162,4 +171,4 @@ const removeHyperlinkInRange = (state, tr, from, to) => {
162
171
  }
163
172
  return tr;
164
173
  };
165
- export { HyperlinkRemovalRefusal, assertHyperlinkRemovalRange, removeHyperlinkInRange };
174
+ export { removeHyperlinkInRange, widenHyperlinkRemovalRange };
@@ -5,13 +5,8 @@ import { ParagraphAttrs } from "./schema/nodes.js";
5
5
  export type ListCounterState = {
6
6
  counters: Map<number, number[]>;
7
7
  abstractCounters: Map<number, number[]>;
8
+ /** The levels of list instances a paragraph has used, as `numId:level`. */
8
9
  seenLevels: Set<string>;
9
- restartedNumIds?: Set<number>;
10
- previousList?: {
11
- abstractNumId: number | null;
12
- fromStyle: boolean;
13
- numId: number | null;
14
- };
15
10
  lastAdvancedNumId?: number;
16
11
  };
17
12
  export type ListCounterStreams = {
@@ -30,13 +30,7 @@ function createListCounterState() {
30
30
  return {
31
31
  counters: /* @__PURE__ */ new Map(),
32
32
  abstractCounters: /* @__PURE__ */ new Map(),
33
- seenLevels: /* @__PURE__ */ new Set(),
34
- restartedNumIds: /* @__PURE__ */ new Set(),
35
- previousList: {
36
- abstractNumId: null,
37
- fromStyle: false,
38
- numId: null
39
- }
33
+ seenLevels: /* @__PURE__ */ new Set()
40
34
  };
41
35
  }
42
36
  function cloneListCounterState(state) {
@@ -56,12 +50,6 @@ function cloneListCounterState(state) {
56
50
  counters,
57
51
  abstractCounters,
58
52
  seenLevels: new Set(state.seenLevels),
59
- restartedNumIds: new Set(state.restartedNumIds ?? []),
60
- previousList: { ...state.previousList ?? {
61
- abstractNumId: null,
62
- fromStyle: false,
63
- numId: null
64
- } },
65
53
  ...state.lastAdvancedNumId !== void 0 ? { lastAdvancedNumId: state.lastAdvancedNumId } : {}
66
54
  };
67
55
  }
@@ -142,14 +130,7 @@ function formatNumberedMarker(counters, level) {
142
130
  return parts.length === 0 ? "1." : `${parts.join(".")}.`;
143
131
  }
144
132
  function advanceListMarker(attrs, state) {
145
- if (!hasListRendering(attrs)) {
146
- state.previousList = {
147
- abstractNumId: null,
148
- fromStyle: false,
149
- numId: null
150
- };
151
- return null;
152
- }
133
+ if (!hasListRendering(attrs)) return null;
153
134
  const markerTemplate = attrs.listMarkerTemplate ?? attrs.listMarker;
154
135
  const foldedMarkerSuffix = attrs.listFoldedMarkerSuffix ?? void 0;
155
136
  const effectiveNumbering = effectiveParagraphNumbering(paragraphNumberingSourcesFromBoundary({
@@ -170,44 +151,16 @@ function advanceListMarker(attrs, state) {
170
151
  forceDecimal: attrs.listIsLegal
171
152
  });
172
153
  }
173
- state.previousList = {
174
- abstractNumId: null,
175
- fromStyle: false,
176
- numId: null
177
- };
178
154
  return marker;
179
155
  }
180
156
  if (attrs.listIsBullet) {
181
- state.previousList = {
182
- abstractNumId: null,
183
- fromStyle: false,
184
- numId: null
185
- };
186
157
  if (foldedMarkerSuffix !== void 0 && attrs.listMarkerTemplate == null) return attrs.listMarker ?? null;
187
158
  const marker = convertBulletToUnicode(attrs.listMarkerTemplate ?? attrs.listMarker ?? "", bulletMarkerFontName(attrs.listMarkerFormatting));
188
159
  return foldedMarkerSuffix === void 0 ? marker : `${marker}\t${foldedMarkerSuffix}`;
189
160
  }
190
- const firstInstanceEncounter = !state.counters.has(numId);
191
- let counters = state.counters.get(numId) ?? Array.from({ length: 9 }, () => NaN);
192
161
  const abstractNumId = attrs.listAbstractNumId;
193
- const previousList = state.previousList ?? {
194
- abstractNumId: null,
195
- fromStyle: false,
196
- numId: null
197
- };
198
- const restartedNumIds = state.restartedNumIds ??= /* @__PURE__ */ new Set();
199
- const latestAbstractCounters = abstractNumId === void 0 ? void 0 : state.abstractCounters.get(abstractNumId);
200
- const styleNumbering = attrs.numPr?.kind !== "reference" && attrs.numPrFromStyle?.kind === "reference";
201
- const resumesRestartedInstance = firstInstanceEncounter && attrs.listStartOverride == null && abstractNumId !== void 0 && previousList.abstractNumId === abstractNumId && previousList.numId !== null && previousList.numId !== numId && restartedNumIds.has(previousList.numId);
202
- const resumesStyleInstance = firstInstanceEncounter && !styleNumbering && attrs.listStartOverride == null && abstractNumId !== void 0 && previousList.abstractNumId === abstractNumId && previousList.fromStyle;
203
- if (latestAbstractCounters && (styleNumbering || resumesRestartedInstance || resumesStyleInstance)) counters = latestAbstractCounters;
204
- if (attrs.listStartOverride != null || resumesRestartedInstance || previousList.numId === numId && restartedNumIds.has(numId)) restartedNumIds.add(numId);
205
- if (level > 0) {
206
- if (counters.slice(0, level).every((counter) => !Number.isFinite(counter))) for (let index = 0; index < level; index += 1) {
207
- const latestCounter = latestAbstractCounters?.[index];
208
- counters[index] = latestCounter !== void 0 && Number.isFinite(latestCounter) ? latestCounter : attrs.listLevelStarts?.[index] ?? 1;
209
- }
210
- }
162
+ const counters = (abstractNumId === void 0 ? void 0 : state.abstractCounters.get(abstractNumId)) ?? state.counters.get(numId) ?? Array.from({ length: 9 }, () => NaN);
163
+ for (let index = 0; index < level; index += 1) if (!Number.isFinite(counters[index])) counters[index] = attrs.listLevelStarts?.[index] ?? 1;
211
164
  const seenKey = `${numId}:${level}`;
212
165
  if (!state.seenLevels.has(seenKey)) {
213
166
  state.seenLevels.add(seenKey);
@@ -224,11 +177,6 @@ function advanceListMarker(attrs, state) {
224
177
  state.counters.set(numId, counters);
225
178
  state.lastAdvancedNumId = numId;
226
179
  if (abstractNumId !== void 0) state.abstractCounters.set(abstractNumId, counters);
227
- state.previousList = {
228
- abstractNumId: abstractNumId ?? null,
229
- fromStyle: Boolean(styleNumbering),
230
- numId
231
- };
232
180
  const levelFormats = attrs.listLevelNumFmts ?? (attrs.listNumFmt ? [attrs.listNumFmt] : void 0);
233
181
  if (markerTemplate?.includes("%") && (foldedMarkerSuffix === void 0 || attrs.listMarkerTemplate != null)) {
234
182
  const marker = resolveListTemplate({
@@ -6,7 +6,7 @@
6
6
  * https://github.com/eigenpal/docx-editor/blob/main/packages/core/src/prosemirror/extensions/features/ParaIdAllocatorExtension.ts
7
7
  * (Apache-2.0); see that module for the id lifecycle rules.
8
8
  */
9
- import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
9
+ import { EditorState, Plugin, PluginKey } from "prosemirror-state";
10
10
  import { Node } from "prosemirror-model";
11
11
  export type ParagraphPropertySourceSeed = {
12
12
  contract: string | null;
@@ -19,19 +19,6 @@ export declare const paraIdAllocatorKey: Readonly<{
19
19
  get: (state: EditorState) => Plugin<ParagraphPropertySourceSeed> | undefined;
20
20
  getState: (state: EditorState) => ParagraphPropertySourceSeed | undefined;
21
21
  }>;
22
- /**
23
- * Transaction meta asking this plugin to derive the ids it mints from a
24
- * caller-supplied seed instead of `Math.random()`.
25
- *
26
- * A live editor wants random ids: two people typing must not collide. A
27
- * generator whose whole output has to be reproducible — the document compare —
28
- * cannot afford them, and it is the only party that knows its run is meant to
29
- * be deterministic, so it says so on its own transaction rather than leaving
30
- * the plugin to guess.
31
- */
32
- export declare const deterministicParaIdSeedKey = "stll.folio.meta.deterministicParaIdSeed";
33
- /** Ask the allocator to mint reproducible ids for the paragraphs `tr` creates. */
34
- export declare const requestDeterministicParaIds: (tr: Transaction, seed: string) => Transaction;
35
22
  export declare const isUsableParaId: (value: unknown) => value is string;
36
23
  export declare const visitAuthoredParagraphs: (doc: Node, visit: (node: Node, pos: number) => void) => void;
37
24
  /**
@@ -14,19 +14,6 @@ import { Fragment } from "prosemirror-model";
14
14
  * (Apache-2.0); see that module for the id lifecycle rules.
15
15
  */
16
16
  const paraIdAllocatorKey = createPluginKeyOwner("paraIdAllocator");
17
- /**
18
- * Transaction meta asking this plugin to derive the ids it mints from a
19
- * caller-supplied seed instead of `Math.random()`.
20
- *
21
- * A live editor wants random ids: two people typing must not collide. A
22
- * generator whose whole output has to be reproducible — the document compare —
23
- * cannot afford them, and it is the only party that knows its run is meant to
24
- * be deterministic, so it says so on its own transaction rather than leaving
25
- * the plugin to guess.
26
- */
27
- const deterministicParaIdSeedKey = "stll.folio.meta.deterministicParaIdSeed";
28
- /** Ask the allocator to mint reproducible ids for the paragraphs `tr` creates. */
29
- const requestDeterministicParaIds = (tr, seed) => tr.setMeta(deterministicParaIdSeedKey, seed);
30
17
  const isUsableParaId = (value) => typeof value === "string" && value.length > 0 && value !== "00000000";
31
18
  /** Omitted grid cells render absent positions and own no package paragraphs. */
32
19
  const isOmittedGridCell = (node) => (node.type.spec["tableRole"] === "cell" || node.type.spec["tableRole"] === "header_cell") && (node.attrs["_omittedGridSlot"] === "before" || node.attrs["_omittedGridSlot"] === "after");
@@ -149,4 +136,4 @@ const ensureParaIdsInState = (state) => {
149
136
  tr.setMeta("addToHistory", false);
150
137
  return state.apply(tr);
151
138
  };
152
- export { deterministicParaIdSeedKey, ensureParaIdsInDoc, ensureParaIdsInState, isUsableParaId, paraIdAllocatorKey, requestDeterministicParaIds, visitAuthoredParagraphs };
139
+ export { ensureParaIdsInDoc, ensureParaIdsInState, isUsableParaId, paraIdAllocatorKey, visitAuthoredParagraphs };
@@ -14,7 +14,6 @@
14
14
  * lent them is re-read in the next paragraph's style.
15
15
  */
16
16
  import { RunStyleResolver } from "./runStyleFormatting.js";
17
- import { Transaction } from "prosemirror-state";
18
17
  import { Node } from "prosemirror-model";
19
18
  /** The two paragraphs a join runs together, and what stands between them. */
20
19
  type JoinSides = {
@@ -37,19 +36,4 @@ type JoinedParagraphAttrsOptions = Omit<JoinSides, "between"> & {
37
36
  * between the two paragraphs' content.
38
37
  */
39
38
  export declare const joinedParagraphAttrs: ({ paragraph, next, between, styleResolver }: JoinedParagraphAttrsOptions) => Node["attrs"];
40
- type JoinAtParagraphMarkOptions = {
41
- tr: Transaction;
42
- /** Position of the paragraph whose mark goes. */
43
- paragraphPos: number;
44
- paragraph: Node;
45
- /** The paragraph directly after it, which the join runs into. */
46
- next: Node;
47
- /**
48
- * Re-reads the moved runs' inherited formatting in the next paragraph's
49
- * style. Without one, the editor's join restyler does it when the
50
- * transaction is dispatched.
51
- */
52
- styleResolver: RunStyleResolver | null;
53
- };
54
- export declare const joinAtParagraphMark: ({ tr, paragraphPos, paragraph, next, styleResolver }: JoinAtParagraphMarkOptions) => void;
55
39
  export {};