@stll/folio-core 0.46.0 → 0.47.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.js +26 -24
- package/dist/ai-edits/headless.js +1 -1
- 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/content-alignment.js +108 -12
- 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.js +2 -1
- 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { onOffFromDataset } from "../../conversion/sdtAttrs.js";
|
|
1
2
|
import { createNodeExtension } from "../create.js";
|
|
2
3
|
//#region src/prosemirror/extensions/nodes/BlockSdtExtension.ts
|
|
3
4
|
/**
|
|
@@ -12,9 +13,10 @@ import { createNodeExtension } from "../create.js";
|
|
|
12
13
|
* - `sdtType` / `alias` / `tag` / `lock` / `placeholder` /
|
|
13
14
|
* `showingPlaceholder` / `dateFormat` / `listItems` / `checked` — modeled
|
|
14
15
|
* projection of `w:sdtPr`; drives addressing and widget UX.
|
|
15
|
-
* - `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* - `_preserved` — the `w:sdtPr` children folio does not model, at their
|
|
17
|
+
* schema ordinal, so `w:dataBinding`, `w15:repeatingSection` and the
|
|
18
|
+
* control-kind element round-trip without being enumerated here.
|
|
19
|
+
* - `rawEndPropertiesXml` — the verbatim `<w:sdtEndPr>`.
|
|
18
20
|
*/
|
|
19
21
|
const BlockSdtExtension = createNodeExtension({
|
|
20
22
|
name: "blockSdt",
|
|
@@ -31,7 +33,8 @@ const BlockSdtExtension = createNodeExtension({
|
|
|
31
33
|
id: { default: null },
|
|
32
34
|
lock: { default: null },
|
|
33
35
|
placeholder: { default: null },
|
|
34
|
-
|
|
36
|
+
/** `w:showingPlcHdr`: `null` when the control states nothing. */
|
|
37
|
+
showingPlaceholder: { default: null },
|
|
35
38
|
dateFormat: { default: null },
|
|
36
39
|
/** ISO 8601 bound date value (`w:date@w:fullDate`). */
|
|
37
40
|
dateValueISO: { default: null },
|
|
@@ -52,9 +55,14 @@ const BlockSdtExtension = createNodeExtension({
|
|
|
52
55
|
* `<w:sdtContent><w:p/></w:sdtContent>` empty-paragraph content too.
|
|
53
56
|
*/
|
|
54
57
|
_originallyEmpty: { default: false },
|
|
55
|
-
|
|
58
|
+
_preserved: { default: null },
|
|
56
59
|
rawEndPropertiesXml: { default: null },
|
|
57
60
|
/**
|
|
61
|
+
* `w:sdtEndPr` as a record, so a control the editor rebuilds still
|
|
62
|
+
* writes its end mark once the captured bytes are gone.
|
|
63
|
+
*/
|
|
64
|
+
endProperties: { default: null },
|
|
65
|
+
/**
|
|
58
66
|
* Verbatim XML for direct sdt siblings of sdtContent (range markers
|
|
59
67
|
* per MS-OE376 §2.5.2.30). Two slots so position is preserved.
|
|
60
68
|
*/
|
|
@@ -65,10 +73,6 @@ const BlockSdtExtension = createNodeExtension({
|
|
|
65
73
|
tag: "div.docx-block-sdt",
|
|
66
74
|
getAttrs(dom) {
|
|
67
75
|
if (!(dom instanceof HTMLElement)) return false;
|
|
68
|
-
const checkedRaw = dom.dataset["checked"];
|
|
69
|
-
let checked = null;
|
|
70
|
-
if (checkedRaw === "true") checked = true;
|
|
71
|
-
else if (checkedRaw === "false") checked = false;
|
|
72
76
|
const idRaw = dom.dataset["sdtId"];
|
|
73
77
|
const id = idRaw ? Number.parseInt(idRaw, 10) : null;
|
|
74
78
|
return {
|
|
@@ -78,15 +82,16 @@ const BlockSdtExtension = createNodeExtension({
|
|
|
78
82
|
id: id !== null && !Number.isNaN(id) ? id : null,
|
|
79
83
|
lock: dom.dataset["lock"] ?? null,
|
|
80
84
|
placeholder: dom.dataset["placeholder"] ?? null,
|
|
81
|
-
showingPlaceholder: dom.dataset["showingPlaceholder"]
|
|
85
|
+
showingPlaceholder: onOffFromDataset(dom.dataset["showingPlaceholder"]),
|
|
82
86
|
dateFormat: dom.dataset["dateFormat"] ?? null,
|
|
83
87
|
dateValueISO: dom.dataset["dateValueIso"] ?? null,
|
|
84
88
|
listItems: dom.dataset["listItems"] ?? null,
|
|
85
89
|
dropdownLastValue: dom.dataset["dropdownLastValue"] ?? null,
|
|
86
|
-
checked,
|
|
90
|
+
checked: onOffFromDataset(dom.dataset["checked"]),
|
|
87
91
|
_originallyEmpty: dom.dataset["originallyEmpty"] === "true",
|
|
88
|
-
|
|
92
|
+
_preserved: null,
|
|
89
93
|
rawEndPropertiesXml: null,
|
|
94
|
+
endProperties: null,
|
|
90
95
|
rawSdtChildrenBeforeContent: null,
|
|
91
96
|
rawSdtChildrenAfterContent: null
|
|
92
97
|
};
|
|
@@ -103,7 +108,7 @@ const BlockSdtExtension = createNodeExtension({
|
|
|
103
108
|
if (attrs["id"] !== null && attrs["id"] !== void 0) data["data-sdt-id"] = String(attrs["id"]);
|
|
104
109
|
if (attrs["lock"]) data["data-lock"] = String(attrs["lock"]);
|
|
105
110
|
if (attrs["placeholder"]) data["data-placeholder"] = String(attrs["placeholder"]);
|
|
106
|
-
if (attrs["showingPlaceholder"]) data["data-showing-placeholder"] = "
|
|
111
|
+
if (attrs["showingPlaceholder"] !== null && attrs["showingPlaceholder"] !== void 0) data["data-showing-placeholder"] = String(attrs["showingPlaceholder"]);
|
|
107
112
|
if (attrs["dateFormat"]) data["data-date-format"] = String(attrs["dateFormat"]);
|
|
108
113
|
if (attrs["dateValueISO"]) data["data-date-value-iso"] = String(attrs["dateValueISO"]);
|
|
109
114
|
if (attrs["listItems"]) data["data-list-items"] = String(attrs["listItems"]);
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { readParagraphAttrs } from "../../attrs/index.js";
|
|
2
|
-
import {
|
|
1
|
+
import { readParagraphAttrs, readTableAttrs, readTableRowAttrs } from "../../attrs/index.js";
|
|
2
|
+
import { readBookmarkBoundaryAttrs } from "../../bookmarkBoundaryAttrs.js";
|
|
3
3
|
import { findInvalidBookmarkBoundaryIds } from "../../bookmarkBoundaryIntegrity.js";
|
|
4
4
|
import { createNodeExtension } from "../create.js";
|
|
5
|
+
import { BLOCK_BOOKMARK_BOUNDARY_NODE_NAME } from "./BlockBookmarkBoundaryExtension.js";
|
|
6
|
+
import { bookmarkBoundaryAttrSpec, bookmarkBoundaryDomAttributes, parseBookmarkBoundaryDom } from "./bookmarkBoundaryDom.js";
|
|
5
7
|
import { Plugin } from "prosemirror-state";
|
|
6
8
|
//#region src/prosemirror/extensions/nodes/BookmarkBoundaryExtension.ts
|
|
7
|
-
function readNonnegativeInteger(value) {
|
|
8
|
-
if (value === null || !/^(?:0|[1-9]\d*)$/.test(value)) return false;
|
|
9
|
-
const parsed = Number(value);
|
|
10
|
-
return Number.isSafeInteger(parsed) ? parsed : false;
|
|
11
|
-
}
|
|
12
|
-
function readOptionalColumn(dom, attribute) {
|
|
13
|
-
const value = dom.getAttribute(attribute);
|
|
14
|
-
return value === null ? void 0 : readNonnegativeInteger(value);
|
|
15
|
-
}
|
|
16
9
|
/** The node name, for callers asking whether a paragraph holds any content. */
|
|
17
10
|
const BOOKMARK_BOUNDARY_NODE_NAME = "bookmarkBoundary";
|
|
11
|
+
/**
|
|
12
|
+
* Both boundary node types, because a bookmark pairs across them.
|
|
13
|
+
*
|
|
14
|
+
* A range that opens as a child of `w:body` and closes inside a paragraph is
|
|
15
|
+
* the commoner shape in real documents, so a pass that read one node type
|
|
16
|
+
* would see half of every such pair, call it unpaired, and delete it.
|
|
17
|
+
*/
|
|
18
|
+
const BOUNDARY_NODE_NAMES = /* @__PURE__ */ new Set([BOOKMARK_BOUNDARY_NODE_NAME, BLOCK_BOOKMARK_BOUNDARY_NODE_NAME]);
|
|
19
|
+
/** The markers a `table` or `tableRow` node carries, or none. */
|
|
20
|
+
const positionedBookmarksOf = (node) => {
|
|
21
|
+
const attrs = node.type.name === "table" ? readTableAttrs(node) : readTableRowAttrs(node);
|
|
22
|
+
return attrs.ok ? attrs.value._bookmarks ?? [] : [];
|
|
23
|
+
};
|
|
18
24
|
const collectInvalidBoundaries = (doc) => {
|
|
19
25
|
const boundaries = [];
|
|
20
26
|
const malformedBoundaries = [];
|
|
@@ -24,7 +30,13 @@ const collectInvalidBoundaries = (doc) => {
|
|
|
24
30
|
const attrs = readParagraphAttrs(node);
|
|
25
31
|
if (attrs.ok) for (const bookmark of attrs.value.bookmarks ?? []) paragraphBookmarkIds.add(bookmark.id);
|
|
26
32
|
}
|
|
27
|
-
if (node.type.name
|
|
33
|
+
if (node.type.name === "table" || node.type.name === "tableRow") for (const { marker } of positionedBookmarksOf(node)) boundaries.push({
|
|
34
|
+
id: marker.id,
|
|
35
|
+
type: marker.type === "bookmarkStart" ? "start" : "end",
|
|
36
|
+
position,
|
|
37
|
+
node
|
|
38
|
+
});
|
|
39
|
+
if (!BOUNDARY_NODE_NAMES.has(node.type.name)) return true;
|
|
28
40
|
const result = readBookmarkBoundaryAttrs(node);
|
|
29
41
|
if (!result.ok) {
|
|
30
42
|
malformedBoundaries.push({
|
|
@@ -44,7 +56,7 @@ const collectInvalidBoundaries = (doc) => {
|
|
|
44
56
|
return false;
|
|
45
57
|
});
|
|
46
58
|
const invalidIds = findInvalidBookmarkBoundaryIds(boundaries, paragraphBookmarkIds);
|
|
47
|
-
return [...boundaries.filter(({ id }) => invalidIds.has(id)), ...malformedBoundaries];
|
|
59
|
+
return [...boundaries.filter(({ id, node }) => invalidIds.has(id) && BOUNDARY_NODE_NAMES.has(node.type.name)), ...malformedBoundaries];
|
|
48
60
|
};
|
|
49
61
|
const BookmarkBoundaryExtension = createNodeExtension({
|
|
50
62
|
name: BOOKMARK_BOUNDARY_NODE_NAME,
|
|
@@ -55,50 +67,13 @@ const BookmarkBoundaryExtension = createNodeExtension({
|
|
|
55
67
|
marks: "_",
|
|
56
68
|
atom: true,
|
|
57
69
|
selectable: false,
|
|
58
|
-
attrs:
|
|
59
|
-
type: {},
|
|
60
|
-
id: {},
|
|
61
|
-
name: { default: null },
|
|
62
|
-
colFirst: { default: null },
|
|
63
|
-
colLast: { default: null },
|
|
64
|
-
displacedByCustomXml: { default: null }
|
|
65
|
-
},
|
|
70
|
+
attrs: bookmarkBoundaryAttrSpec,
|
|
66
71
|
parseDOM: [{
|
|
67
72
|
tag: "span[data-docx-bookmark-boundary]",
|
|
68
|
-
getAttrs
|
|
69
|
-
const type = dom.getAttribute("data-docx-bookmark-boundary");
|
|
70
|
-
const id = readNonnegativeInteger(dom.getAttribute("data-docx-bookmark-id"));
|
|
71
|
-
if (type !== "start" && type !== "end" || id === false) return false;
|
|
72
|
-
const name = dom.getAttribute("data-docx-bookmark-name");
|
|
73
|
-
if (type === "start" && !name) return false;
|
|
74
|
-
const colFirst = readOptionalColumn(dom, "data-docx-bookmark-col-first");
|
|
75
|
-
const colLast = readOptionalColumn(dom, "data-docx-bookmark-col-last");
|
|
76
|
-
if (colFirst === false || colLast === false) return false;
|
|
77
|
-
const displaced = dom.getAttribute("data-docx-bookmark-displaced");
|
|
78
|
-
return {
|
|
79
|
-
type,
|
|
80
|
-
id,
|
|
81
|
-
...name ? { name } : {},
|
|
82
|
-
...colFirst !== void 0 ? { colFirst } : {},
|
|
83
|
-
...colLast !== void 0 ? { colLast } : {},
|
|
84
|
-
...isDisplacedByCustomXml(displaced) ? { displacedByCustomXml: displaced } : {}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
73
|
+
getAttrs: parseBookmarkBoundaryDom
|
|
87
74
|
}],
|
|
88
75
|
toDOM(node) {
|
|
89
|
-
|
|
90
|
-
return ["span", {
|
|
91
|
-
"data-docx-bookmark-boundary": attrs.type,
|
|
92
|
-
"data-docx-bookmark-id": String(attrs.id),
|
|
93
|
-
...attrs.type === "start" ? { "data-docx-bookmark-name": attrs.name } : {},
|
|
94
|
-
...attrs.type === "start" && attrs.colFirst !== void 0 ? { "data-docx-bookmark-col-first": String(attrs.colFirst) } : {},
|
|
95
|
-
...attrs.type === "start" && attrs.colLast !== void 0 ? { "data-docx-bookmark-col-last": String(attrs.colLast) } : {},
|
|
96
|
-
...attrs.displacedByCustomXml !== void 0 ? { "data-docx-bookmark-displaced": attrs.displacedByCustomXml } : {},
|
|
97
|
-
"aria-hidden": "true",
|
|
98
|
-
contenteditable: "false",
|
|
99
|
-
style: "display: none;",
|
|
100
|
-
...options.getInternalClipboardToken ? { "data-docx-internal-clipboard": options.getInternalClipboardToken() } : {}
|
|
101
|
-
}];
|
|
76
|
+
return ["span", bookmarkBoundaryDomAttributes(node, options.getInternalClipboardToken?.())];
|
|
102
77
|
}
|
|
103
78
|
}),
|
|
104
79
|
onSchemaReady: () => ({ plugins: [new Plugin({ appendTransaction(transactions, _oldState, newState) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { readCommentReferenceAttrs } from "../../commentReferenceAttrs.js";
|
|
2
2
|
import { planCommentReferenceRepairs } from "../../commentReferenceIntegrity.js";
|
|
3
|
+
import { readRangeAnchorAttrs } from "../../rangeAnchorAttrs.js";
|
|
3
4
|
import { createNodeExtension } from "../create.js";
|
|
5
|
+
import "./RangeAnchorExtension.js";
|
|
4
6
|
import { Plugin } from "prosemirror-state";
|
|
5
7
|
//#region src/prosemirror/extensions/nodes/CommentReferenceExtension.ts
|
|
6
8
|
/** The node name, for callers asking whether a paragraph holds any content. */
|
|
@@ -19,6 +21,14 @@ const surveyCommentReferences = (doc) => {
|
|
|
19
21
|
});
|
|
20
22
|
return false;
|
|
21
23
|
}
|
|
24
|
+
if (node.type.name === "rangeAnchor") {
|
|
25
|
+
const attrs = readRangeAnchorAttrs(node);
|
|
26
|
+
if (attrs.ok && attrs.value.start.type === "commentRangeStart") {
|
|
27
|
+
const { id } = attrs.value.start;
|
|
28
|
+
markEnds.set(id, Math.max(markEnds.get(id) ?? 0, position + node.nodeSize));
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
22
32
|
if (!node.isInline) return true;
|
|
23
33
|
for (const mark of node.marks) {
|
|
24
34
|
if (mark.type.name !== "comment") continue;
|
|
@@ -15,6 +15,7 @@ const ImageExtension = createNodeExtension({
|
|
|
15
15
|
draggable: true,
|
|
16
16
|
attrs: {
|
|
17
17
|
src: {},
|
|
18
|
+
preview: { default: null },
|
|
18
19
|
docPrName: { default: null },
|
|
19
20
|
alt: { default: null },
|
|
20
21
|
title: { default: null },
|
|
@@ -44,7 +45,10 @@ const ImageExtension = createNodeExtension({
|
|
|
44
45
|
paddingBottom: { default: null },
|
|
45
46
|
paddingLeft: { default: null },
|
|
46
47
|
position: { default: null },
|
|
47
|
-
|
|
48
|
+
anchor: { default: null },
|
|
49
|
+
wrapDistanceSlots: { default: null },
|
|
50
|
+
wrapEffectExtentSlots: { default: null },
|
|
51
|
+
wrapPolygon: { default: null },
|
|
48
52
|
decorative: { default: null },
|
|
49
53
|
hidden: { default: null },
|
|
50
54
|
docPrExtensions: { default: null },
|
|
@@ -56,6 +60,9 @@ const ImageExtension = createNodeExtension({
|
|
|
56
60
|
wrapText: { default: null },
|
|
57
61
|
hlinkHref: { default: null },
|
|
58
62
|
hlinkRId: { default: null },
|
|
63
|
+
hlinkClickSource: { default: null },
|
|
64
|
+
hlinkHoverXml: { default: null },
|
|
65
|
+
docPrId: { default: null },
|
|
59
66
|
_docxRawXml: { default: null },
|
|
60
67
|
_docxRawXmlMode: { default: null },
|
|
61
68
|
_docxRawImageFingerprint: { default: null },
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeExtension } from "../types.js";
|
|
2
|
+
//#region src/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.d.ts
|
|
3
|
+
/** Hidden boundary for one non-empty tracked-move range. */
|
|
4
|
+
type MoveRangeBoundaryOptions = {
|
|
5
|
+
getInternalClipboardToken?: () => string;
|
|
6
|
+
};
|
|
7
|
+
declare const MOVE_RANGE_BOUNDARY_NODE_NAME = "moveRangeBoundary";
|
|
8
|
+
declare const MOVE_RANGE_BOUNDARY_DOM_ATTRIBUTE = "data-docx-move-range-boundary";
|
|
9
|
+
declare const MoveRangeBoundaryExtension: (options?: Partial<MoveRangeBoundaryOptions> | undefined) => NodeExtension;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { MOVE_RANGE_BOUNDARY_DOM_ATTRIBUTE, MOVE_RANGE_BOUNDARY_NODE_NAME, MoveRangeBoundaryExtension };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { expectMoveRangeBoundaryAttrs, readMoveRangeMarker } from "../../moveRangeBoundaryAttrs.js";
|
|
2
|
+
import { createNodeExtension } from "../create.js";
|
|
3
|
+
//#region src/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.ts
|
|
4
|
+
/** Hidden boundary for one non-empty tracked-move range. */
|
|
5
|
+
const MOVE_RANGE_BOUNDARY_NODE_NAME = "moveRangeBoundary";
|
|
6
|
+
const MOVE_RANGE_BOUNDARY_DOM_ATTRIBUTE = "data-docx-move-range-boundary";
|
|
7
|
+
const MoveRangeBoundaryExtension = createNodeExtension({
|
|
8
|
+
name: MOVE_RANGE_BOUNDARY_NODE_NAME,
|
|
9
|
+
schemaNodeName: MOVE_RANGE_BOUNDARY_NODE_NAME,
|
|
10
|
+
nodeSpec: (options) => ({
|
|
11
|
+
inline: true,
|
|
12
|
+
group: "inline",
|
|
13
|
+
marks: "_",
|
|
14
|
+
atom: true,
|
|
15
|
+
selectable: false,
|
|
16
|
+
attrs: { marker: {} },
|
|
17
|
+
parseDOM: [{
|
|
18
|
+
tag: `span[${MOVE_RANGE_BOUNDARY_DOM_ATTRIBUTE}]`,
|
|
19
|
+
getAttrs(dom) {
|
|
20
|
+
const raw = dom.getAttribute(MOVE_RANGE_BOUNDARY_DOM_ATTRIBUTE);
|
|
21
|
+
if (raw === null) return false;
|
|
22
|
+
try {
|
|
23
|
+
const result = readMoveRangeMarker(JSON.parse(raw));
|
|
24
|
+
return result.ok ? { marker: result.value } : false;
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}],
|
|
30
|
+
toDOM(node) {
|
|
31
|
+
const marker = expectMoveRangeBoundaryAttrs(node);
|
|
32
|
+
return ["span", {
|
|
33
|
+
[MOVE_RANGE_BOUNDARY_DOM_ATTRIBUTE]: JSON.stringify(marker),
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
contenteditable: "false",
|
|
36
|
+
style: "display: none;",
|
|
37
|
+
...options.getInternalClipboardToken ? { "data-docx-internal-clipboard": options.getInternalClipboardToken() } : {}
|
|
38
|
+
}];
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
//#endregion
|
|
43
|
+
export { MOVE_RANGE_BOUNDARY_DOM_ATTRIBUTE, MOVE_RANGE_BOUNDARY_NODE_NAME, MoveRangeBoundaryExtension };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NodeExtension } from "../types.js";
|
|
2
|
+
//#region src/prosemirror/extensions/nodes/RangeAnchorExtension.d.ts
|
|
3
|
+
/** Zero-width comment or tracked-move range that spans no content. */
|
|
4
|
+
type RangeAnchorOptions = {
|
|
5
|
+
getInternalClipboardToken?: () => string;
|
|
6
|
+
};
|
|
7
|
+
/** The node name, for callers asking whether a paragraph holds any content. */
|
|
8
|
+
declare const RANGE_ANCHOR_NODE_NAME = "rangeAnchor";
|
|
9
|
+
/** The attribute the DOM spelling carries both markers in. */
|
|
10
|
+
declare const RANGE_ANCHOR_DOM_ATTRIBUTE = "data-docx-range-anchor";
|
|
11
|
+
declare const RangeAnchorExtension: (options?: Partial<RangeAnchorOptions> | undefined) => NodeExtension;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { RANGE_ANCHOR_DOM_ATTRIBUTE, RANGE_ANCHOR_NODE_NAME, RangeAnchorExtension };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { readRangeAnchorAttrs, readRangeAnchorValues } from "../../rangeAnchorAttrs.js";
|
|
2
|
+
import { createNodeExtension } from "../create.js";
|
|
3
|
+
//#region src/prosemirror/extensions/nodes/RangeAnchorExtension.ts
|
|
4
|
+
/** Zero-width comment or tracked-move range that spans no content. */
|
|
5
|
+
/** The node name, for callers asking whether a paragraph holds any content. */
|
|
6
|
+
const RANGE_ANCHOR_NODE_NAME = "rangeAnchor";
|
|
7
|
+
/** The attribute the DOM spelling carries both markers in. */
|
|
8
|
+
const RANGE_ANCHOR_DOM_ATTRIBUTE = "data-docx-range-anchor";
|
|
9
|
+
const RangeAnchorExtension = createNodeExtension({
|
|
10
|
+
name: RANGE_ANCHOR_NODE_NAME,
|
|
11
|
+
schemaNodeName: RANGE_ANCHOR_NODE_NAME,
|
|
12
|
+
nodeSpec: (options) => ({
|
|
13
|
+
inline: true,
|
|
14
|
+
group: "inline",
|
|
15
|
+
marks: "_",
|
|
16
|
+
atom: true,
|
|
17
|
+
selectable: false,
|
|
18
|
+
attrs: {
|
|
19
|
+
start: {},
|
|
20
|
+
end: {}
|
|
21
|
+
},
|
|
22
|
+
parseDOM: [{
|
|
23
|
+
tag: `span[${RANGE_ANCHOR_DOM_ATTRIBUTE}]`,
|
|
24
|
+
getAttrs(dom) {
|
|
25
|
+
const raw = dom.getAttribute(RANGE_ANCHOR_DOM_ATTRIBUTE);
|
|
26
|
+
if (raw === null) return false;
|
|
27
|
+
const parsed = parseMarkers(raw);
|
|
28
|
+
if (parsed === null) return false;
|
|
29
|
+
const result = readRangeAnchorValues(parsed.start, parsed.end);
|
|
30
|
+
return result.ok ? result.value : false;
|
|
31
|
+
}
|
|
32
|
+
}],
|
|
33
|
+
toDOM(node) {
|
|
34
|
+
const attrs = readRangeAnchorAttrs(node);
|
|
35
|
+
return ["span", {
|
|
36
|
+
[RANGE_ANCHOR_DOM_ATTRIBUTE]: attrs.ok ? JSON.stringify(attrs.value) : "",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
contenteditable: "false",
|
|
39
|
+
style: "display: none;",
|
|
40
|
+
...options.getInternalClipboardToken ? { "data-docx-internal-clipboard": options.getInternalClipboardToken() } : {}
|
|
41
|
+
}];
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* The attribute back as an attrs bag, or `null` when it is not one.
|
|
47
|
+
*
|
|
48
|
+
* `JSON.parse` throws on malformed input reaching the schema from a paste, and
|
|
49
|
+
* a parser branch that refuses the node is the boundary this belongs at.
|
|
50
|
+
*/
|
|
51
|
+
const parseMarkers = (raw) => {
|
|
52
|
+
try {
|
|
53
|
+
const parsed = JSON.parse(raw);
|
|
54
|
+
if (typeof parsed !== "object" || parsed === null) return null;
|
|
55
|
+
if (!("start" in parsed) || !("end" in parsed)) return null;
|
|
56
|
+
return {
|
|
57
|
+
start: parsed.start,
|
|
58
|
+
end: parsed.end
|
|
59
|
+
};
|
|
60
|
+
} catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { RANGE_ANCHOR_DOM_ATTRIBUTE, RANGE_ANCHOR_NODE_NAME, RangeAnchorExtension };
|
|
@@ -6,6 +6,8 @@ import { NodeExtension } from "../types.js";
|
|
|
6
6
|
* Represents OOXML inline SDTs as an inline node wrapping text content.
|
|
7
7
|
* Supports: richText, plainText, date, dropdown, comboBox, checkbox.
|
|
8
8
|
*/
|
|
9
|
+
/** The editor's node for an inline `w:sdt`. */
|
|
10
|
+
declare const INLINE_CONTENT_CONTROL_NODE_NAME = "sdt";
|
|
9
11
|
declare const SdtExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension;
|
|
10
12
|
//#endregion
|
|
11
|
-
export { SdtExtension };
|
|
13
|
+
export { INLINE_CONTENT_CONTROL_NODE_NAME, SdtExtension };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { expectSdtAttrs } from "../../attrs/index.js";
|
|
2
|
+
import { onOffFromDataset } from "../../conversion/sdtAttrs.js";
|
|
2
3
|
import { createNodeExtension } from "../create.js";
|
|
3
4
|
//#region src/prosemirror/extensions/nodes/SdtExtension.ts
|
|
4
5
|
/**
|
|
@@ -7,6 +8,8 @@ import { createNodeExtension } from "../create.js";
|
|
|
7
8
|
* Represents OOXML inline SDTs as an inline node wrapping text content.
|
|
8
9
|
* Supports: richText, plainText, date, dropdown, comboBox, checkbox.
|
|
9
10
|
*/
|
|
11
|
+
/** The editor's node for an inline `w:sdt`. */
|
|
12
|
+
const INLINE_CONTENT_CONTROL_NODE_NAME = "sdt";
|
|
10
13
|
const SdtExtension = createNodeExtension({
|
|
11
14
|
name: "sdt",
|
|
12
15
|
schemaNodeName: "sdt",
|
|
@@ -28,7 +31,8 @@ const SdtExtension = createNodeExtension({
|
|
|
28
31
|
/** Placeholder text */
|
|
29
32
|
placeholder: { default: null },
|
|
30
33
|
/** Whether showing placeholder */
|
|
31
|
-
|
|
34
|
+
/** `w:showingPlcHdr`: `null` when the control states nothing. */
|
|
35
|
+
showingPlaceholder: { default: null },
|
|
32
36
|
/** Date format for date controls */
|
|
33
37
|
dateFormat: { default: null },
|
|
34
38
|
/** ISO 8601 bound date value (`w:date@w:fullDate`). */
|
|
@@ -40,12 +44,17 @@ const SdtExtension = createNodeExtension({
|
|
|
40
44
|
/** Checkbox checked state */
|
|
41
45
|
checked: { default: null },
|
|
42
46
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
47
|
+
* The `w:sdtPr` children folio does not model, at their schema ordinal,
|
|
48
|
+
* and the verbatim `<w:sdtEndPr>` the parser captured, so a control keeps
|
|
49
|
+
* what it carries after a save. Mirrors the block-SDT node.
|
|
46
50
|
*/
|
|
47
|
-
|
|
48
|
-
rawEndPropertiesXml: { default: null }
|
|
51
|
+
_preserved: { default: null },
|
|
52
|
+
rawEndPropertiesXml: { default: null },
|
|
53
|
+
/**
|
|
54
|
+
* `w:sdtEndPr` as a record, so a control the editor rebuilds still
|
|
55
|
+
* writes its end mark once the captured bytes are gone.
|
|
56
|
+
*/
|
|
57
|
+
endProperties: { default: null }
|
|
49
58
|
},
|
|
50
59
|
parseDOM: [{
|
|
51
60
|
tag: "span.docx-sdt",
|
|
@@ -61,18 +70,15 @@ const SdtExtension = createNodeExtension({
|
|
|
61
70
|
id: id !== null && !Number.isNaN(id) ? id : null,
|
|
62
71
|
lock: el.dataset["lock"] || null,
|
|
63
72
|
placeholder: el.dataset["placeholder"] || null,
|
|
64
|
-
showingPlaceholder: el.dataset["showingPlaceholder"]
|
|
73
|
+
showingPlaceholder: onOffFromDataset(el.dataset["showingPlaceholder"]),
|
|
65
74
|
dateFormat: el.dataset["dateFormat"] || null,
|
|
66
75
|
dateValueISO: el.dataset["dateValueIso"] || null,
|
|
67
76
|
listItems: el.dataset["listItems"] || null,
|
|
68
77
|
dropdownLastValue: el.dataset["dropdownLastValue"] || null,
|
|
69
|
-
checked: (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
})(),
|
|
74
|
-
rawPropertiesXml: null,
|
|
75
|
-
rawEndPropertiesXml: null
|
|
78
|
+
checked: onOffFromDataset(el.dataset["checked"]),
|
|
79
|
+
_preserved: null,
|
|
80
|
+
rawEndPropertiesXml: null,
|
|
81
|
+
endProperties: null
|
|
76
82
|
};
|
|
77
83
|
}
|
|
78
84
|
}],
|
|
@@ -87,7 +93,7 @@ const SdtExtension = createNodeExtension({
|
|
|
87
93
|
if (typeof attrs.id === "number") dataAttrs["data-sdt-id"] = String(attrs.id);
|
|
88
94
|
if (attrs.lock) dataAttrs["data-lock"] = attrs.lock;
|
|
89
95
|
if (attrs.placeholder) dataAttrs["data-placeholder"] = attrs.placeholder;
|
|
90
|
-
if (attrs.showingPlaceholder) dataAttrs["data-showing-placeholder"] =
|
|
96
|
+
if (attrs.showingPlaceholder !== null && attrs.showingPlaceholder !== void 0) dataAttrs["data-showing-placeholder"] = String(attrs.showingPlaceholder);
|
|
91
97
|
if (attrs.dateFormat) dataAttrs["data-date-format"] = attrs.dateFormat;
|
|
92
98
|
if (attrs.dateValueISO) dataAttrs["data-date-value-iso"] = attrs.dateValueISO;
|
|
93
99
|
if (attrs.listItems) dataAttrs["data-list-items"] = attrs.listItems;
|
|
@@ -104,4 +110,4 @@ const SdtExtension = createNodeExtension({
|
|
|
104
110
|
}
|
|
105
111
|
});
|
|
106
112
|
//#endregion
|
|
107
|
-
export { SdtExtension };
|
|
113
|
+
export { INLINE_CONTENT_CONTROL_NODE_NAME, SdtExtension };
|
|
@@ -404,6 +404,10 @@ const ShapeExtension = createNodeExtension({
|
|
|
404
404
|
distLeft: { default: null },
|
|
405
405
|
distRight: { default: null },
|
|
406
406
|
position: { default: null },
|
|
407
|
+
anchor: { default: null },
|
|
408
|
+
wrapDistanceSlots: { default: null },
|
|
409
|
+
wrapEffectExtentSlots: { default: null },
|
|
410
|
+
wrapPolygon: { default: null },
|
|
407
411
|
shadowColor: { default: null },
|
|
408
412
|
shadowBlur: { default: null },
|
|
409
413
|
shadowOffsetX: { default: null },
|