@stll/folio-core 0.67.0 → 0.69.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.
- package/dist/ai-edits/apply.d.ts +9 -1
- package/dist/ai-edits/apply.js +94 -8
- package/dist/ai-edits/headless.d.ts +36 -21
- package/dist/ai-edits/headless.js +106 -36
- package/dist/ai-edits/index.d.ts +2 -2
- package/dist/ai-edits/newListNumbering.d.ts +14 -1
- package/dist/ai-edits/newListNumbering.js +24 -1
- package/dist/ai-edits/note-references.d.ts +6 -0
- package/dist/ai-edits/note-references.js +7 -1
- package/dist/ai-edits/pending-suggestions.js +2 -2
- package/dist/ai-edits/read.d.ts +19 -0
- package/dist/ai-edits/snapshot.d.ts +6 -0
- package/dist/ai-edits/snapshot.js +8 -3
- package/dist/ai-edits/types.d.ts +9 -1
- package/dist/ai-suggestions/apply.js +13 -4
- package/dist/compare/compare.js +2 -1
- package/dist/compare/inserted-resource-snapshot.d.ts +4 -1
- package/dist/compare/inserted-resource-snapshot.js +7 -3
- package/dist/controller/canonicalClipboard.js +31 -14
- package/dist/controller/canonicalComposition.js +35 -6
- package/dist/controller/canonicalInlineProjection.d.ts +35 -10
- package/dist/controller/canonicalInlineProjection.js +192 -28
- package/dist/controller/canonicalInput.d.ts +2 -1
- package/dist/controller/canonicalInput.js +32 -7
- package/dist/controller/canonicalListRendering.d.ts +2 -1
- package/dist/controller/canonicalListRendering.js +1 -1
- package/dist/controller/canonicalLockGuard.d.ts +23 -0
- package/dist/controller/canonicalLockGuard.js +133 -0
- package/dist/controller/canonicalProjectionBlocks.d.ts +79 -0
- package/dist/controller/canonicalProjectionBlocks.js +75 -0
- package/dist/controller/canonicalPublicOperations.d.ts +12 -4
- package/dist/controller/canonicalPublicOperations.js +676 -46
- package/dist/controller/canonicalSeedContent.d.ts +12 -0
- package/dist/controller/canonicalSeedContent.js +131 -0
- package/dist/controller/canonicalSession.d.ts +133 -21
- package/dist/controller/canonicalSession.js +738 -205
- package/dist/controller/canonicalSourceNormalization.d.ts +21 -0
- package/dist/controller/canonicalSourceNormalization.js +148 -0
- package/dist/controller/canonicalStoryEditor.d.ts +4 -3
- package/dist/controller/canonicalStoryEditor.js +20 -15
- package/dist/controller/canonicalStructure.d.ts +2 -1
- package/dist/controller/canonicalStructure.js +129 -7
- package/dist/controller/contentControlWidgetController.d.ts +5 -0
- package/dist/controller/contentControlWidgetController.js +13 -1
- package/dist/controller/folioEditor.js +4 -0
- package/dist/controller/headerFooterEditorManager.d.ts +7 -2
- package/dist/controller/headerFooterEditorManager.js +11 -6
- package/dist/controller/hiddenEditorApi.d.ts +17 -2
- package/dist/controller/hiddenEditorApi.js +4 -0
- package/dist/controller/hiddenEditorManager.d.ts +11 -3
- package/dist/controller/hiddenEditorManager.js +157 -48
- package/dist/controller/layoutPipeline.js +50 -16
- package/dist/controller/layoutSession.d.ts +3 -0
- package/dist/controller/layoutSession.js +3 -1
- package/dist/controller/noteEditorManager.d.ts +7 -2
- package/dist/controller/noteEditorManager.js +11 -6
- package/dist/display-list/build/pageFurniture.js +41 -19
- package/dist/display-list/build/tablePrimitives.js +23 -4
- package/dist/display-list/dom/renderDisplayListToDom.js +13 -11
- package/dist/document-operations.d.ts +9 -1
- package/dist/document-operations.js +4 -3
- package/dist/docx/blockContentParser.d.ts +7 -3
- package/dist/docx/blockContentParser.js +2 -3
- package/dist/docx/blockPlainText.js +2 -0
- package/dist/docx/bookmarkRangeJoin.d.ts +6 -0
- package/dist/docx/bookmarkRangeJoin.js +43 -0
- package/dist/docx/canonicalSave.js +11 -2
- package/dist/docx/canonicalSessionInput.d.ts +5 -1
- package/dist/docx/canonicalSessionInput.js +7 -2
- package/dist/docx/commentAnchorIndex.d.ts +40 -5
- package/dist/docx/commentAnchorIndex.js +94 -12
- package/dist/docx/commentRangeIntegrity.js +30 -24
- package/dist/docx/commentRangeJoin.d.ts +4 -0
- package/dist/docx/commentRangeJoin.js +26 -12
- package/dist/docx/commentReferenceCompletion.js +5 -4
- package/dist/docx/commentReferenceNormalization.js +40 -18
- package/dist/docx/compatibility.js +9 -2
- package/dist/docx/containerChildren.js +22 -1
- package/dist/docx/contentTypeRegistry.js +1 -1
- package/dist/docx/encryption/compoundFile.js +9 -1
- package/dist/docx/encryption/encryptionInfo.js +16 -2
- package/dist/docx/ensureParaIds.js +46 -7
- package/dist/docx/ensureUniqueControlIds.d.ts +25 -0
- package/dist/docx/ensureUniqueControlIds.js +110 -0
- package/dist/docx/headerFooterVerbatim.d.ts +7 -0
- package/dist/docx/headerFooterVerbatim.js +13 -2
- package/dist/docx/hostCommentThreads.d.ts +27 -0
- package/dist/docx/hostCommentThreads.js +72 -0
- package/dist/docx/hyperlinkParser.js +9 -2
- package/dist/docx/inlineWrapperContent.d.ts +8 -1
- package/dist/docx/inlineWrapperContent.js +9 -2
- package/dist/docx/listMarkerComputation.d.ts +35 -1
- package/dist/docx/listMarkerComputation.js +39 -1
- package/dist/docx/listModelNormalization.d.ts +44 -1
- package/dist/docx/listModelNormalization.js +226 -96
- package/dist/docx/listNumberingInstances.d.ts +1 -1
- package/dist/docx/listNumberingInstances.js +2 -2
- package/dist/docx/markupRangeMarker.d.ts +14 -0
- package/dist/docx/markupRangeMarker.js +15 -1
- package/dist/docx/metadataPrivacy.js +43 -22
- package/dist/docx/normalizeBaseDirection.js +3 -1
- package/dist/docx/numberingIds.d.ts +6 -0
- package/dist/docx/numberingIds.js +6 -1
- package/dist/docx/numberingReferenceNormalization.d.ts +4 -0
- package/dist/docx/numberingReferenceNormalization.js +12 -2
- package/dist/docx/paragraphParser.js +159 -48
- package/dist/docx/paragraphPropertySource.d.ts +29 -0
- package/dist/docx/paragraphPropertySource.js +106 -16
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/paragraphTraversal.js +2 -0
- package/dist/docx/parseWarningMessage.js +2 -1
- package/dist/docx/parser.js +8 -0
- package/dist/docx/removeHeaderFooterParts.js +1 -1
- package/dist/docx/renderedPageBreakNormalization.js +1 -1
- package/dist/docx/reviewProvenanceDiagnostics.d.ts +7 -0
- package/dist/docx/reviewProvenanceDiagnostics.js +39 -0
- package/dist/docx/reviewResolutionProvenance.d.ts +29 -3
- package/dist/docx/reviewResolutionProvenance.js +171 -33
- package/dist/docx/rezip.d.ts +6 -0
- package/dist/docx/rezip.js +38 -21
- package/dist/docx/selectiveSave.js +6 -10
- package/dist/docx/selectiveXmlPatch.d.ts +5 -4
- package/dist/docx/selectiveXmlPatch.js +11 -7
- package/dist/docx/serializer/documentSerializer.js +5 -2
- package/dist/docx/serializer/headerFooterSerializer.js +3 -1
- package/dist/docx/serializer/markupRangeAttributes.d.ts +6 -1
- package/dist/docx/serializer/markupRangeAttributes.js +6 -1
- package/dist/docx/serializer/noteSerializer.d.ts +17 -4
- package/dist/docx/serializer/noteSerializer.js +23 -16
- package/dist/docx/serializer/paragraphSerializer.js +56 -12
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +1 -1
- package/dist/docx/serializer/runSerializer.d.ts +1 -3
- package/dist/docx/serializer/runSerializer.js +2 -2
- package/dist/docx/serializer/tableSerializer.d.ts +4 -0
- package/dist/docx/serializer/tableSerializer.js +4 -2
- package/dist/docx/server/applyDocxXmlPatchProposal.js +8 -4
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/docx/server/createBilingualDocument.js +27 -5
- package/dist/docx/server/migrateYjsAttrSchema.js +4 -0
- package/dist/docx/sessionListPruning.d.ts +2 -0
- package/dist/docx/sessionListPruning.js +50 -0
- package/dist/docx/splitRevisionPieces.d.ts +10 -0
- package/dist/docx/splitRevisionPieces.js +14 -0
- package/dist/docx/storyBlockReplay.js +19 -2
- package/dist/docx/structuralXmlPatch.js +44 -11
- package/dist/docx/tableParser.d.ts +6 -2
- package/dist/docx/tableParser.js +2 -3
- package/dist/docx/textBoxContentParser.d.ts +11 -0
- package/dist/docx/textBoxContentParser.js +51 -0
- package/dist/docx/textBoxParser.d.ts +0 -5
- package/dist/docx/textBoxParser.js +1 -23
- package/dist/docx/verticalMergeProjection.js +1 -1
- package/dist/docx/xmlParser.d.ts +1 -1
- package/dist/docx/xmlParser.js +2 -3
- package/dist/fonts/fontsourceFaces.d.ts +2 -8
- package/dist/fonts/fontsourceFaces.js +1 -7
- package/dist/i18n/messages/ar.gen.js +3 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +51 -0
- package/dist/i18n/messages/catalogs.gen.js +51 -0
- package/dist/i18n/messages/cs.gen.js +3 -0
- package/dist/i18n/messages/de.gen.js +3 -0
- package/dist/i18n/messages/en.gen.js +3 -0
- package/dist/i18n/messages/es.gen.js +3 -0
- package/dist/i18n/messages/et.gen.js +3 -0
- package/dist/i18n/messages/fr.gen.js +3 -0
- package/dist/i18n/messages/he.gen.js +3 -0
- package/dist/i18n/messages/hi.gen.js +3 -0
- package/dist/i18n/messages/hu.gen.js +3 -0
- package/dist/i18n/messages/lt.gen.js +3 -0
- package/dist/i18n/messages/lv.gen.js +3 -0
- package/dist/i18n/messages/messages.gen.d.ts +3 -0
- package/dist/i18n/messages/pl.gen.js +3 -0
- package/dist/i18n/messages/pt-BR.gen.js +3 -0
- package/dist/i18n/messages/sk.gen.js +3 -0
- package/dist/i18n/messages/tr.gen.js +3 -0
- package/dist/i18n/messages/zh-CN.gen.js +3 -0
- package/dist/internal/acceptedBlockProjection.js +2 -0
- package/dist/internal/pageBreakRunDescendantIndex.d.ts +7 -2
- package/dist/internal/pageBreakRunDescendantIndex.js +12 -3
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +5 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -0
- package/dist/internal/revisionResolutionInline.js +1 -2
- package/dist/internal/subtreeHolds.d.ts +12 -0
- package/dist/internal/subtreeHolds.js +25 -0
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/layout-bridge/cellSelectionHighlight.js +3 -3
- package/dist/layout-bridge/convert/flowBlockPostprocessing.js +20 -12
- package/dist/layout-bridge/convert/flowConversionShared.d.ts +15 -1
- package/dist/layout-bridge/convert/flowConversionShared.js +9 -1
- package/dist/layout-bridge/convert/paragraphAttrs.d.ts +15 -4
- package/dist/layout-bridge/convert/paragraphAttrs.js +11 -4
- package/dist/layout-bridge/convert/paragraphBlockCache.d.ts +26 -0
- package/dist/layout-bridge/convert/paragraphBlockCache.js +137 -0
- package/dist/layout-bridge/convert/paragraphConversion.d.ts +12 -2
- package/dist/layout-bridge/convert/paragraphConversion.js +37 -5
- package/dist/layout-bridge/convert/paragraphRuns.d.ts +2 -2
- package/dist/layout-bridge/convert/sectionBoundaries.js +16 -0
- package/dist/layout-bridge/convert/tableConversion.js +19 -8
- package/dist/layout-bridge/convert/toFlowBlocks.js +144 -15
- package/dist/layout-bridge/convert/topLevelConversion.d.ts +74 -0
- package/dist/layout-bridge/convert/topLevelConversion.js +109 -0
- package/dist/layout-bridge/dom/clickToPositionDom.js +41 -40
- package/dist/layout-bridge/dom/findBodyPmSpans.js +4 -3
- package/dist/layout-bridge/dom/findHfPmSpans.js +10 -15
- package/dist/layout-bridge/dom/imeCaretAnchor.d.ts +8 -0
- package/dist/layout-bridge/dom/imeCaretAnchor.js +71 -7
- package/dist/layout-bridge/dom/textStreamDom.js +3 -2
- package/dist/layout-bridge/engine/blockIndex.d.ts +7 -0
- package/dist/layout-bridge/engine/blockIndex.js +12 -0
- package/dist/layout-bridge/engine/hitTest.js +9 -10
- package/dist/layout-bridge/engine/selectionRects.js +6 -6
- package/dist/layout-bridge/headerFooterLayout.js +12 -11
- package/dist/layout-bridge/tableInsertHover.js +2 -1
- package/dist/layout-engine/footnoteContinuation.d.ts +36 -0
- package/dist/layout-engine/footnoteContinuation.js +210 -0
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +7 -2
- package/dist/layout-engine/measure/cache.d.ts +2 -0
- package/dist/layout-engine/measure/cache.js +16 -6
- package/dist/layout-engine/measure/measureParagraph.js +1 -1
- package/dist/layout-engine/measure/paragraphKeyMemo.d.ts +8 -0
- package/dist/layout-engine/measure/paragraphKeyMemo.js +92 -0
- package/dist/layout-engine/tableLayout.js +29 -5
- package/dist/layout-engine/tableRowBreak.d.ts +36 -0
- package/dist/layout-engine/tableRowBreak.js +43 -1
- package/dist/layout-engine/types.d.ts +42 -1
- package/dist/layout-painter/imageLayout.js +2 -1
- package/dist/layout-painter/pageShellStyles.d.ts +10 -0
- package/dist/layout-painter/pageShellStyles.js +32 -0
- package/dist/layout-painter/reconcileRenderedContent.d.ts +19 -0
- package/dist/layout-painter/reconcileRenderedContent.js +117 -0
- package/dist/layout-painter/renderFragment.js +4 -6
- package/dist/layout-painter/renderImage.js +2 -2
- package/dist/layout-painter/renderPage.d.ts +4 -4
- package/dist/layout-painter/renderPage.js +54 -46
- package/dist/layout-painter/renderParagraph.js +3 -3
- package/dist/layout-painter/renderTable.js +16 -16
- package/dist/layout-painter/renderTextBox.js +2 -2
- package/dist/layout-painter/sdtBoundary.js +3 -2
- package/dist/managers/AutoSaveManager.d.ts +5 -1
- package/dist/managers/FindReplaceManager.js +3 -10
- package/dist/markdown/escape.d.ts +20 -1
- package/dist/markdown/escape.js +43 -1
- package/dist/markdown/renderBlock.js +4 -1
- package/dist/markdown/renderParagraph.js +13 -27
- package/dist/markdown/renderTable.js +6 -2
- package/dist/markdown/trailers.js +1 -0
- package/dist/paged-layout/blockGeometry.js +3 -2
- package/dist/paged-layout/editorScrollRoot.d.ts +9 -0
- package/dist/paged-layout/editorScrollRoot.js +10 -1
- package/dist/paged-layout/rangeProjection.js +5 -4
- package/dist/paged-layout/scrollToPmPosition.js +3 -3
- package/dist/paged-layout/selectionViewportRect.d.ts +6 -0
- package/dist/paged-layout/selectionViewportRect.js +8 -2
- package/dist/pdf/images.d.ts +17 -1
- package/dist/pdf/images.js +22 -4
- package/dist/pdf/writePdf.js +4 -2
- package/dist/prosemirror/attrs/index.js +2 -0
- package/dist/prosemirror/canonicalCommands.d.ts +39 -1
- package/dist/prosemirror/canonicalTableCommands.d.ts +28 -0
- package/dist/prosemirror/canonicalTableCommands.js +362 -0
- package/dist/prosemirror/commands/comments.d.ts +30 -2
- package/dist/prosemirror/commands/comments.js +189 -18
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/index.d.ts +1 -1
- package/dist/prosemirror/commentIdAllocator.js +2 -2
- package/dist/prosemirror/commentRangeBoundaryAttrs.d.ts +6 -0
- package/dist/prosemirror/commentRangeBoundaryAttrs.js +9 -3
- package/dist/prosemirror/commentRecords.d.ts +137 -0
- package/dist/prosemirror/commentRecords.js +400 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +3 -4
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +85 -34
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +140 -4
- package/dist/prosemirror/conversion/toProseDoc.js +432 -76
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +23 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +61 -32
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +5 -4
- package/dist/prosemirror/extensions/marks/CommentExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.d.ts +4 -0
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.js +49 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +3 -1
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +12 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +32 -31
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +1 -1
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/listLabels.js +3 -2
- package/dist/prosemirror/listNumbering.d.ts +6 -0
- package/dist/prosemirror/listNumbering.js +12 -9
- package/dist/prosemirror/lockedControls.d.ts +13 -0
- package/dist/prosemirror/lockedControls.js +106 -0
- package/dist/prosemirror/markupViewProjection.js +1 -1
- package/dist/prosemirror/nativeSelection.d.ts +33 -0
- package/dist/prosemirror/nativeSelection.js +74 -0
- package/dist/prosemirror/noteReferenceReview.js +2 -2
- package/dist/prosemirror/numberedRefFields.d.ts +2 -0
- package/dist/prosemirror/numberedRefFields.js +16 -5
- package/dist/prosemirror/paragraphMarkJoin.d.ts +6 -8
- package/dist/prosemirror/paragraphMarkJoin.js +155 -16
- package/dist/prosemirror/plugins/contentControlWidgets.js +2 -2
- package/dist/prosemirror/plugins/documentNumbering.js +37 -15
- package/dist/prosemirror/plugins/suggestionMode.js +33 -10
- package/dist/prosemirror/plugins/templatePreviewValues.js +16 -1
- package/dist/prosemirror/rebaseParagraphRuns.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -0
- package/dist/prosemirror/runFormattingFromMarks.d.ts +0 -1
- package/dist/prosemirror/runFormattingFromMarks.js +2 -4
- package/dist/prosemirror/runFormattingReconciliation.js +2 -2
- package/dist/prosemirror/runIdentityAcrossRevisions.d.ts +23 -1
- package/dist/prosemirror/runIdentityAcrossRevisions.js +57 -8
- package/dist/prosemirror/runPropertyChangeResolution.js +1 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +14 -4
- package/dist/prosemirror/runStyleFormatting.js +16 -13
- package/dist/prosemirror/schema/marks.d.ts +13 -1
- package/dist/prosemirror/storyListNumbering.js +7 -2
- package/dist/prosemirror/styles/paragraphStyleCascade.js +2 -2
- package/dist/prosemirror/tableResize.d.ts +10 -9
- package/dist/prosemirror/tableResize.js +60 -49
- package/dist/prosemirror/textInput.d.ts +30 -1
- package/dist/prosemirror/textInput.js +144 -17
- package/dist/prosemirror/utils/visualLineNavigation.js +20 -18
- package/dist/prosemirror/validation.d.ts +19 -0
- package/dist/prosemirror/validation.js +79 -5
- package/dist/redline.js +23 -9
- package/dist/render-dom/HeaderFooterSelectionOverlay.js +5 -4
- package/dist/render-dom/RenderedDomContext.js +7 -6
- package/dist/server.d.ts +2 -2
- package/dist/style-sets/extract.js +2 -2
- package/dist/types/canonicalCapabilities.d.ts +38 -16
- package/dist/types/canonicalCapabilities.js +21 -18
- package/dist/utils/cssString.d.ts +7 -0
- package/dist/utils/cssString.js +9 -0
- package/dist/utils/findMatchView.js +4 -3
- package/dist/utils/fontResolver.js +4 -1
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/dist/utils/mergeDocumentContent.js +2 -2
- package/dist/utils/paintedPositions.d.ts +60 -0
- package/dist/utils/paintedPositions.js +101 -0
- package/dist/utils/replaceText.d.ts +11 -0
- package/dist/utils/replaceText.js +39 -7
- package/dist/version-comparison.d.ts +9 -1
- package/dist/version-comparison.js +11 -5
- package/package.json +2 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { joinBookmarkRangesAcrossParagraphs } from "../../docx/bookmarkRangeJoin.js";
|
|
1
2
|
import { removeCommentMarkers } from "../../docx/commentAnchorIndex.js";
|
|
2
3
|
import { joinCommentRangesAcrossParagraphs } from "../../docx/commentRangeJoin.js";
|
|
3
4
|
import { completeCommentReferences } from "../../docx/commentReferenceCompletion.js";
|
|
@@ -402,6 +403,7 @@ function fromProseDoc(pmDoc, baseDocument, { stylesheetSource, reuse = "none" })
|
|
|
402
403
|
});
|
|
403
404
|
const blocks = extractBlocks(pmDoc, "resolve", createStyleEngine(styles));
|
|
404
405
|
joinCommentRangesAcrossParagraphs(blocks);
|
|
406
|
+
joinBookmarkRangesAcrossParagraphs(blocks);
|
|
405
407
|
completeCommentReferences(blocks);
|
|
406
408
|
const linkedSources = restoreLinkedParagraphPropertySources(blocks);
|
|
407
409
|
if (tokenSources) restoreParagraphPropertySourcesByToken(blocks, tokenSources);
|
|
@@ -448,8 +450,13 @@ function fromProseDoc(pmDoc, baseDocument, { stylesheetSource, reuse = "none" })
|
|
|
448
450
|
const isSuggestedMark = (mark) => mark.attrs["provenance"] === "suggested";
|
|
449
451
|
const hasSuggestedInsertion = (marks) => marks.some((mark) => mark.type.name === "insertion" && isSuggestedMark(mark));
|
|
450
452
|
/**
|
|
453
|
+
* A comment a pending suggestion proposes: it has no range in the file until
|
|
454
|
+
* the suggestion is accepted, so the save's orphan pruning leaves it out too.
|
|
455
|
+
*/
|
|
456
|
+
const isSuggestedCommentMark = (mark) => mark.type.name === "comment" && typeof mark.attrs["suggestionId"] === "string";
|
|
457
|
+
/**
|
|
451
458
|
* Compute the mark set an inline node should keep once its suggested tracked
|
|
452
|
-
* changes are stripped. Suggested deletions are dropped so their text survives
|
|
459
|
+
* changes and proposed comments are stripped. Suggested deletions are dropped so their text survives
|
|
453
460
|
* as plain content; a suggested `runPropertyChange` is dropped and the run's
|
|
454
461
|
* live formatting is reverted to the recorded `previousFormatting`.
|
|
455
462
|
*
|
|
@@ -459,10 +466,11 @@ const hasSuggestedInsertion = (marks) => marks.some((mark) => mark.type.name ===
|
|
|
459
466
|
function stripSuggestedInlineMarks(marks, readFormattingContext) {
|
|
460
467
|
const hasSuggestedDeletion = marks.some((mark) => mark.type.name === "deletion" && isSuggestedMark(mark));
|
|
461
468
|
const suggestedRunPropertyChange = marks.find((mark) => mark.type.name === "runPropertyChange" && isSuggestedMark(mark));
|
|
462
|
-
|
|
463
|
-
|
|
469
|
+
const hasSuggestedComment = marks.some(isSuggestedCommentMark);
|
|
470
|
+
if (!hasSuggestedDeletion && !suggestedRunPropertyChange && !hasSuggestedComment) return marks;
|
|
471
|
+
let next = marks.filter((mark) => !((mark.type.name === "deletion" || mark.type.name === "runPropertyChange") && isSuggestedMark(mark) || isSuggestedCommentMark(mark)));
|
|
464
472
|
if (suggestedRunPropertyChange) {
|
|
465
|
-
const { baseParagraphFormatting, inheritedFormatting, paragraphMarkFormatting,
|
|
473
|
+
const { baseParagraphFormatting, inheritedFormatting, paragraphMarkFormatting, styleResolver } = readFormattingContext();
|
|
466
474
|
const previousFormatting = expectRunPropertyChangeMarkAttrs(suggestedRunPropertyChange).changes.at(0)?.previousFormatting;
|
|
467
475
|
const characterStyleMark = marks.find(({ type }) => type.name === "characterStyle");
|
|
468
476
|
const characterStyleAttrs = characterStyleMark ? expectCharacterStyleMarkAttrs(characterStyleMark) : void 0;
|
|
@@ -472,8 +480,7 @@ function stripSuggestedInlineMarks(marks, readFormattingContext) {
|
|
|
472
480
|
context: {
|
|
473
481
|
baseParagraphFormatting,
|
|
474
482
|
paragraphFormatting: inheritedFormatting,
|
|
475
|
-
paragraphMarkFormatting
|
|
476
|
-
paragraphMarkPrecedesStyle
|
|
483
|
+
paragraphMarkFormatting
|
|
477
484
|
},
|
|
478
485
|
...previousFormatting !== void 0 ? { directFormatting: previousFormatting } : {}
|
|
479
486
|
});
|
|
@@ -610,7 +617,6 @@ function mapSuggestionStrippedNode(node, readFormattingContext) {
|
|
|
610
617
|
baseParagraphFormatting: paragraphStyleContext.baseParagraphFormatting,
|
|
611
618
|
inheritedFormatting: paragraphStyleContext.paragraphFormatting,
|
|
612
619
|
paragraphMarkFormatting: paragraphStyleContext.paragraphMarkFormatting,
|
|
613
|
-
paragraphMarkPrecedesStyle: paragraphStyleContext.paragraphMarkPrecedesStyle,
|
|
614
620
|
styleResolver
|
|
615
621
|
};
|
|
616
622
|
return resolvedChildContext;
|
|
@@ -641,7 +647,6 @@ function stripSuggestedProvenance(doc, styleResolver) {
|
|
|
641
647
|
baseParagraphFormatting: void 0,
|
|
642
648
|
inheritedFormatting: void 0,
|
|
643
649
|
paragraphMarkFormatting: void 0,
|
|
644
|
-
paragraphMarkPrecedesStyle: false,
|
|
645
650
|
styleResolver
|
|
646
651
|
})) ?? doc;
|
|
647
652
|
}
|
|
@@ -733,6 +738,9 @@ function extractBlocks(inputDoc, refResolution = "resolve", styleResolver = null
|
|
|
733
738
|
} else if (node.type.name === "blockMoveRangeBoundary") {
|
|
734
739
|
blocks.push({ ...expectMoveRangeBoundaryAttrs(node) });
|
|
735
740
|
previousStandaloneTextBox = null;
|
|
741
|
+
} else if (node.type.name === "blockCommentRangeBoundary") {
|
|
742
|
+
blocks.push({ ...expectCommentRangeBoundaryAttrs(node).marker });
|
|
743
|
+
previousStandaloneTextBox = null;
|
|
736
744
|
}
|
|
737
745
|
});
|
|
738
746
|
if (pendingPageBreaks > 0 && !appendPendingPageBreaksToPreviousParagraph()) flushPendingPageBreaks();
|
|
@@ -1110,7 +1118,6 @@ function convertPMParagraph(node, documentCounts, textBoxAnchorMarkers, styleRes
|
|
|
1110
1118
|
baseParagraphFormatting: paragraphStyleContext.baseParagraphFormatting,
|
|
1111
1119
|
inheritedFormatting: paragraphStyleContext.paragraphFormatting,
|
|
1112
1120
|
paragraphMarkFormatting: paragraphStyleContext.paragraphMarkFormatting,
|
|
1113
|
-
paragraphMarkPrecedesStyle: paragraphStyleContext.paragraphMarkPrecedesStyle,
|
|
1114
1121
|
styleResolver
|
|
1115
1122
|
});
|
|
1116
1123
|
const bookmarks = attrs.bookmarks;
|
|
@@ -1594,7 +1601,6 @@ function extractParagraphContent(originalParagraph, _documentCounts, emptyHyperl
|
|
|
1594
1601
|
baseParagraphFormatting: paragraphStyleContext?.baseParagraphFormatting,
|
|
1595
1602
|
inheritedFormatting: paragraphStyleContext?.paragraphFormatting,
|
|
1596
1603
|
paragraphMarkFormatting: paragraphStyleContext?.paragraphMarkFormatting,
|
|
1597
|
-
paragraphMarkPrecedesStyle: paragraphStyleContext?.paragraphMarkPrecedesStyle ?? false,
|
|
1598
1604
|
styleResolver: null
|
|
1599
1605
|
};
|
|
1600
1606
|
const sortedEmptyHyperlinks = (emptyHyperlinks ?? []).map((attrs, order) => ({
|
|
@@ -2006,8 +2012,7 @@ function extractParagraphContent(originalParagraph, _documentCounts, emptyHyperl
|
|
|
2006
2012
|
const runFormattingContext = changeMark === deletionMark && changeAttrs._historicalFormatting ? {
|
|
2007
2013
|
...formattingContext,
|
|
2008
2014
|
inheritedFormatting: formattingContext.baseParagraphFormatting ?? formattingContext.inheritedFormatting,
|
|
2009
|
-
paragraphMarkFormatting: void 0
|
|
2010
|
-
paragraphMarkPrecedesStyle: false
|
|
2015
|
+
paragraphMarkFormatting: void 0
|
|
2011
2016
|
} : formattingContext;
|
|
2012
2017
|
const revisionAncestors = enclosingInsertionAncestors({
|
|
2013
2018
|
insertionMark: changeMark === deletionMark ? insertionMark : void 0,
|
|
@@ -2131,6 +2136,24 @@ function extractParagraphContent(originalParagraph, _documentCounts, emptyHyperl
|
|
|
2131
2136
|
return;
|
|
2132
2137
|
}
|
|
2133
2138
|
const fieldUnderLink = node.type.name === "field" || node.type.name === "structuredField";
|
|
2139
|
+
if (linkMark && fieldUnderLink) {
|
|
2140
|
+
const field = createFieldFromNode(node, {
|
|
2141
|
+
...formattingContext,
|
|
2142
|
+
marks: node.marks,
|
|
2143
|
+
textBoxAnchorMarkers
|
|
2144
|
+
});
|
|
2145
|
+
if (field.type === "complexField") {
|
|
2146
|
+
const linkKey = getLinkKey(linkMark);
|
|
2147
|
+
if (!currentHyperlink || currentHyperlinkKey !== linkKey) {
|
|
2148
|
+
flushCurrentInline();
|
|
2149
|
+
currentHyperlink = createIndexedHyperlink(linkMark);
|
|
2150
|
+
currentHyperlinkKey = linkKey;
|
|
2151
|
+
}
|
|
2152
|
+
currentHyperlink.children.push(field);
|
|
2153
|
+
syncStructuredCommentExit(node, offset);
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2134
2157
|
if (linkMark && !fieldUnderLink) {
|
|
2135
2158
|
const linkKey = getLinkKey(linkMark);
|
|
2136
2159
|
if (currentHyperlink && currentHyperlinkKey === linkKey) {} else {
|
|
@@ -2254,12 +2277,11 @@ function extractParagraphContent(originalParagraph, _documentCounts, emptyHyperl
|
|
|
2254
2277
|
}
|
|
2255
2278
|
return nestInlineWrapperGroups(content, wrapperGroups, sourceHyperlinkIndices, revisionOuterWrapperCounts, revisionAncestorsByWrapper);
|
|
2256
2279
|
}
|
|
2257
|
-
function createTrackedChangeRun({ baseParagraphFormatting, inheritedFormatting, marks, node, paragraphMarkFormatting,
|
|
2280
|
+
function createTrackedChangeRun({ baseParagraphFormatting, inheritedFormatting, marks, node, paragraphMarkFormatting, styleResolver }) {
|
|
2258
2281
|
const formattingContext = {
|
|
2259
2282
|
baseParagraphFormatting,
|
|
2260
2283
|
inheritedFormatting,
|
|
2261
2284
|
paragraphMarkFormatting,
|
|
2262
|
-
paragraphMarkPrecedesStyle,
|
|
2263
2285
|
styleResolver
|
|
2264
2286
|
};
|
|
2265
2287
|
const noteRefMark = marks.find((mark) => mark.type.name === "footnoteRef");
|
|
@@ -2317,7 +2339,11 @@ function createEmptyHyperlink(attrs) {
|
|
|
2317
2339
|
}
|
|
2318
2340
|
function getCommentMarkIds(marks) {
|
|
2319
2341
|
const commentIds = /* @__PURE__ */ new Set();
|
|
2320
|
-
for (const mark of marks)
|
|
2342
|
+
for (const mark of marks) {
|
|
2343
|
+
if (mark.type.name !== "comment") continue;
|
|
2344
|
+
const attrs = expectCommentMarkAttrs(mark);
|
|
2345
|
+
if (attrs.point !== true) commentIds.add(attrs.commentId);
|
|
2346
|
+
}
|
|
2321
2347
|
return commentIds;
|
|
2322
2348
|
}
|
|
2323
2349
|
/**
|
|
@@ -2387,7 +2413,7 @@ function createHyperlink(linkMark) {
|
|
|
2387
2413
|
if (attrs.rId) hyperlink.rId = attrs.rId;
|
|
2388
2414
|
return hyperlink;
|
|
2389
2415
|
}
|
|
2390
|
-
function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedFormatting, node, paragraphMarkFormatting,
|
|
2416
|
+
function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedFormatting, node, paragraphMarkFormatting, sourceRunOwners, styleResolver }) {
|
|
2391
2417
|
if (node.type.name === "bookmarkBoundary") {
|
|
2392
2418
|
hyperlink.children.push(bookmarkMarkerFromAttrs(expectBookmarkBoundaryAttrs(node)));
|
|
2393
2419
|
return;
|
|
@@ -2396,7 +2422,6 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
|
|
|
2396
2422
|
baseParagraphFormatting,
|
|
2397
2423
|
inheritedFormatting,
|
|
2398
2424
|
paragraphMarkFormatting,
|
|
2399
|
-
paragraphMarkPrecedesStyle,
|
|
2400
2425
|
styleResolver
|
|
2401
2426
|
};
|
|
2402
2427
|
const nonLinkMarks = node.marks.filter((mark) => mark.type.name !== "hyperlink");
|
|
@@ -2415,7 +2440,6 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
|
|
|
2415
2440
|
baseParagraphFormatting,
|
|
2416
2441
|
inheritedFormatting,
|
|
2417
2442
|
paragraphMarkFormatting,
|
|
2418
|
-
paragraphMarkPrecedesStyle,
|
|
2419
2443
|
styleResolver
|
|
2420
2444
|
}));
|
|
2421
2445
|
return;
|
|
@@ -2426,7 +2450,6 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
|
|
|
2426
2450
|
inheritedFormatting,
|
|
2427
2451
|
marks: nonLinkMarks,
|
|
2428
2452
|
paragraphMarkFormatting,
|
|
2429
|
-
paragraphMarkPrecedesStyle,
|
|
2430
2453
|
styleResolver,
|
|
2431
2454
|
text: node.text
|
|
2432
2455
|
});
|
|
@@ -2446,7 +2469,6 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
|
|
|
2446
2469
|
baseParagraphFormatting,
|
|
2447
2470
|
inheritedFormatting,
|
|
2448
2471
|
paragraphMarkFormatting,
|
|
2449
|
-
paragraphMarkPrecedesStyle,
|
|
2450
2472
|
styleResolver
|
|
2451
2473
|
}));
|
|
2452
2474
|
return;
|
|
@@ -2456,7 +2478,6 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
|
|
|
2456
2478
|
baseParagraphFormatting,
|
|
2457
2479
|
inheritedFormatting,
|
|
2458
2480
|
paragraphMarkFormatting,
|
|
2459
|
-
paragraphMarkPrecedesStyle,
|
|
2460
2481
|
styleResolver
|
|
2461
2482
|
}));
|
|
2462
2483
|
return;
|
|
@@ -2466,7 +2487,6 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
|
|
|
2466
2487
|
baseParagraphFormatting,
|
|
2467
2488
|
inheritedFormatting,
|
|
2468
2489
|
paragraphMarkFormatting,
|
|
2469
|
-
paragraphMarkPrecedesStyle,
|
|
2470
2490
|
styleResolver
|
|
2471
2491
|
}));
|
|
2472
2492
|
return;
|
|
@@ -2485,7 +2505,6 @@ function addNodeToHyperlink({ baseParagraphFormatting, hyperlink, inheritedForma
|
|
|
2485
2505
|
baseParagraphFormatting,
|
|
2486
2506
|
inheritedFormatting,
|
|
2487
2507
|
paragraphMarkFormatting,
|
|
2488
|
-
paragraphMarkPrecedesStyle,
|
|
2489
2508
|
styleResolver
|
|
2490
2509
|
}));
|
|
2491
2510
|
return;
|
|
@@ -2543,12 +2562,11 @@ function textLeafRunContent(text, marks) {
|
|
|
2543
2562
|
function isTextLeafContent(content) {
|
|
2544
2563
|
return content.type === "text" || content.type === "softHyphen" || content.type === "noBreakHyphen";
|
|
2545
2564
|
}
|
|
2546
|
-
function createRunFromText({ baseParagraphFormatting, inheritedFormatting, marks, paragraphMarkFormatting,
|
|
2565
|
+
function createRunFromText({ baseParagraphFormatting, inheritedFormatting, marks, paragraphMarkFormatting, styleResolver, text }) {
|
|
2547
2566
|
const formatting = getRunFormattingFromMarks(marks, {
|
|
2548
2567
|
baseParagraphFormatting,
|
|
2549
2568
|
inheritedFormatting,
|
|
2550
2569
|
paragraphMarkFormatting,
|
|
2551
|
-
paragraphMarkPrecedesStyle,
|
|
2552
2570
|
styleResolver
|
|
2553
2571
|
});
|
|
2554
2572
|
const run = {
|
|
@@ -2732,7 +2750,7 @@ function appendRunToHyperlink(hyperlink, run, node, sourceRunOwners) {
|
|
|
2732
2750
|
hyperlink.children.push(run);
|
|
2733
2751
|
rememberSourceRunOwner(run, node, sourceRunOwners);
|
|
2734
2752
|
}
|
|
2735
|
-
function createPageBreakCarrierRun({ baseParagraphFormatting, clear, inheritedFormatting, marks, paragraphMarkFormatting,
|
|
2753
|
+
function createPageBreakCarrierRun({ baseParagraphFormatting, clear, inheritedFormatting, marks, paragraphMarkFormatting, styleResolver }) {
|
|
2736
2754
|
const run = {
|
|
2737
2755
|
type: "run",
|
|
2738
2756
|
content: [{
|
|
@@ -2745,7 +2763,6 @@ function createPageBreakCarrierRun({ baseParagraphFormatting, clear, inheritedFo
|
|
|
2745
2763
|
baseParagraphFormatting,
|
|
2746
2764
|
inheritedFormatting,
|
|
2747
2765
|
paragraphMarkFormatting,
|
|
2748
|
-
paragraphMarkPrecedesStyle,
|
|
2749
2766
|
styleResolver
|
|
2750
2767
|
});
|
|
2751
2768
|
if (formatting) run.formatting = formatting;
|
|
@@ -2815,20 +2832,18 @@ const withoutTheFieldsOwnMarks = (node) => {
|
|
|
2815
2832
|
});
|
|
2816
2833
|
return recreateProseNodeWithParagraphPropertySource(node, { content: Fragment.fromArray(children) });
|
|
2817
2834
|
};
|
|
2818
|
-
function createFieldFromNode(node, { baseParagraphFormatting, inheritedFormatting, marks, paragraphMarkFormatting,
|
|
2835
|
+
function createFieldFromNode(node, { baseParagraphFormatting, inheritedFormatting, marks, paragraphMarkFormatting, styleResolver, textBoxAnchorMarkers }) {
|
|
2819
2836
|
const attrs = expectFieldAttrs(node);
|
|
2820
2837
|
const formatting = marks && marks.length > 0 ? marksToTextFormatting(marks, {
|
|
2821
2838
|
baseParagraphFormatting,
|
|
2822
2839
|
inheritedFormatting,
|
|
2823
2840
|
paragraphMarkFormatting,
|
|
2824
|
-
paragraphMarkPrecedesStyle,
|
|
2825
2841
|
styleResolver
|
|
2826
2842
|
}) : void 0;
|
|
2827
2843
|
const fieldFormattingContext = {
|
|
2828
2844
|
baseParagraphFormatting,
|
|
2829
2845
|
inheritedFormatting,
|
|
2830
2846
|
paragraphMarkFormatting,
|
|
2831
|
-
paragraphMarkPrecedesStyle: paragraphMarkPrecedesStyle ?? false,
|
|
2832
2847
|
styleResolver: styleResolver ?? null
|
|
2833
2848
|
};
|
|
2834
2849
|
const extractedContent = extractParagraphContent(withoutTheFieldsOwnMarks(node), void 0, void 0, textBoxAnchorMarkers, false, fieldFormattingContext).filter(isSimpleFieldContent);
|
|
@@ -3638,6 +3653,9 @@ function convertPMTableCell(node, documentCounts, styleResolver = null) {
|
|
|
3638
3653
|
} else if (contentNode.type.name === "blockMoveRangeBoundary") {
|
|
3639
3654
|
content.push({ ...expectMoveRangeBoundaryAttrs(contentNode) });
|
|
3640
3655
|
previousStandaloneTextBox = null;
|
|
3656
|
+
} else if (contentNode.type.name === "blockCommentRangeBoundary") {
|
|
3657
|
+
content.push({ ...expectCommentRangeBoundaryAttrs(contentNode).marker });
|
|
3658
|
+
previousStandaloneTextBox = null;
|
|
3641
3659
|
}
|
|
3642
3660
|
});
|
|
3643
3661
|
removeUnresolvedTextBoxAnchors(content, textBoxAnchorMarkers);
|
|
@@ -3676,6 +3694,8 @@ function convertPMTableCell(node, documentCounts, styleResolver = null) {
|
|
|
3676
3694
|
return cell;
|
|
3677
3695
|
}
|
|
3678
3696
|
const standaloneTableCellFromProseMirror = (node) => convertPMTableCell(node);
|
|
3697
|
+
/** A table node's rows as the save writes them, vertical merges included. */
|
|
3698
|
+
const standaloneTableRowsFromProseMirror = (node) => convertPMTableRows(node);
|
|
3679
3699
|
const cellShadingFromAttrs = (attrs) => attrs.backgroundColor ? { fill: { rgb: attrs.backgroundColor } } : { pattern: "nil" };
|
|
3680
3700
|
function tableCellAttrsToFormatting(attrs) {
|
|
3681
3701
|
const backgroundChanged = attrs.backgroundColor !== attrs._resolvedBackgroundColor;
|
|
@@ -3700,16 +3720,21 @@ function tableCellAttrsToFormatting(attrs) {
|
|
|
3700
3720
|
if (attrs.textDirection) result.textDirection = attrs.textDirection;
|
|
3701
3721
|
else delete result.textDirection;
|
|
3702
3722
|
}
|
|
3723
|
+
if (attrs.noWrap !== (orig.noWrap ?? void 0)) {
|
|
3724
|
+
if (attrs.noWrap === true) result.noWrap = true;
|
|
3725
|
+
else delete result.noWrap;
|
|
3726
|
+
}
|
|
3703
3727
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
3704
3728
|
}
|
|
3705
3729
|
const authoredWidth = attrs._authoredWidth;
|
|
3706
|
-
if (!(attrs.colspan > 1 || attrs.rowspan > 1 || authoredWidth !== void 0 || attrs.verticalAlign || backgroundChanged || attrs.borders || attrs.margins || attrs.textDirection)) return;
|
|
3730
|
+
if (!(attrs.colspan > 1 || attrs.rowspan > 1 || authoredWidth !== void 0 || attrs.verticalAlign || backgroundChanged || attrs.borders || attrs.margins || attrs.textDirection || attrs.noWrap === true)) return;
|
|
3707
3731
|
const f = {};
|
|
3708
3732
|
if (attrs.colspan > 1) f.gridSpan = attrs.colspan;
|
|
3709
3733
|
if (attrs.rowspan > 1) f.vMerge = "restart";
|
|
3710
3734
|
if (authoredWidth) f.width = authoredWidth;
|
|
3711
3735
|
if (attrs.verticalAlign) f.verticalAlign = attrs.verticalAlign;
|
|
3712
3736
|
if (attrs.textDirection) f.textDirection = attrs.textDirection;
|
|
3737
|
+
if (attrs.noWrap === true) f.noWrap = true;
|
|
3713
3738
|
if (backgroundChanged) f.shading = cellShadingFromAttrs(attrs);
|
|
3714
3739
|
if (attrs.borders) f.borders = attrs.borders;
|
|
3715
3740
|
if (attrs.margins) f.margins = buildCellMarginsFromAttrs(attrs.margins);
|
|
@@ -3743,8 +3768,33 @@ function convertPMTextBox(node, styleResolver = null) {
|
|
|
3743
3768
|
const verticalAlign = normalizeShapeTextAnchor(attrs.verticalAlign);
|
|
3744
3769
|
const childBlocks = [];
|
|
3745
3770
|
node.forEach((child) => {
|
|
3746
|
-
|
|
3747
|
-
|
|
3771
|
+
switch (child.type.name) {
|
|
3772
|
+
case "paragraph":
|
|
3773
|
+
childBlocks.push(convertPMParagraph(child, void 0, void 0, styleResolver));
|
|
3774
|
+
break;
|
|
3775
|
+
case "table":
|
|
3776
|
+
childBlocks.push(convertPMTable(child, void 0, styleResolver));
|
|
3777
|
+
break;
|
|
3778
|
+
case "blockSdt":
|
|
3779
|
+
childBlocks.push(convertPMBlockSdt(child, styleResolver));
|
|
3780
|
+
break;
|
|
3781
|
+
case "blockCustomXml":
|
|
3782
|
+
childBlocks.push(convertPMBlockCustomXml(child, styleResolver));
|
|
3783
|
+
break;
|
|
3784
|
+
case "preservedBlock":
|
|
3785
|
+
childBlocks.push({
|
|
3786
|
+
type: "preservedBlock",
|
|
3787
|
+
xml: expectPreservedBlockAttrs(child).xml
|
|
3788
|
+
});
|
|
3789
|
+
break;
|
|
3790
|
+
case "blockBookmarkBoundary":
|
|
3791
|
+
childBlocks.push(blockBookmarkMarker(child));
|
|
3792
|
+
break;
|
|
3793
|
+
case "blockMoveRangeBoundary":
|
|
3794
|
+
childBlocks.push({ ...expectMoveRangeBoundaryAttrs(child) });
|
|
3795
|
+
break;
|
|
3796
|
+
case "blockCommentRangeBoundary": childBlocks.push({ ...expectCommentRangeBoundaryAttrs(child).marker });
|
|
3797
|
+
}
|
|
3748
3798
|
});
|
|
3749
3799
|
const textBodyContent = projectTextBoxBodyContent(attrs._docxTextBodyContentState, childBlocks);
|
|
3750
3800
|
const margins = {};
|
|
@@ -3854,9 +3904,10 @@ function updateDocumentContent(originalDocument, pmDoc) {
|
|
|
3854
3904
|
function proseDocToBlocks(pmDoc, baseContent, styles) {
|
|
3855
3905
|
const blocks = extractBlocks(pmDoc, "resolve", styles ? createStyleEngine(styles) : null);
|
|
3856
3906
|
joinCommentRangesAcrossParagraphs(blocks);
|
|
3907
|
+
joinBookmarkRangesAcrossParagraphs(blocks);
|
|
3857
3908
|
completeCommentReferences(blocks);
|
|
3858
3909
|
const linkedSources = restoreLinkedParagraphPropertySources(blocks);
|
|
3859
3910
|
if (baseContent) restoreParagraphPropertySources(blocks, baseContent, linkedSources.targets, linkedSources.sources);
|
|
3860
3911
|
return blocks;
|
|
3861
3912
|
}
|
|
3862
|
-
export { fromProseDoc, marksToTextFormatting, proseDocToBlocks, standaloneTableCellFromProseMirror, tableAttrsToFormatting, tableCellAttrsToFormatting, tableRowAttrsToFormatting, updateDocumentContent };
|
|
3913
|
+
export { fromProseDoc, marksToTextFormatting, proseDocToBlocks, standaloneTableCellFromProseMirror, standaloneTableRowsFromProseMirror, tableAttrsToFormatting, tableCellAttrsToFormatting, tableRowAttrsToFormatting, updateDocumentContent };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FromProseDocOptions, ProjectionReuse, fromProseDoc, proseDocToBlocks, updateDocumentContent } from "./fromProseDoc.js";
|
|
2
|
-
import { ToProseDocOptions, createEmptyDoc, headerFooterToProseDoc, toProseDoc } from "./toProseDoc.js";
|
|
3
1
|
import { ProseMirrorDocumentValidationIssue, ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "../validation.js";
|
|
2
|
+
import { ToProseDocOptions, createEmptyDoc, headerFooterToProseDoc, toProseDoc } from "./toProseDoc.js";
|
|
3
|
+
import { FromProseDocOptions, ProjectionReuse, fromProseDoc, proseDocToBlocks, updateDocumentContent } from "./fromProseDoc.js";
|
|
4
4
|
export { type FromProseDocOptions, type ProjectionReuse, type ProseMirrorDocumentValidationIssue, type ToProseDocOptions, type ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, createEmptyDoc, formatProseMirrorDocumentIssues, fromProseDoc, headerFooterToProseDoc, proseDocToBlocks, toProseDoc, updateDocumentContent, validateProseMirrorDocument };
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
2
|
import { TextBoxAttrs } from "../schema/nodes.js";
|
|
3
|
+
import { NumberingMap } from "../../docx/numberingParser.js";
|
|
4
|
+
import { StyleEngine } from "../../style-engine/styleEngine.js";
|
|
5
|
+
import "../../style-engine/index.js";
|
|
6
|
+
import { ListRenderingDefinition } from "../../docx/listRendering.js";
|
|
3
7
|
import { ParseContext } from "../../docx/parseContext.js";
|
|
8
|
+
import { PageBreakRunSourceDescendantIndex } from "../../internal/pageBreakRunSourceDescendantIndex.js";
|
|
9
|
+
import { MarkFactory } from "../extensions/marks/markUtils.js";
|
|
10
|
+
import { CarrierContinuationCache } from "../runIdentityAcrossRevisions.js";
|
|
11
|
+
import { ValidatedStory } from "../validation.js";
|
|
4
12
|
import { Node } from "prosemirror-model";
|
|
5
13
|
/**
|
|
6
14
|
* Options for document conversion
|
|
@@ -17,13 +25,108 @@ export type ToProseDocOptions = {
|
|
|
17
25
|
* already use. Absent means nobody is listening, not that nothing happened.
|
|
18
26
|
*/
|
|
19
27
|
warn?: ParseContext["warn"];
|
|
28
|
+
/**
|
|
29
|
+
* Blocks converted by earlier projections of the same story, reused where
|
|
30
|
+
* nothing a block's conversion read has changed. See
|
|
31
|
+
* {@link createProjectionBlockCache}.
|
|
32
|
+
*/
|
|
33
|
+
blockCache?: ProjectionBlockCache;
|
|
34
|
+
/**
|
|
35
|
+
* The salt of minted text-box anchor ids. Each conversion draws its own;
|
|
36
|
+
* a block cache keeps one for every projection it serves, and a caller
|
|
37
|
+
* comparing a cached projection with a fresh one gives the fresh one the
|
|
38
|
+
* cache's salt.
|
|
39
|
+
*/
|
|
40
|
+
textBoxGroupSalt?: string;
|
|
20
41
|
};
|
|
42
|
+
/** Records that a page break is projected less than exactly. */
|
|
43
|
+
type PageBreakProjectionWarn = (detail: string) => void;
|
|
44
|
+
type HyperlinkInstanceIndexAllocator = () => number;
|
|
21
45
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
46
|
+
* Every bookmark boundary of a story's blocks, in the document order the
|
|
47
|
+
* conversion meets them, across every editable inline wrapper. Each endpoint
|
|
48
|
+
* is converted at its own structural position, so a range may start outside
|
|
49
|
+
* a hyperlink and end inside it (or the inverse).
|
|
25
50
|
*/
|
|
51
|
+
export declare const visitBookmarkBoundaries: (blocks: readonly document_d_exports.BlockContent[], countBoundary: (id: number, type: "start" | "end") => void) => void;
|
|
52
|
+
/** The bookmarks of a story's blocks whose one start opens before their one end. */
|
|
26
53
|
export declare const collectPairedBookmarkIds: (blocks: readonly document_d_exports.BlockContent[]) => ReadonlySet<number>;
|
|
54
|
+
/**
|
|
55
|
+
* What each field of the conversion context depends on: the package alone,
|
|
56
|
+
* or the story before the block being converted. A block's conversion reads
|
|
57
|
+
* the package fields freely; it reads the story fields only through a
|
|
58
|
+
* recorder, so a converted block is reused only where every story fact it
|
|
59
|
+
* read still holds. Total over the context: a field added to it does not
|
|
60
|
+
* compile until it is placed in one half or the other.
|
|
61
|
+
*/
|
|
62
|
+
declare const CONVERSION_CONTEXT_DEPENDENCY: {
|
|
63
|
+
readonly listRenderings: "package";
|
|
64
|
+
readonly numbering: "package";
|
|
65
|
+
readonly theme: "package";
|
|
66
|
+
readonly pageBreakRunSourceDescendants: "package";
|
|
67
|
+
readonly warnPageBreakProjection: "package";
|
|
68
|
+
readonly createMark: "package";
|
|
69
|
+
readonly nextTextBoxGroupId: "story";
|
|
70
|
+
readonly nextHyperlinkInstanceIndex: "story";
|
|
71
|
+
readonly nextNoteReferenceOccurrenceId: "story";
|
|
72
|
+
readonly pairedBookmarkIds: "story";
|
|
73
|
+
readonly storyRangedCommentIds: "story";
|
|
74
|
+
readonly openCommentIds: "story";
|
|
75
|
+
};
|
|
76
|
+
type ContextDependency = typeof CONVERSION_CONTEXT_DEPENDENCY;
|
|
77
|
+
type PackageContextField = { [K in keyof ContextDependency]: ContextDependency[K] extends "package" ? K : never; }[keyof ContextDependency];
|
|
78
|
+
/** The conversion context a block may read without recording. */
|
|
79
|
+
type PackageConversionContext = Pick<TableConversionContext, PackageContextField>;
|
|
80
|
+
/** Whether a story holds an id: all a block's conversion asks of a story id set. */
|
|
81
|
+
type IdMembership = Pick<ReadonlySet<number>, "has">;
|
|
82
|
+
/** One story counter, as the conversion advances it. */
|
|
83
|
+
type StoryCounter = {
|
|
84
|
+
value: number;
|
|
85
|
+
};
|
|
86
|
+
/** The story state a block conversion starts from and advances. */
|
|
87
|
+
type StoryState = {
|
|
88
|
+
textBoxGroups: StoryCounter;
|
|
89
|
+
hyperlinks: StoryCounter;
|
|
90
|
+
noteOccurrences: StoryCounter;
|
|
91
|
+
pairedBookmarkIds: IdMembership;
|
|
92
|
+
storyRangedCommentIds: IdMembership;
|
|
93
|
+
openCommentIds: Set<number>;
|
|
94
|
+
};
|
|
95
|
+
type ProjectionPackageInputs = {
|
|
96
|
+
styles: document_d_exports.StyleDefinitions | undefined;
|
|
97
|
+
theme: document_d_exports.Theme | null;
|
|
98
|
+
numbering: document_d_exports.NumberingDefinitions | undefined;
|
|
99
|
+
warn: ParseContext["warn"] | undefined;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Converted blocks kept across projections of one story.
|
|
103
|
+
*
|
|
104
|
+
* A block is the same object in the next document when an edit left it, so
|
|
105
|
+
* its nodes can be reused where the story facts its conversion read are the
|
|
106
|
+
* same: the counters it drew from, the comments open at its start, and the
|
|
107
|
+
* bookmark and comment ids it asked about. The package inputs (styles,
|
|
108
|
+
* theme, numbering) are part of the cache: a projection over other ones
|
|
109
|
+
* starts the cache over.
|
|
110
|
+
*/
|
|
111
|
+
export declare class ProjectionBlockCache {
|
|
112
|
+
readonly salt: string;
|
|
113
|
+
/** The story's top-level blocks as the last pass continued them. */
|
|
114
|
+
readonly carriers: CarrierContinuationCache;
|
|
115
|
+
/** The last story document that passed validation. */
|
|
116
|
+
validated: ValidatedStory | undefined;
|
|
117
|
+
private inputs;
|
|
118
|
+
private context;
|
|
119
|
+
private blocks;
|
|
120
|
+
/** The package context for these inputs, the cache started over if they changed. */
|
|
121
|
+
packageContext(inputs: ProjectionPackageInputs): PackageConversionContext & {
|
|
122
|
+
styleResolver: StyleEngine;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* The nodes of `paragraph` from the story state it starts at, reused when
|
|
126
|
+
* every story fact its last conversion read still holds, else converted.
|
|
127
|
+
*/
|
|
128
|
+
block(block: document_d_exports.Paragraph | document_d_exports.Table, state: StoryState, convert: (context: TableConversionContext) => Node[]): readonly Node[];
|
|
129
|
+
}
|
|
27
130
|
/**
|
|
28
131
|
* Convert a Document to a ProseMirror document
|
|
29
132
|
*
|
|
@@ -31,6 +134,38 @@ export declare const collectPairedBookmarkIds: (blocks: readonly document_d_expo
|
|
|
31
134
|
* @param options - Conversion options including style definitions
|
|
32
135
|
*/
|
|
33
136
|
export declare function toProseDoc(document: document_d_exports.Document, options?: ToProseDocOptions): Node;
|
|
137
|
+
type ResolvedListRendering = ListRenderingDefinition;
|
|
138
|
+
/**
|
|
139
|
+
* Convert a Table to a ProseMirror table node
|
|
140
|
+
*
|
|
141
|
+
* Handles column widths from w:tblGrid - if cell widths aren't specified,
|
|
142
|
+
* we use the grid column widths to set cell widths. This ensures tables
|
|
143
|
+
* preserve their layout when opened from DOCX files.
|
|
144
|
+
*/
|
|
145
|
+
type TableConversionContext = {
|
|
146
|
+
listRenderings: Map<string, ResolvedListRendering>;
|
|
147
|
+
numbering: NumberingMap | undefined;
|
|
148
|
+
theme: document_d_exports.Theme | null | undefined;
|
|
149
|
+
nextTextBoxGroupId: () => string;
|
|
150
|
+
nextHyperlinkInstanceIndex: HyperlinkInstanceIndexAllocator;
|
|
151
|
+
nextNoteReferenceOccurrenceId: () => string;
|
|
152
|
+
pairedBookmarkIds: IdMembership;
|
|
153
|
+
pageBreakRunSourceDescendants: PageBreakRunSourceDescendantIndex;
|
|
154
|
+
/** Comments the story opens a range for, for the point-comment question. */
|
|
155
|
+
storyRangedCommentIds: IdMembership;
|
|
156
|
+
warnPageBreakProjection: PageBreakProjectionWarn;
|
|
157
|
+
/** Shares one mark instance per distinct run formatting across the conversion. */
|
|
158
|
+
createMark: MarkFactory;
|
|
159
|
+
/**
|
|
160
|
+
* Comment ranges open at the walk's current position. A range is a story
|
|
161
|
+
* fact, not a paragraph one: it opens in one paragraph and closes in another,
|
|
162
|
+
* and every inline node between the two carries its mark. The walk visits the
|
|
163
|
+
* story in document order, so the set the block walker carries is exactly the
|
|
164
|
+
* set of ranges covering the node it is converting — the same way
|
|
165
|
+
* `pairedBookmarkIds` answers for a boundary whose partner is elsewhere.
|
|
166
|
+
*/
|
|
167
|
+
openCommentIds: Set<number>;
|
|
168
|
+
};
|
|
34
169
|
export declare function standaloneTableCellToProseMirror(cell: document_d_exports.TableCell, nodeType: "tableCell" | "tableHeader"): Node;
|
|
35
170
|
/**
|
|
36
171
|
* The host paragraph's attributes without its identity. The node may be
|
|
@@ -50,4 +185,5 @@ export declare function footnoteToProseDoc(content: document_d_exports.BlockCont
|
|
|
50
185
|
/**
|
|
51
186
|
* Create an empty ProseMirror document
|
|
52
187
|
*/
|
|
53
|
-
export declare function createEmptyDoc(): Node;
|
|
188
|
+
export declare function createEmptyDoc(): Node;
|
|
189
|
+
export {};
|