@stll/folio-core 0.46.0 → 0.47.1
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 +17 -1
- package/dist/ai-edits/apply.js +31 -27
- package/dist/ai-edits/headless.d.ts +9 -2
- package/dist/ai-edits/headless.js +5 -3
- package/dist/ai-edits/read.d.ts +1 -0
- package/dist/ai-edits/read.js +1 -0
- package/dist/ai-edits/snapshot.js +32 -27
- package/dist/ai-edits/table-cell-mutations.js +15 -7
- package/dist/ai-edits/table-geometry.js +21 -18
- package/dist/ai-edits/table-template.js +2 -2
- package/dist/compare/compare.js +2 -1
- package/dist/compare/content-alignment.js +192 -46
- package/dist/compare/content-types.d.ts +8 -2
- package/dist/compare/content.js +2 -11
- package/dist/compare/plan.js +7 -4
- package/dist/compare/section-boundary-properties.js +1 -2
- package/dist/content-controls/checkboxDisplay.d.ts +8 -2
- package/dist/content-controls/checkboxDisplay.js +11 -5
- package/dist/content-controls/mutateContentControls.js +41 -42
- package/dist/controller/layoutPipeline.js +8 -3
- package/dist/display-list/build/buildDisplayList.js +7 -7
- package/dist/display-list/build/imagePrimitives.d.ts +4 -4
- package/dist/display-list/build/imagePrimitives.js +38 -20
- package/dist/display-list/build/pageBorderPrimitives.js +2 -1
- package/dist/display-list/build/paragraphPrimitives.js +93 -13
- package/dist/display-list/build/previewPrimitives.d.ts +10 -0
- package/dist/display-list/build/previewPrimitives.js +89 -0
- package/dist/display-list/build/strokes.d.ts +177 -8
- package/dist/display-list/build/strokes.js +167 -47
- package/dist/display-list/build/tablePrimitives.js +4 -2
- package/dist/display-list/build/textBoxPrimitives.js +6 -4
- package/dist/display-list/build/textDecorations.d.ts +15 -1
- package/dist/display-list/build/textDecorations.js +15 -1
- package/dist/display-list/dom/renderDisplayListToDom.js +1 -19
- package/dist/display-list/primitives.d.ts +13 -2
- package/dist/display-list/primitives.js +36 -1
- package/dist/document-operations.d.ts +9 -2
- package/dist/document-operations.js +5 -3
- package/dist/docx/attributeRemainder.d.ts +34 -1
- package/dist/docx/attributeRemainder.js +49 -3
- package/dist/docx/blockContentParser.d.ts +2 -0
- package/dist/docx/blockContentParser.js +39 -67
- package/dist/docx/blockPlainText.js +3 -1
- package/dist/docx/borderParser.js +26 -11
- package/dist/docx/builtInStyles.d.ts +8 -16
- package/dist/docx/builtInStyles.js +54 -17
- package/dist/docx/commentAnchorIndex.js +1 -1
- package/dist/docx/commentParser.js +3 -3
- package/dist/docx/commentRangeIntegrity.js +1 -1
- package/dist/docx/commentRangeJoin.js +1 -1
- package/dist/docx/commentReferenceNormalization.js +3 -2
- package/dist/docx/commentReplyMarkers.js +1 -1
- package/dist/docx/compatibility.js +56 -42
- package/dist/docx/containerChildren.d.ts +110 -13
- package/dist/docx/containerChildren.gen.d.ts +16 -1
- package/dist/docx/containerChildren.gen.js +18 -1
- package/dist/docx/containerChildren.js +63 -13
- package/dist/docx/diagramPreview.d.ts +14 -2
- package/dist/docx/diagramPreview.js +81 -169
- package/dist/docx/documentParser.js +4 -1
- package/dist/docx/drawingAnchor.d.ts +87 -0
- package/dist/docx/drawingAnchor.js +201 -0
- package/dist/docx/drawingUtils.d.ts +43 -38
- package/dist/docx/drawingUtils.js +205 -118
- package/dist/docx/fontTableParser.js +102 -41
- package/dist/docx/footnoteParser.js +10 -6
- package/dist/docx/groupDrawingParser.js +4 -3
- package/dist/docx/headerFooterReferenceNormalization.js +1 -1
- package/dist/docx/hyperlinkParser.d.ts +45 -7
- package/dist/docx/hyperlinkParser.js +126 -57
- package/dist/docx/imageParser.js +127 -107
- package/dist/docx/index.d.ts +2 -1
- package/dist/docx/index.js +2 -1
- package/dist/docx/inlineContentRemovals.d.ts +28 -0
- package/dist/docx/inlineContentRemovals.js +46 -0
- package/dist/docx/inlineWrapperContent.d.ts +84 -3
- package/dist/docx/inlineWrapperContent.js +85 -4
- package/dist/docx/inlineWrapperParser.d.ts +11 -0
- package/dist/docx/inlineWrapperParser.js +60 -0
- package/dist/docx/nonVisualDrawingProps.d.ts +5 -13
- package/dist/docx/normalizeBaseDirection.js +4 -2
- package/dist/docx/numberingParser.d.ts +25 -2
- package/dist/docx/numberingParser.js +264 -361
- package/dist/docx/numberingReference.d.ts +9 -16
- package/dist/docx/numberingReference.js +17 -16
- package/dist/docx/numberingReferenceNormalization.js +7 -7
- package/dist/docx/ooxmlCounterFormatter.d.ts +1 -1
- package/dist/docx/ooxmlCounterFormatter.js +4 -1
- package/dist/docx/paraIdAttribute.d.ts +91 -1
- package/dist/docx/paraIdAttribute.js +79 -1
- package/dist/docx/paragraphParser.d.ts +9 -24
- package/dist/docx/paragraphParser.js +212 -396
- package/dist/docx/paragraphProperties.d.ts +23 -0
- package/dist/docx/paragraphProperties.js +279 -0
- package/dist/docx/paragraphPropertySource.js +2 -0
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +2 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +14 -7
- package/dist/docx/paragraphTraversal.d.ts +14 -10
- package/dist/docx/paragraphTraversal.js +47 -49
- package/dist/docx/parseWarningMessage.js +3 -0
- package/dist/docx/parserEnums.d.ts +6 -8
- package/dist/docx/parserEnums.js +4 -6
- package/dist/docx/preservedRunContent.js +16 -6
- package/dist/docx/previewBudget.d.ts +44 -23
- package/dist/docx/previewBudget.js +61 -30
- package/dist/docx/propertyElementAttributes.d.ts +178 -0
- package/dist/docx/propertyElementAttributes.js +114 -0
- package/dist/docx/renderedPageBreakNormalization.js +2 -2
- package/dist/docx/rezip.d.ts +28 -2
- package/dist/docx/rezip.js +78 -9
- package/dist/docx/runConsolidator.d.ts +42 -2
- package/dist/docx/runConsolidator.js +60 -6
- package/dist/docx/runParser.d.ts +54 -18
- package/dist/docx/runParser.js +379 -295
- package/dist/docx/runPayload.d.ts +5 -0
- package/dist/docx/runPayload.js +4 -0
- package/dist/docx/sdtProperties.d.ts +39 -5
- package/dist/docx/sdtProperties.js +205 -84
- package/dist/docx/sdtPropertiesPatch.d.ts +5 -9
- package/dist/docx/sdtPropertiesPatch.js +68 -112
- package/dist/docx/sectionParser.d.ts +1 -2
- package/dist/docx/sectionParser.js +236 -240
- package/dist/docx/selectiveSave.js +3 -2
- package/dist/docx/selectiveXmlPatch.d.ts +21 -2
- package/dist/docx/selectiveXmlPatch.js +195 -99
- package/dist/docx/serializer/blockSdtSerializer.js +2 -96
- package/dist/docx/serializer/borderSerializer.d.ts +5 -5
- package/dist/docx/serializer/borderSerializer.js +10 -8
- package/dist/docx/serializer/documentSerializer.js +3 -0
- package/dist/docx/serializer/fontTableSerializer.js +31 -3
- package/dist/docx/serializer/headerFooterSerializer.js +3 -0
- package/dist/docx/serializer/markupRangeAttributes.d.ts +9 -1
- package/dist/docx/serializer/markupRangeAttributes.js +9 -1
- package/dist/docx/serializer/noteSerializer.js +3 -0
- package/dist/docx/serializer/numberingSerializer.d.ts +1 -6
- package/dist/docx/serializer/numberingSerializer.js +81 -79
- package/dist/docx/serializer/paragraphSerializer.d.ts +1 -9
- package/dist/docx/serializer/paragraphSerializer.js +88 -188
- package/dist/docx/serializer/runSerializer.d.ts +1 -5
- package/dist/docx/serializer/runSerializer.js +109 -59
- package/dist/docx/serializer/sdtPropertiesSerializer.d.ts +26 -0
- package/dist/docx/serializer/sdtPropertiesSerializer.js +111 -0
- package/dist/docx/serializer/sectionPropertiesSerializer.js +34 -45
- package/dist/docx/serializer/settingsSerializer.js +6 -4
- package/dist/docx/serializer/stylesSerializer.js +8 -11
- package/dist/docx/serializer/tableSerializer.js +268 -100
- package/dist/docx/serializer/textFormattingSerializer.d.ts +28 -4
- package/dist/docx/serializer/textFormattingSerializer.js +111 -101
- package/dist/docx/serializer/xmlUtils.d.ts +1 -1
- package/dist/docx/serializer/xmlUtils.js +1 -1
- package/dist/docx/server/createBilingualDocument.js +18 -16
- package/dist/docx/server/migrateYjsAttrSchema.js +3 -3
- package/dist/docx/settingsParser.js +7 -4
- package/dist/docx/shadingParser.d.ts +2 -1
- package/dist/docx/shadingParser.js +43 -7
- package/dist/docx/shapeParser.js +8 -3
- package/dist/docx/strictNames.d.ts +11 -0
- package/dist/docx/strictNames.gen.d.ts +45 -0
- package/dist/docx/strictNames.gen.js +50 -0
- package/dist/docx/strictNames.js +43 -0
- package/dist/docx/strictValueEncodings.gen.js +133 -131
- package/dist/docx/styleParser.js +17 -349
- package/dist/docx/tableParser.d.ts +10 -1
- package/dist/docx/tableParser.js +505 -181
- package/dist/docx/textBoxParser.d.ts +3 -1
- package/dist/docx/textBoxParser.js +18 -8
- package/dist/docx/themeColorAttribute.d.ts +13 -0
- package/dist/docx/themeColorAttribute.js +24 -0
- package/dist/docx/trackedMoveRangeNormalization.js +2 -1
- package/dist/docx/vmlImageParser.d.ts +13 -4
- package/dist/docx/vmlImageParser.js +74 -31
- package/dist/docx/vmlPreview.js +2 -2
- package/dist/docx/wrapPolygon.d.ts +30 -0
- package/dist/docx/wrapPolygon.js +70 -0
- package/dist/docx/xmlParser.d.ts +14 -1
- package/dist/docx/xmlParser.js +18 -2
- package/dist/fonts/embeddedFonts.js +3 -3
- package/dist/headless-layout.js +2 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +68 -0
- package/dist/i18n/messages/catalogs.gen.js +102 -34
- package/dist/i18n/messages/messages.gen.d.ts +4 -0
- package/dist/internal/headlessRevisionResolution.js +9 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +3 -1
- package/dist/internal/paragraphFormattingSerialization.d.ts +20 -9
- package/dist/internal/paragraphFormattingSerialization.js +118 -83
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +2 -0
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +17 -12
- package/dist/layout-bridge/convert/toFlowBlocks.js +177 -101
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +53 -17
- package/dist/layout-engine/measure/measureBlocks.d.ts +3 -0
- package/dist/layout-engine/measure/measureBlocks.js +6 -10
- package/dist/layout-engine/measure/tableCellGrid.js +2 -1
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +2 -1
- package/dist/layout-engine/measure/tableInlinePlacement.js +2 -5
- package/dist/layout-engine/paragraphSequence.js +3 -2
- package/dist/layout-engine/renderedBreakReconciliation.js +2 -1
- package/dist/layout-engine/section-breaks.d.ts +49 -2
- package/dist/layout-engine/section-breaks.js +55 -4
- package/dist/layout-engine/types.d.ts +47 -17
- package/dist/layout-engine/types.js +16 -1
- package/dist/layout-painter/borderStroke.d.ts +18 -4
- package/dist/layout-painter/renderPage.js +6 -4
- package/dist/layout-painter/renderParagraph.d.ts +2 -1
- package/dist/layout-painter/renderParagraph.js +13 -26
- package/dist/layout-painter/renderTable.d.ts +4 -1
- package/dist/layout-painter/renderTable.js +22 -22
- package/dist/layout-painter/renderTextBox.js +5 -3
- package/dist/markdown/renderBlock.js +3 -1
- package/dist/markdown/renderRuns.js +7 -2
- package/dist/markdown/renderTable.js +2 -1
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/paged-layout/sectionBlockWidths.d.ts +3 -0
- package/dist/paged-layout/sectionBlockWidths.js +26 -4
- package/dist/prosemirror/attrs/index.d.ts +22 -4
- package/dist/prosemirror/attrs/index.js +498 -60
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +9 -1
- package/dist/prosemirror/bookmarkBoundaryAttrs.js +22 -3
- package/dist/prosemirror/commands/comments.js +68 -53
- package/dist/prosemirror/commands/contentControls.js +24 -19
- package/dist/prosemirror/commands/image.d.ts +1 -1
- package/dist/prosemirror/commands/image.js +4 -1
- package/dist/prosemirror/commands/paragraph.d.ts +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +12 -4
- package/dist/prosemirror/commands/propertyChangeScope.js +22 -4
- package/dist/prosemirror/commands/sectionBreak.d.ts +33 -1
- package/dist/prosemirror/commands/sectionBreak.js +187 -11
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +18 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +330 -183
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/preservedSinkCarriers.d.ts +39 -0
- package/dist/prosemirror/conversion/preservedSinkCarriers.js +19 -0
- package/dist/prosemirror/conversion/runShadingMark.js +14 -1
- package/dist/prosemirror/conversion/sdtAttrs.d.ts +10 -1
- package/dist/prosemirror/conversion/sdtAttrs.js +19 -5
- package/dist/prosemirror/conversion/toProseDoc.js +371 -141
- package/dist/prosemirror/emptyRangeAnchor.d.ts +53 -0
- package/dist/prosemirror/emptyRangeAnchor.js +158 -0
- package/dist/prosemirror/extensions/StarterKit.js +8 -2
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +19 -15
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
- package/dist/prosemirror/extensions/features/ListExtension.js +43 -24
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +4 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +5 -5
- package/dist/prosemirror/extensions/features/pasteCleanup.d.ts +3 -1
- package/dist/prosemirror/extensions/features/pasteCleanup.js +56 -2
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +5 -4
- package/dist/prosemirror/extensions/markRegistry.d.ts +26 -2
- package/dist/prosemirror/extensions/markRegistry.js +73 -10
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +17 -3
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +26 -0
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +134 -0
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -1
- package/dist/prosemirror/extensions/marks/UnderlineExtension.js +12 -18
- package/dist/prosemirror/extensions/marks/markUtils.js +2 -1
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.d.ts +29 -0
- package/dist/prosemirror/extensions/nodes/BlockBookmarkBoundaryExtension.js +46 -0
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.d.ts +4 -3
- package/dist/prosemirror/extensions/nodes/BlockSdtExtension.js +18 -13
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +28 -53
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +10 -0
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +43 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +65 -0
- package/dist/prosemirror/extensions/nodes/SdtExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/nodes/SdtExtension.js +22 -16
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +4 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +141 -123
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +4 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.d.ts +23 -0
- package/dist/prosemirror/extensions/nodes/bookmarkBoundaryDom.js +57 -0
- package/dist/prosemirror/extensions/types.d.ts +12 -3
- package/dist/prosemirror/index.d.ts +4 -2
- package/dist/prosemirror/index.js +2 -1
- package/dist/prosemirror/inlineWrapperStack.js +20 -3
- package/dist/prosemirror/listMarker.d.ts +2 -2
- package/dist/prosemirror/listMarker.js +7 -8
- package/dist/prosemirror/listRenderingAttrs.js +11 -1
- package/dist/prosemirror/listState.d.ts +62 -0
- package/dist/prosemirror/listState.js +49 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +13 -0
- package/dist/prosemirror/moveRangeBoundaryAttrs.js +114 -0
- package/dist/prosemirror/numberedRefFields.js +4 -4
- package/dist/prosemirror/numberingAttr.d.ts +55 -0
- package/dist/prosemirror/numberingAttr.js +74 -0
- package/dist/prosemirror/outlineLevelAttr.d.ts +29 -0
- package/dist/prosemirror/outlineLevelAttr.js +42 -0
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +9 -0
- package/dist/prosemirror/paragraphFormattingProvenance.js +4 -1
- package/dist/prosemirror/plugins/selectionTracker.d.ts +3 -6
- package/dist/prosemirror/plugins/selectionTracker.js +3 -10
- package/dist/prosemirror/rangeAnchorAttrs.d.ts +14 -0
- package/dist/prosemirror/rangeAnchorAttrs.js +101 -0
- package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.js +24 -6
- package/dist/prosemirror/revisionCarriers.d.ts +86 -2
- package/dist/prosemirror/revisionCarriers.js +86 -60
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -0
- package/dist/prosemirror/runFormattingInlineCarriers.js +2 -0
- package/dist/prosemirror/runIdentity.d.ts +28 -0
- package/dist/prosemirror/runIdentity.js +36 -0
- package/dist/prosemirror/runStyleFormatting.js +1 -1
- package/dist/prosemirror/schema/index.d.ts +2 -2
- package/dist/prosemirror/schema/marks.d.ts +23 -4
- package/dist/prosemirror/schema/nodes.d.ts +220 -24
- package/dist/prosemirror/sectionCarrier.d.ts +37 -0
- package/dist/prosemirror/sectionCarrier.js +40 -0
- package/dist/prosemirror/selectionState.d.ts +3 -0
- package/dist/prosemirror/selectionState.js +4 -1
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +5 -4
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +15 -13
- package/dist/prosemirror/tableResize.js +5 -6
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
- package/dist/prosemirror/utils/extractTrackedChanges.d.ts +10 -11
- package/dist/prosemirror/utils/extractTrackedChanges.js +109 -92
- package/dist/prosemirror/validation.js +17 -6
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +2 -2
- package/dist/prosemirror/yjsDocumentMetadata.js +428 -7
- package/dist/prosemirror/zeroWidthAnchors.js +4 -0
- package/dist/style-sets/extract.js +4 -4
- package/dist/style-sets/stellaStyle.js +36 -23
- package/dist/types/colors.d.ts +2 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/documentEnumValues.d.ts +53 -26
- package/dist/types/documentEnumValues.js +72 -174
- package/dist/types/formatting.d.ts +2 -2
- package/dist/types/index.d.ts +9 -2
- package/dist/utils/borderCss.d.ts +246 -0
- package/dist/utils/borderCss.js +325 -0
- package/dist/utils/colorResolver.d.ts +4 -3
- package/dist/utils/colorResolver.js +45 -76
- package/dist/utils/createDocument.js +24 -6
- package/dist/utils/findReplace.js +52 -10
- package/dist/utils/formatToStyle.d.ts +84 -2
- package/dist/utils/formatToStyle.js +133 -52
- package/dist/utils/headingCollector.js +3 -2
- package/dist/utils/mergeDocumentContent.js +5 -3
- package/dist/utils/paragraphFormattingMerge.js +27 -6
- package/dist/utils/replaceText.js +1 -1
- package/dist/utils/tableOperations.d.ts +5 -3
- package/dist/utils/tableOperations.js +14 -1
- package/dist/utils/tablePlacement.d.ts +7 -0
- package/dist/utils/tablePlacement.js +14 -0
- package/dist/utils/textDirectionFlow.d.ts +15 -0
- package/dist/utils/textDirectionFlow.js +38 -0
- package/dist/utils/textFormattingMerge.js +16 -4
- package/package.json +10 -10
- package/dist/ai-edits/__fixtures__/paragraphs.d.ts +0 -17
- package/dist/ai-edits/__fixtures__/paragraphs.js +0 -33
- package/dist/compare/__fixtures__/body-sequence.d.ts +0 -119
- package/dist/compare/__fixtures__/body-sequence.js +0 -225
- package/dist/compare/__fixtures__/nested-table.d.ts +0 -16
- package/dist/compare/__fixtures__/nested-table.js +0 -50
- package/dist/compare/__fixtures__/numbered-list.d.ts +0 -34
- package/dist/compare/__fixtures__/numbered-list.js +0 -85
- package/dist/docx/bookmarkPlacement.d.ts +0 -9
- package/dist/docx/bookmarkPlacement.js +0 -52
- package/dist/fonts/embeddedFontTable.d.ts +0 -45
- package/dist/fonts/embeddedFontTable.js +0 -80
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +0 -13
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +0 -39
|
@@ -12,7 +12,15 @@ declare const isDisplacedByCustomXml: (value: unknown) => value is document_d_ex
|
|
|
12
12
|
declare const bookmarkBoundaryDisplacement: (attrs: BookmarkBoundaryAttrs) => {
|
|
13
13
|
displacedByCustomXml?: document_d_exports.DisplacedByCustomXml;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* The model marker a boundary node carries, at either level.
|
|
17
|
+
*
|
|
18
|
+
* A paragraph, a hyperlink, a revision wrapper and a block container each
|
|
19
|
+
* rebuild the same two elements from the same attributes; spelling that out
|
|
20
|
+
* per caller is how one of them comes to forget `w:colFirst`.
|
|
21
|
+
*/
|
|
22
|
+
declare const bookmarkMarkerFromAttrs: (attrs: BookmarkBoundaryAttrs) => document_d_exports.BookmarkStart | document_d_exports.BookmarkEnd;
|
|
15
23
|
declare const readBookmarkBoundaryAttrs: (node: Node) => ReadProseMirrorAttrsResult<BookmarkBoundaryAttrs>;
|
|
16
24
|
declare const expectBookmarkBoundaryAttrs: (node: Node) => BookmarkBoundaryAttrs;
|
|
17
25
|
//#endregion
|
|
18
|
-
export { bookmarkBoundaryDisplacement, expectBookmarkBoundaryAttrs, isDisplacedByCustomXml, readBookmarkBoundaryAttrs };
|
|
26
|
+
export { bookmarkBoundaryDisplacement, bookmarkMarkerFromAttrs, expectBookmarkBoundaryAttrs, isDisplacedByCustomXml, readBookmarkBoundaryAttrs };
|
|
@@ -8,11 +8,30 @@ const attrsCache = /* @__PURE__ */ new WeakMap();
|
|
|
8
8
|
* that build either one share this rather than each remembering the attribute.
|
|
9
9
|
*/
|
|
10
10
|
const bookmarkBoundaryDisplacement = (attrs) => attrs.displacedByCustomXml === void 0 ? {} : { displacedByCustomXml: attrs.displacedByCustomXml };
|
|
11
|
+
/**
|
|
12
|
+
* The model marker a boundary node carries, at either level.
|
|
13
|
+
*
|
|
14
|
+
* A paragraph, a hyperlink, a revision wrapper and a block container each
|
|
15
|
+
* rebuild the same two elements from the same attributes; spelling that out
|
|
16
|
+
* per caller is how one of them comes to forget `w:colFirst`.
|
|
17
|
+
*/
|
|
18
|
+
const bookmarkMarkerFromAttrs = (attrs) => attrs.type === "start" ? {
|
|
19
|
+
type: "bookmarkStart",
|
|
20
|
+
id: attrs.id,
|
|
21
|
+
name: attrs.name,
|
|
22
|
+
...attrs.colFirst !== void 0 ? { colFirst: attrs.colFirst } : {},
|
|
23
|
+
...attrs.colLast !== void 0 ? { colLast: attrs.colLast } : {},
|
|
24
|
+
...bookmarkBoundaryDisplacement(attrs)
|
|
25
|
+
} : {
|
|
26
|
+
type: "bookmarkEnd",
|
|
27
|
+
id: attrs.id,
|
|
28
|
+
...bookmarkBoundaryDisplacement(attrs)
|
|
29
|
+
};
|
|
11
30
|
const readBookmarkBoundaryAttrs = (node) => {
|
|
12
31
|
const issues = [];
|
|
13
|
-
if (node.type.name !== "bookmarkBoundary") issues.push({
|
|
32
|
+
if (node.type.name !== "bookmarkBoundary" && node.type.name !== "blockBookmarkBoundary") issues.push({
|
|
14
33
|
path: "bookmarkBoundary.type.name",
|
|
15
|
-
message: `Expected
|
|
34
|
+
message: `Expected a bookmark boundary, got ${node.type.name}.`
|
|
16
35
|
});
|
|
17
36
|
const type = node.attrs["type"];
|
|
18
37
|
if (type !== "start" && type !== "end") issues.push({
|
|
@@ -78,4 +97,4 @@ const expectBookmarkBoundaryAttrs = (node) => {
|
|
|
78
97
|
return result.value;
|
|
79
98
|
};
|
|
80
99
|
//#endregion
|
|
81
|
-
export { bookmarkBoundaryDisplacement, expectBookmarkBoundaryAttrs, isDisplacedByCustomXml, readBookmarkBoundaryAttrs };
|
|
100
|
+
export { bookmarkBoundaryDisplacement, bookmarkMarkerFromAttrs, expectBookmarkBoundaryAttrs, isDisplacedByCustomXml, readBookmarkBoundaryAttrs };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sameStatedParagraphNumbering as sameStatedParagraphNumbering$1 } from "../../docx/numberingReference.js";
|
|
1
2
|
import { joinProseParagraphsWithRightPropertySource } from "../../docx/paragraphPropertySource.js";
|
|
2
3
|
import { appendHeadlessInlineResolution } from "../../internal/headlessRevisionResolution.js";
|
|
3
4
|
import { stateAllowsHeadlessRevisionResolution } from "../../internal/headlessRevisionResolutionGuard.js";
|
|
@@ -5,9 +6,10 @@ import { expectParagraphAttrs, expectRunPropertyChangeMarkAttrs } from "../attrs
|
|
|
5
6
|
import { addedBreakCarrierBefore, finalParagraphsOf, paragraphEndsItsContainer } from "../containerFinalParagraph.js";
|
|
6
7
|
import { resolveParagraphDefaultTextFormatting } from "../conversion/toProseDoc.js";
|
|
7
8
|
import { markChangedParagraphRanges, markStructuralChange, markTrackedSectionEndpointRemoval } from "../extensions/features/ParagraphChangeTrackerExtension.js";
|
|
9
|
+
import "../extensions/nodes/SdtExtension.js";
|
|
8
10
|
import { getDocumentStyleResolver } from "../plugins/documentStyles.js";
|
|
9
11
|
import { setParagraphAttrsWithRebasedRunFormatting } from "../rebaseParagraphRunFormatting.js";
|
|
10
|
-
import { getFolioNodeRevisionCarriers } from "../revisionCarriers.js";
|
|
12
|
+
import { getFolioNodeRevisionCarriers, nodePropertyRevisionSites, propertyRevisionMetadata, propertyRevisionRecords } from "../revisionCarriers.js";
|
|
11
13
|
import { RUN_FORMATTING_MARK_NAMES } from "../runFormattingMarkNames.js";
|
|
12
14
|
import { reconstructRejectedRunFormattingMarks } from "../runPropertyChangeResolution.js";
|
|
13
15
|
import { paragraphRunStyleContextAt } from "../runStyleFormatting.js";
|
|
@@ -15,11 +17,11 @@ import { getTableCellMergeChange } from "../tableCellMergeRevision.js";
|
|
|
15
17
|
import { isTableCellRetainedInReviewView } from "../tableCellRevisionVisibility.js";
|
|
16
18
|
import { reconcileTableGridAfterColumnRemoval } from "../tableGridMutation.js";
|
|
17
19
|
import { holdsNoContent } from "../zeroWidthAnchors.js";
|
|
18
|
-
import { hasSerializableParagraphPropertyChange, paragraphPropertiesSnapshot, paragraphRejectAttrPatch, paragraphRejectOriginalFormatting, removeParagraphPropertyChanges, sectionRejectProperties, tableCellRejectAttrPatch, tableRejectAttrPatch, tableRowRejectAttrPatch } from "./propertyChangeScope.js";
|
|
20
|
+
import { hasSerializableParagraphPropertyChange, paragraphPropertiesSnapshot, paragraphRejectAttrPatch, paragraphRejectOriginalFormatting, removeParagraphPropertyChanges, sectionRejectProperties, tableCellRejectAttrPatch, tablePropertyExceptionsRejectAttrPatch, tableRejectAttrPatch, tableRowRejectAttrPatch } from "./propertyChangeScope.js";
|
|
19
21
|
import { hasMatchingCollapsedTableCellMerge, resolveCollapsedTableCellMerge, resolveVisibleTableCellMerge } from "./tableCellMergeResolution.js";
|
|
22
|
+
import { PARAGRAPH_MARK_CHANGE_KINDS, REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
20
23
|
import { TableMap, removeRow } from "prosemirror-tables";
|
|
21
24
|
import { Mapping } from "prosemirror-transform";
|
|
22
|
-
import { PARAGRAPH_MARK_CHANGE_KINDS, REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
23
25
|
//#region src/prosemirror/commands/comments.ts
|
|
24
26
|
/**
|
|
25
27
|
* Add a comment mark to the current selection.
|
|
@@ -131,7 +133,6 @@ function resolveChange(from, to, mode, revisionIds, execution = "legacy") {
|
|
|
131
133
|
if (remaining.length > 0) restored.propertyChanges = remaining;
|
|
132
134
|
nextAttrs = nextAttrs ?? { ...node.attrs };
|
|
133
135
|
nextAttrs["_sectionProperties"] = restored;
|
|
134
|
-
nextAttrs["sectionBreakType"] = sectionBreakTypeFromSectionStart(restored.sectionStart);
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
if (nextAttrs) if (nextAttrs["styleId"] !== node.attrs["styleId"] && styleResolver) setParagraphAttrsWithRebasedRunFormatting({
|
|
@@ -153,10 +154,10 @@ function resolveChange(from, to, mode, revisionIds, execution = "legacy") {
|
|
|
153
154
|
if (op) tableRowStructuralOps.push(op);
|
|
154
155
|
}
|
|
155
156
|
if ((node.type.name === "tableCell" || node.type.name === "tableHeader") && rangeCoversNode(from, to, pos, node)) tableCellStructuralOps.push(...collectTableCellStructuralOps(node, pos, mode, revisionSet));
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
if (rangeCoversNode(from, to, pos, node)) {
|
|
159
|
-
const nextAttrs =
|
|
157
|
+
const nodeAttrSites = nodePropertyRevisionSites(node.type.name).filter((site) => site.resolution === "node-attrs");
|
|
158
|
+
if (nodeAttrSites.length > 0) {
|
|
159
|
+
if (rangeCoversNode(from, to, pos, node)) for (const site of nodeAttrSites) {
|
|
160
|
+
const nextAttrs = resolveNodePropertyChangeAttrs(tr.doc.nodeAt(pos) ?? node, site, mode, revisionSet);
|
|
160
161
|
if (nextAttrs) {
|
|
161
162
|
tr.setNodeMarkup(pos, void 0, nextAttrs);
|
|
162
163
|
markStructuralChange(tr);
|
|
@@ -169,6 +170,13 @@ function resolveChange(from, to, mode, revisionIds, execution = "legacy") {
|
|
|
169
170
|
const nodeEnd = pos + node.nodeSize;
|
|
170
171
|
const rangeFrom = Math.max(from, pos);
|
|
171
172
|
const rangeTo = Math.min(to, nodeEnd);
|
|
173
|
+
if (node.type.name === "sdt" && removeType !== void 0 && rangeCoversNode(from, to, pos, node) && revisionCoversWholeControl(node, removeType, matchesRevision)) {
|
|
174
|
+
deleteRanges.push({
|
|
175
|
+
from: pos,
|
|
176
|
+
to: nodeEnd
|
|
177
|
+
});
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
172
180
|
const runPropertyChangeMark = node.marks.find((mark) => mark.type.name === "runPropertyChange");
|
|
173
181
|
const removesNode = removeType !== void 0 && node.marks.some((mark) => mark.type === removeType && matchesRevision(mark));
|
|
174
182
|
if (runPropertyChangeMark) resolveRunPropertyChange({
|
|
@@ -248,7 +256,6 @@ function resolveChange(from, to, mode, revisionIds, execution = "legacy") {
|
|
|
248
256
|
const joinedAttrs = {
|
|
249
257
|
...(emptyFirstParagraph ? nextNode : paragraph).attrs,
|
|
250
258
|
pPrMark: nextNode.attrs["pPrMark"],
|
|
251
|
-
sectionBreakType: nextNode.attrs["sectionBreakType"],
|
|
252
259
|
_sectionProperties: nextNode.attrs["_sectionProperties"]
|
|
253
260
|
};
|
|
254
261
|
try {
|
|
@@ -554,42 +561,64 @@ function rangeCoversParagraphBoundary(from, to, pos, node) {
|
|
|
554
561
|
function rangeCoversNode(from, to, pos, node) {
|
|
555
562
|
return from <= pos && to >= pos + node.nodeSize;
|
|
556
563
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
564
|
+
/**
|
|
565
|
+
* Whether a revision covers everything an inline content control holds.
|
|
566
|
+
*
|
|
567
|
+
* The save leg writes such a revision around the control (`w:ins > w:sdt`),
|
|
568
|
+
* so resolving it is an operation over the control itself: a reader who
|
|
569
|
+
* rejects an inserted control gets no control, not an empty one standing
|
|
570
|
+
* where it was. A revision over part of the content is a revision over that
|
|
571
|
+
* part, and a control that holds nothing is covered by nothing.
|
|
572
|
+
*/
|
|
573
|
+
function revisionCoversWholeControl(node, removeType, matchesRevision) {
|
|
574
|
+
if (node.childCount === 0) return false;
|
|
575
|
+
for (let index = 0; index < node.childCount; index += 1) {
|
|
576
|
+
const child = node.child(index);
|
|
577
|
+
if (child.marks.some((mark) => mark.type === removeType && matchesRevision(mark))) continue;
|
|
578
|
+
if (child.type.name !== "sdt" || !revisionCoversWholeControl(child, removeType, matchesRevision)) return false;
|
|
579
|
+
}
|
|
580
|
+
return true;
|
|
565
581
|
}
|
|
566
|
-
/**
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
582
|
+
/**
|
|
583
|
+
* The attrs a reject restores for each property revision the shared node-attr
|
|
584
|
+
* pass owns. Total over those kinds, so a revision the model gains either
|
|
585
|
+
* declares a different resolution or states here what rejecting it restores.
|
|
586
|
+
*
|
|
587
|
+
* Each patch narrows the stored set to the property set its own element
|
|
588
|
+
* carries. The casts are the ProseMirror attrs boundary: attrs are untyped,
|
|
589
|
+
* and a record reached through the site filed under a kind is the one that
|
|
590
|
+
* kind's parser and converter wrote.
|
|
591
|
+
*/
|
|
592
|
+
const NODE_ATTRS_REJECT_PATCHES = {
|
|
593
|
+
tablePropertyChange: (previousFormatting) => tableRejectAttrPatch(previousFormatting),
|
|
594
|
+
tablePropertyExceptionChange: (previousFormatting) => tablePropertyExceptionsRejectAttrPatch(previousFormatting),
|
|
595
|
+
tableRowPropertyChange: (previousFormatting) => tableRowRejectAttrPatch(previousFormatting),
|
|
596
|
+
tableCellPropertyChange: (previousFormatting, node) => tableCellRejectAttrPatch(previousFormatting, node.attrs["_originalFormatting"])
|
|
572
597
|
};
|
|
573
598
|
/**
|
|
574
|
-
* Resolve the tracked property-change records
|
|
599
|
+
* Resolve the tracked property-change records one site carries on a node.
|
|
575
600
|
* Accept keeps the live formatting and clears the matched records; reject
|
|
576
601
|
* additionally restores the stored previous formatting wholesale (the change
|
|
577
602
|
* element stores the complete old property set — see propertyChangeScope.ts).
|
|
578
603
|
* Returns the next attrs, or `null` when no record matches.
|
|
579
604
|
*/
|
|
580
|
-
function
|
|
581
|
-
const changes = node
|
|
582
|
-
if (
|
|
583
|
-
const matches = changes.filter((
|
|
605
|
+
function resolveNodePropertyChangeAttrs(node, site, mode, revisionSet) {
|
|
606
|
+
const changes = propertyRevisionRecords(node, site);
|
|
607
|
+
if (changes.length === 0) return null;
|
|
608
|
+
const matches = changes.filter((change) => {
|
|
609
|
+
const metadata = propertyRevisionMetadata(change.info);
|
|
610
|
+
return revisionSet === null || metadata !== null && revisionSet.has(metadata.id);
|
|
611
|
+
});
|
|
584
612
|
if (matches.length === 0) return null;
|
|
585
|
-
const remaining = changes.filter((
|
|
613
|
+
const remaining = revisionSet === null ? [] : changes.filter((change) => !matches.includes(change));
|
|
586
614
|
const nextAttrs = {
|
|
587
615
|
...node.attrs,
|
|
588
|
-
[
|
|
616
|
+
[site.attr]: remaining.length > 0 ? remaining : null
|
|
589
617
|
};
|
|
590
|
-
if (mode === "reject")
|
|
591
|
-
|
|
592
|
-
|
|
618
|
+
if (mode === "reject") {
|
|
619
|
+
const rejectPatch = NODE_ATTRS_REJECT_PATCHES[site.kind];
|
|
620
|
+
for (const change of matches.toReversed()) Object.assign(nextAttrs, rejectPatch(change.previousFormatting, node));
|
|
621
|
+
}
|
|
593
622
|
return nextAttrs;
|
|
594
623
|
}
|
|
595
624
|
function isPPrMarkAttr(value) {
|
|
@@ -607,10 +636,7 @@ function isPPrMarkAttr(value) {
|
|
|
607
636
|
* the two ends belong together, not because they resolve differently.
|
|
608
637
|
*/
|
|
609
638
|
const paragraphMarkWasAdded = (kind) => kind === "ins" || kind === "moveTo";
|
|
610
|
-
const ownsSectionEndpoint = (paragraph) =>
|
|
611
|
-
const attrs = expectParagraphAttrs(paragraph);
|
|
612
|
-
return attrs._sectionProperties !== void 0 || attrs.sectionBreakType !== void 0;
|
|
613
|
-
};
|
|
639
|
+
const ownsSectionEndpoint = (paragraph) => expectParagraphAttrs(paragraph)._sectionProperties !== void 0;
|
|
614
640
|
const sectionReferencesOf = (paragraph) => {
|
|
615
641
|
const sectionProperties = expectParagraphAttrs(paragraph)._sectionProperties;
|
|
616
642
|
if (!sectionProperties) return [];
|
|
@@ -632,23 +658,12 @@ function readRevisionInfo(info) {
|
|
|
632
658
|
if (typeof info?.id === "number") revision.revisionId = info.id;
|
|
633
659
|
return revision;
|
|
634
660
|
}
|
|
635
|
-
function getListPropertyChangeType(
|
|
661
|
+
function getListPropertyChangeType(node, change) {
|
|
636
662
|
const previousFormatting = change.previousFormatting;
|
|
637
663
|
if (previousFormatting == null || !Object.hasOwn(previousFormatting, "numPr")) return null;
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
if (previousNumPr != null && currentNumPr == null) return "deletion";
|
|
642
|
-
if (!areNumPrValuesEqual(previousNumPr, currentNumPr)) return currentNumPr == null ? "deletion" : "insertion";
|
|
643
|
-
return null;
|
|
644
|
-
}
|
|
645
|
-
function areNumPrValuesEqual(left, right) {
|
|
646
|
-
if (left == null || right == null) return left == right;
|
|
647
|
-
if (!isObjectRecord(left) || !isObjectRecord(right)) return Object.is(left, right);
|
|
648
|
-
return left["numId"] === right["numId"] && left["ilvl"] === right["ilvl"];
|
|
649
|
-
}
|
|
650
|
-
function isObjectRecord(value) {
|
|
651
|
-
return typeof value === "object" && value !== null;
|
|
664
|
+
const current = expectParagraphAttrs(node).numPr;
|
|
665
|
+
if (sameStatedParagraphNumbering$1(previousFormatting["numPr"] ?? void 0, current)) return null;
|
|
666
|
+
return current === void 0 ? "deletion" : "insertion";
|
|
652
667
|
}
|
|
653
668
|
function toParagraphBoundaryChange(node, pos, type, info) {
|
|
654
669
|
return {
|
|
@@ -668,7 +683,7 @@ function findParagraphBoundaryChangeAtPosition(state, pos) {
|
|
|
668
683
|
const propertyChanges = expectParagraphAttrs(node)._propertyChanges;
|
|
669
684
|
if (!Array.isArray(propertyChanges)) return null;
|
|
670
685
|
for (const change of propertyChanges) {
|
|
671
|
-
const type = getListPropertyChangeType(node
|
|
686
|
+
const type = getListPropertyChangeType(node, change);
|
|
672
687
|
if (type) return toParagraphBoundaryChange(node, paragraphPos, type, change.info);
|
|
673
688
|
}
|
|
674
689
|
return null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { checkboxDisplayContent } from "../../content-controls/checkboxDisplay.js";
|
|
2
2
|
import { ContentControlBoundError, ContentControlLockedError, ContentControlTypeError } from "../../content-controls/errors.js";
|
|
3
3
|
import { formatDate } from "../../docx/fieldParser.js";
|
|
4
|
+
import { preservedSdtChild, withoutPreservedSdtChild } from "../../docx/sdtProperties.js";
|
|
4
5
|
import { expectBlockSdtAttrs } from "../attrs/index.js";
|
|
5
6
|
import { SUGGESTION_BYPASS_META } from "../plugins/suggestionMode.js";
|
|
6
7
|
//#region src/prosemirror/commands/contentControls.ts
|
|
@@ -112,19 +113,26 @@ function ensureSdtNotLocked(node, options) {
|
|
|
112
113
|
const lock = node.attrs["lock"];
|
|
113
114
|
if (lock === "sdtLocked" || lock === "sdtContentLocked") throwLockedNode(node, lock);
|
|
114
115
|
}
|
|
115
|
-
const DATA_BINDING_RE = /<\w+:dataBinding\b(?<attrs>[^>]*)\/?>/iu;
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
117
|
+
* The control's preserved `w:sdtPr` children, off the node's attrs.
|
|
118
|
+
*
|
|
119
|
+
* `readBlockSdtAttrs` validates the shape at the document boundary, so this
|
|
120
|
+
* is the same record the model carries rather than a second parse of it.
|
|
121
|
+
*/
|
|
122
|
+
const preservedOf = (node) => {
|
|
123
|
+
const value = node.attrs["_preserved"];
|
|
124
|
+
return value === null || value === void 0 ? void 0 : value;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Refuse content mutations on bound SDTs unless force; on force, return the
|
|
128
|
+
* attrs override that drops the `w:dataBinding` child, so the caller can
|
|
129
|
+
* persist it on the new node. Mirrors the headless `ensureContentNotBound`.
|
|
120
130
|
*/
|
|
121
131
|
function ensureContentNotBound(node, options) {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (!match) return { strippedRawPropertiesXml: void 0 };
|
|
132
|
+
const preserved = preservedOf(node);
|
|
133
|
+
const attrs = preservedSdtChild(preserved, "dataBinding");
|
|
134
|
+
if (attrs === void 0) return {};
|
|
126
135
|
if (!options.force) {
|
|
127
|
-
const attrs = match.groups?.["attrs"] ?? "";
|
|
128
136
|
const xpathMatch = /\bxpath="(?<xpath>[^"]*)"/iu.exec(attrs);
|
|
129
137
|
const storeMatch = /\bstoreItemID="(?<storeItemID>[^"]*)"/iu.exec(attrs);
|
|
130
138
|
const props = attrsToProperties(node);
|
|
@@ -136,7 +144,7 @@ function ensureContentNotBound(node, options) {
|
|
|
136
144
|
...props.alias !== void 0 ? { alias: props.alias } : {}
|
|
137
145
|
});
|
|
138
146
|
}
|
|
139
|
-
return {
|
|
147
|
+
return { _preserved: withoutPreservedSdtChild(preserved, "dataBinding") ?? null };
|
|
140
148
|
}
|
|
141
149
|
function paragraphFromText(schema, text) {
|
|
142
150
|
if (text.length === 0) return schema.node("paragraph", {}, []);
|
|
@@ -158,13 +166,13 @@ function setContentControlContentTr(state, filter, input, options = {}) {
|
|
|
158
166
|
const match = findBlockSdtMatch(state.doc, filter);
|
|
159
167
|
if (!match) return null;
|
|
160
168
|
ensureContentNotLocked(match.node, options);
|
|
161
|
-
const
|
|
169
|
+
const bindingOverride = ensureContentNotBound(match.node, options);
|
|
162
170
|
if (typeof input !== "string") throw new ContentControlTypeError({
|
|
163
171
|
message: "Block-content fill must go through `setContentControlContentBlocksTr` (avoids a schema/plugin import cycle); pass a string here.",
|
|
164
172
|
sdtType: match.node.attrs["sdtType"] ?? "richText",
|
|
165
173
|
reason: "PM-direct path takes string input only"
|
|
166
174
|
});
|
|
167
|
-
return replaceBlockSdtChildren(state, match, [paragraphFromText(state.schema, input)],
|
|
175
|
+
return replaceBlockSdtChildren(state, match, [paragraphFromText(state.schema, input)], bindingOverride);
|
|
168
176
|
}
|
|
169
177
|
/**
|
|
170
178
|
* Internal helper for the block-content fill variant. Lives in this module
|
|
@@ -176,15 +184,13 @@ function replaceBlockSdtChildrenForFill(state, filter, children, options = {}) {
|
|
|
176
184
|
const match = findBlockSdtMatch(state.doc, filter);
|
|
177
185
|
if (!match) return null;
|
|
178
186
|
ensureContentNotLocked(match.node, options);
|
|
179
|
-
|
|
180
|
-
return replaceBlockSdtChildren(state, match, children, strippedRawPropertiesXml !== void 0 ? { rawPropertiesXml: strippedRawPropertiesXml } : {});
|
|
187
|
+
return replaceBlockSdtChildren(state, match, children, ensureContentNotBound(match.node, options));
|
|
181
188
|
}
|
|
182
189
|
function setContentControlValueTr(state, filter, input, options = {}) {
|
|
183
190
|
const match = findBlockSdtMatch(state.doc, filter);
|
|
184
191
|
if (!match) return null;
|
|
185
192
|
ensureContentNotLocked(match.node, options);
|
|
186
|
-
const
|
|
187
|
-
const bindingOverride = strippedRawPropertiesXml !== void 0 ? { rawPropertiesXml: strippedRawPropertiesXml } : {};
|
|
193
|
+
const bindingOverride = ensureContentNotBound(match.node, options);
|
|
188
194
|
const sdtType = match.node.attrs["sdtType"];
|
|
189
195
|
if (input.kind === "dropdown") {
|
|
190
196
|
if (sdtType !== "dropdown" && sdtType !== "comboBox") throw new ContentControlTypeError({
|
|
@@ -221,7 +227,7 @@ function setContentControlValueTr(state, filter, input, options = {}) {
|
|
|
221
227
|
sdtType,
|
|
222
228
|
reason: "kind=checkbox requires sdtType=checkbox"
|
|
223
229
|
});
|
|
224
|
-
const display = checkboxDisplayContent(
|
|
230
|
+
const display = checkboxDisplayContent(preservedSdtChild(preservedOf(match.node), "checkbox"), input.checked);
|
|
225
231
|
let content = display.type === "symbol" ? state.schema.node("symbol", {
|
|
226
232
|
font: display.font,
|
|
227
233
|
char: display.char
|
|
@@ -278,8 +284,7 @@ function parseSdtDate(iso) {
|
|
|
278
284
|
return Number.isNaN(parsed.getTime()) ? null : parsed;
|
|
279
285
|
}
|
|
280
286
|
function isRepeatingSection(node) {
|
|
281
|
-
|
|
282
|
-
return typeof raw === "string" && /<\w+:repeatingSection\b/u.test(raw);
|
|
287
|
+
return preservedSdtChild(preservedOf(node), "repeatingSection") !== void 0;
|
|
283
288
|
}
|
|
284
289
|
function removeContentControlTr(state, filter, options = {}) {
|
|
285
290
|
const match = findBlockSdtMatch(state.doc, filter);
|
|
@@ -26,7 +26,7 @@ type ImagePropertiesInput = {
|
|
|
26
26
|
};
|
|
27
27
|
type ImageTransformAction = "rotateCW" | "rotateCCW" | "flipH" | "flipV";
|
|
28
28
|
type ResolvedImageWrap = {
|
|
29
|
-
wrapType: ImageAttrs["wrapType"]
|
|
29
|
+
wrapType: NonNullable<ImageAttrs["wrapType"]>;
|
|
30
30
|
displayMode: ImageAttrs["displayMode"];
|
|
31
31
|
cssFloat: ImageAttrs["cssFloat"];
|
|
32
32
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FOLIO_INSERTED_PICTURE_FRAME_LOCKS } from "../../docx/graphicFrameLocks.js";
|
|
2
|
+
import { wrapPolygonFor } from "../../docx/wrapPolygon.js";
|
|
2
3
|
import { IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES } from "../../types/documentEnumValues.js";
|
|
3
4
|
import { isSafeImageFile } from "../../utils/imageValidation.js";
|
|
4
5
|
import { sanitizeImageSrc } from "../../utils/sanitizeImageSrc.js";
|
|
@@ -128,10 +129,12 @@ const applyImageWrapType = (view, pos, wrapType) => {
|
|
|
128
129
|
if (!node) return false;
|
|
129
130
|
const resolved = resolveImageWrap(wrapType);
|
|
130
131
|
if (!resolved) return false;
|
|
132
|
+
const authoredPolygon = expectImageAttrs(node).wrapPolygon;
|
|
131
133
|
const tr = view.state.tr.setNodeMarkup(pos, void 0, mergeImageAttrs(node, {
|
|
132
134
|
wrapType: resolved.wrapType,
|
|
133
135
|
displayMode: resolved.displayMode,
|
|
134
|
-
cssFloat: resolved.cssFloat
|
|
136
|
+
cssFloat: resolved.cssFloat,
|
|
137
|
+
wrapPolygon: wrapPolygonFor(resolved.wrapType, authoredPolygon) ?? authoredPolygon
|
|
135
138
|
}));
|
|
136
139
|
view.dispatch(tr.scrollIntoView());
|
|
137
140
|
return true;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
|
+
import { SectionBreakType } from "../sectionCarrier.js";
|
|
2
3
|
import { GenerateTableOfContentsOptions, ResolvedStyleAttrs, getParagraphAlignment, getParagraphBidi, getParagraphTabs, getStyleId } from "../extensions/core/ParagraphExtension.js";
|
|
3
4
|
import { getListInfo, isInList } from "../extensions/features/ListExtension.js";
|
|
4
5
|
import { Command } from "prosemirror-state";
|
|
@@ -26,7 +27,7 @@ declare function setSpaceBefore(twips: number): Command;
|
|
|
26
27
|
declare function setSpaceAfter(twips: number): Command;
|
|
27
28
|
declare function applyStyle(styleId: string, resolvedAttrs?: ResolvedStyleAttrs): Command;
|
|
28
29
|
declare const clearStyle: Command;
|
|
29
|
-
declare function insertSectionBreak(breakType:
|
|
30
|
+
declare function insertSectionBreak(breakType: SectionBreakType): Command;
|
|
30
31
|
declare const removeSectionBreak: Command;
|
|
31
32
|
declare function addTabStop(position: number, alignment?: document_d_exports.TabStopAlignment, leader?: document_d_exports.TabLeader): Command;
|
|
32
33
|
declare function removeTabStop(position: number): Command;
|
|
@@ -32,9 +32,9 @@ declare const removeParagraphPropertyChanges: (changes: readonly ParagraphProper
|
|
|
32
32
|
* stored record resets to the schema default (`null`).
|
|
33
33
|
*
|
|
34
34
|
* Deliberately OUT of scope (preserved across a reject):
|
|
35
|
-
* - identity/structure: `paraId`, `textId`, `
|
|
36
|
-
* `
|
|
37
|
-
* `
|
|
35
|
+
* - identity/structure: `paraId`, `textId`, `_sectionProperties`,
|
|
36
|
+
* `_propertyChanges`, `pPrMark`, `bookmarks`, `_emptyHyperlinks`,
|
|
37
|
+
* `renderedPageBreakBefore`
|
|
38
38
|
* - paragraph-mark run properties — `pPr/rPr` is CT_PPr-only, not part of the
|
|
39
39
|
* CT_PPrBase payload a pPrChange stores: `defaultTextFormatting`,
|
|
40
40
|
* `runInWithNext` (`w:specVanish` lives in that rPr)
|
|
@@ -83,6 +83,14 @@ declare function sectionRejectProperties({ live, previousProperties, previousRef
|
|
|
83
83
|
* and is untouched.
|
|
84
84
|
*/
|
|
85
85
|
declare function tableRejectAttrPatch(previousFormatting: document_d_exports.TableFormatting | undefined): AttrPatch;
|
|
86
|
+
/**
|
|
87
|
+
* Attr patch for rejecting a `w:tblPrExChange`: the stored old `w:tblPrEx`
|
|
88
|
+
* wholesale. The exceptions ride the row node whole rather than as attrs (the
|
|
89
|
+
* editor surfaces none of the nine properties), so restoring the previous set
|
|
90
|
+
* is restoring that one attr — and a record with no stored set says the row
|
|
91
|
+
* overrode nothing, which is the element's absence, not an empty one.
|
|
92
|
+
*/
|
|
93
|
+
declare function tablePropertyExceptionsRejectAttrPatch(previousFormatting: document_d_exports.TablePropertyExceptionFormatting | undefined): AttrPatch;
|
|
86
94
|
/** Attr patch for rejecting a `w:trPrChange`: the stored old trPr wholesale. */
|
|
87
95
|
declare function tableRowRejectAttrPatch(previousFormatting: document_d_exports.TableRowFormatting | undefined): AttrPatch;
|
|
88
96
|
/**
|
|
@@ -96,4 +104,4 @@ declare function tableRowRejectAttrPatch(previousFormatting: document_d_exports.
|
|
|
96
104
|
*/
|
|
97
105
|
declare function tableCellRejectAttrPatch(previousFormatting: document_d_exports.TableCellFormatting | undefined, liveOriginalFormatting: document_d_exports.TableCellFormatting | null | undefined): AttrPatch;
|
|
98
106
|
//#endregion
|
|
99
|
-
export { PPR_CHANGE_SCOPED_ATTR_KEYS, ParagraphPropertyChangeRemoval, hasSerializableParagraphPropertyChange, paragraphPropertiesSnapshot, paragraphRejectAttrPatch, paragraphRejectOriginalFormatting, removeParagraphPropertyChanges, sectionRejectProperties, tableCellRejectAttrPatch, tableRejectAttrPatch, tableRowRejectAttrPatch };
|
|
107
|
+
export { PPR_CHANGE_SCOPED_ATTR_KEYS, ParagraphPropertyChangeRemoval, hasSerializableParagraphPropertyChange, paragraphPropertiesSnapshot, paragraphRejectAttrPatch, paragraphRejectOriginalFormatting, removeParagraphPropertyChanges, sectionRejectProperties, tableCellRejectAttrPatch, tablePropertyExceptionsRejectAttrPatch, tableRejectAttrPatch, tableRowRejectAttrPatch };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { expectParagraphAttrs } from "../attrs/index.js";
|
|
2
|
+
import { readParagraphNumberingAttr } from "../numberingAttr.js";
|
|
2
3
|
import { directParagraphAlignment } from "../paragraphAlignment.js";
|
|
3
4
|
import { directionFromBidi } from "../paragraphDirection.js";
|
|
4
5
|
import { directParagraphSpacing, paragraphSpacingAttrPatch, paragraphSpacingFromFormatting } from "../paragraphSpacing.js";
|
|
@@ -56,9 +57,9 @@ const removeParagraphPropertyChanges = (changes, shouldRemove) => {
|
|
|
56
57
|
* stored record resets to the schema default (`null`).
|
|
57
58
|
*
|
|
58
59
|
* Deliberately OUT of scope (preserved across a reject):
|
|
59
|
-
* - identity/structure: `paraId`, `textId`, `
|
|
60
|
-
* `
|
|
61
|
-
* `
|
|
60
|
+
* - identity/structure: `paraId`, `textId`, `_sectionProperties`,
|
|
61
|
+
* `_propertyChanges`, `pPrMark`, `bookmarks`, `_emptyHyperlinks`,
|
|
62
|
+
* `renderedPageBreakBefore`
|
|
62
63
|
* - paragraph-mark run properties — `pPr/rPr` is CT_PPr-only, not part of the
|
|
63
64
|
* CT_PPrBase payload a pPrChange stores: `defaultTextFormatting`,
|
|
64
65
|
* `runInWithNext` (`w:specVanish` lives in that rPr)
|
|
@@ -214,6 +215,9 @@ function paragraphRejectOriginalFormatting(previousFormatting, liveOriginal) {
|
|
|
214
215
|
const value = Object.hasOwn(prev, key) ? prev[key] : void 0;
|
|
215
216
|
if (value != null) Object.assign(result, { [key]: value });
|
|
216
217
|
}
|
|
218
|
+
const numbering = readParagraphNumberingAttr(prev.numPr);
|
|
219
|
+
if (numbering === null) Reflect.deleteProperty(result, "numPr");
|
|
220
|
+
else result.numPr = numbering;
|
|
217
221
|
const live = isRecord(liveOriginal) ? liveOriginal : {};
|
|
218
222
|
if (live["runProperties"] != null) Object.assign(result, { runProperties: live["runProperties"] });
|
|
219
223
|
if (live["runInWithNext"] != null) Object.assign(result, { runInWithNext: live["runInWithNext"] });
|
|
@@ -249,6 +253,16 @@ function tableRejectAttrPatch(previousFormatting) {
|
|
|
249
253
|
_originalFormatting: previousFormatting ?? null
|
|
250
254
|
};
|
|
251
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Attr patch for rejecting a `w:tblPrExChange`: the stored old `w:tblPrEx`
|
|
258
|
+
* wholesale. The exceptions ride the row node whole rather than as attrs (the
|
|
259
|
+
* editor surfaces none of the nine properties), so restoring the previous set
|
|
260
|
+
* is restoring that one attr — and a record with no stored set says the row
|
|
261
|
+
* overrode nothing, which is the element's absence, not an empty one.
|
|
262
|
+
*/
|
|
263
|
+
function tablePropertyExceptionsRejectAttrPatch(previousFormatting) {
|
|
264
|
+
return { _tablePropertyExceptions: previousFormatting ?? null };
|
|
265
|
+
}
|
|
252
266
|
/** Attr patch for rejecting a `w:trPrChange`: the stored old trPr wholesale. */
|
|
253
267
|
function tableRowRejectAttrPatch(previousFormatting) {
|
|
254
268
|
return {
|
|
@@ -277,6 +291,10 @@ function tableCellRejectAttrPatch(previousFormatting, liveOriginalFormatting) {
|
|
|
277
291
|
return {
|
|
278
292
|
width: previousFormatting?.width?.value ?? null,
|
|
279
293
|
widthType: previousFormatting?.width?.type ?? null,
|
|
294
|
+
_authoredWidth: previousFormatting?.width ? {
|
|
295
|
+
value: previousFormatting.width.value,
|
|
296
|
+
type: previousFormatting.width.type
|
|
297
|
+
} : null,
|
|
280
298
|
verticalAlign: previousFormatting?.verticalAlign ?? null,
|
|
281
299
|
backgroundColor: previousFormatting?.shading?.fill?.rgb ?? null,
|
|
282
300
|
textDirection: previousFormatting?.textDirection ?? null,
|
|
@@ -306,4 +324,4 @@ function isRecord(value) {
|
|
|
306
324
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
307
325
|
}
|
|
308
326
|
//#endregion
|
|
309
|
-
export { PPR_CHANGE_SCOPED_ATTR_KEYS, hasSerializableParagraphPropertyChange, paragraphPropertiesSnapshot, paragraphRejectAttrPatch, paragraphRejectOriginalFormatting, removeParagraphPropertyChanges, sectionRejectProperties, tableCellRejectAttrPatch, tableRejectAttrPatch, tableRowRejectAttrPatch };
|
|
327
|
+
export { PPR_CHANGE_SCOPED_ATTR_KEYS, hasSerializableParagraphPropertyChange, paragraphPropertiesSnapshot, paragraphRejectAttrPatch, paragraphRejectOriginalFormatting, removeParagraphPropertyChanges, sectionRejectProperties, tableCellRejectAttrPatch, tablePropertyExceptionsRejectAttrPatch, tableRejectAttrPatch, tableRowRejectAttrPatch };
|
|
@@ -1,5 +1,37 @@
|
|
|
1
|
+
import { SectionBreakType } from "../sectionCarrier.js";
|
|
1
2
|
import { Command } from "prosemirror-state";
|
|
2
3
|
//#region src/prosemirror/commands/sectionBreak.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Run a command, keeping every section break on the paragraph whose mark
|
|
6
|
+
* survived it.
|
|
7
|
+
*
|
|
8
|
+
* A section break is a property of a paragraph *mark*. The transfer is keyed on
|
|
9
|
+
* the mark's position surviving the transaction, not on which command ran, so
|
|
10
|
+
* deleting a section-ending paragraph outright still removes its section: that
|
|
11
|
+
* mark is gone, and nothing inherits it.
|
|
12
|
+
*/
|
|
13
|
+
declare const keepSectionBreaksOnSurvivingMarks: (command: Command) => Command;
|
|
14
|
+
/**
|
|
15
|
+
* End the selection's sections with `breakType`.
|
|
16
|
+
*
|
|
17
|
+
* A paragraph that already ends a section keeps its page size, margins,
|
|
18
|
+
* columns and header references and changes only `w:type` (§17.6.22), which is
|
|
19
|
+
* the one field the type names; a paragraph that ends none mints a record
|
|
20
|
+
* stating that type alone, and inherits the rest from the section that follows
|
|
21
|
+
* it.
|
|
22
|
+
*/
|
|
23
|
+
declare const setSectionBreakType: (breakType: SectionBreakType) => Command;
|
|
24
|
+
/**
|
|
25
|
+
* Remove the section break the selection's paragraphs carry.
|
|
26
|
+
*
|
|
27
|
+
* The record goes, and with it the section boundary: the paragraphs it
|
|
28
|
+
* governed become part of the section that follows, whose `w:sectPr` governs
|
|
29
|
+
* them from then on. That is Word's own rule for deleting a section break, and
|
|
30
|
+
* it is what §17.6.18 says a paragraph with no `w:sectPr` means — nothing has
|
|
31
|
+
* to be merged into the following record, because the following record already
|
|
32
|
+
* states the whole of the section it heads.
|
|
33
|
+
*/
|
|
34
|
+
declare const removeSectionBreakAtSelection: Command;
|
|
3
35
|
/**
|
|
4
36
|
* Insert a "next page" section break at the cursor — starts a new section on a
|
|
5
37
|
* new page.
|
|
@@ -11,4 +43,4 @@ declare const insertSectionBreakNextPage: Command;
|
|
|
11
43
|
*/
|
|
12
44
|
declare const insertSectionBreakContinuous: Command;
|
|
13
45
|
//#endregion
|
|
14
|
-
export { insertSectionBreakContinuous, insertSectionBreakNextPage };
|
|
46
|
+
export { insertSectionBreakContinuous, insertSectionBreakNextPage, keepSectionBreaksOnSurvivingMarks, removeSectionBreakAtSelection, setSectionBreakType };
|