@stll/folio-core 0.67.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.d.ts +9 -1
- package/dist/ai-edits/apply.js +94 -8
- package/dist/ai-edits/headless.d.ts +36 -21
- package/dist/ai-edits/headless.js +106 -36
- package/dist/ai-edits/index.d.ts +2 -2
- package/dist/ai-edits/newListNumbering.d.ts +14 -1
- package/dist/ai-edits/newListNumbering.js +24 -1
- package/dist/ai-edits/note-references.d.ts +6 -0
- package/dist/ai-edits/note-references.js +7 -1
- package/dist/ai-edits/pending-suggestions.js +2 -2
- package/dist/ai-edits/read.d.ts +19 -0
- package/dist/ai-edits/snapshot.d.ts +6 -0
- package/dist/ai-edits/snapshot.js +8 -3
- package/dist/ai-edits/types.d.ts +9 -1
- package/dist/ai-suggestions/apply.js +13 -4
- package/dist/compare/compare.js +2 -1
- package/dist/compare/inserted-resource-snapshot.d.ts +4 -1
- package/dist/compare/inserted-resource-snapshot.js +7 -3
- package/dist/controller/canonicalClipboard.js +31 -14
- package/dist/controller/canonicalComposition.js +35 -6
- package/dist/controller/canonicalInlineProjection.d.ts +35 -10
- package/dist/controller/canonicalInlineProjection.js +192 -28
- package/dist/controller/canonicalInput.d.ts +2 -1
- package/dist/controller/canonicalInput.js +32 -7
- package/dist/controller/canonicalListRendering.d.ts +2 -1
- package/dist/controller/canonicalListRendering.js +1 -1
- package/dist/controller/canonicalLockGuard.d.ts +23 -0
- package/dist/controller/canonicalLockGuard.js +133 -0
- package/dist/controller/canonicalProjectionBlocks.d.ts +79 -0
- package/dist/controller/canonicalProjectionBlocks.js +75 -0
- package/dist/controller/canonicalPublicOperations.d.ts +12 -4
- package/dist/controller/canonicalPublicOperations.js +676 -46
- package/dist/controller/canonicalSeedContent.d.ts +12 -0
- package/dist/controller/canonicalSeedContent.js +131 -0
- package/dist/controller/canonicalSession.d.ts +133 -21
- package/dist/controller/canonicalSession.js +738 -205
- package/dist/controller/canonicalSourceNormalization.d.ts +21 -0
- package/dist/controller/canonicalSourceNormalization.js +148 -0
- package/dist/controller/canonicalStoryEditor.d.ts +4 -3
- package/dist/controller/canonicalStoryEditor.js +20 -15
- package/dist/controller/canonicalStructure.d.ts +2 -1
- package/dist/controller/canonicalStructure.js +129 -7
- package/dist/controller/contentControlWidgetController.d.ts +5 -0
- package/dist/controller/contentControlWidgetController.js +13 -1
- package/dist/controller/folioEditor.js +4 -0
- package/dist/controller/headerFooterEditorManager.d.ts +7 -2
- package/dist/controller/headerFooterEditorManager.js +11 -6
- package/dist/controller/hiddenEditorApi.d.ts +17 -2
- package/dist/controller/hiddenEditorApi.js +4 -0
- package/dist/controller/hiddenEditorManager.d.ts +11 -3
- package/dist/controller/hiddenEditorManager.js +157 -48
- package/dist/controller/layoutPipeline.js +50 -16
- package/dist/controller/layoutSession.d.ts +3 -0
- package/dist/controller/layoutSession.js +3 -1
- package/dist/controller/noteEditorManager.d.ts +7 -2
- package/dist/controller/noteEditorManager.js +11 -6
- package/dist/display-list/build/pageFurniture.js +41 -19
- package/dist/display-list/build/tablePrimitives.js +23 -4
- package/dist/display-list/dom/renderDisplayListToDom.js +13 -11
- package/dist/document-operations.d.ts +9 -1
- package/dist/document-operations.js +4 -3
- package/dist/docx/blockContentParser.d.ts +7 -3
- package/dist/docx/blockContentParser.js +2 -3
- package/dist/docx/blockPlainText.js +2 -0
- package/dist/docx/bookmarkRangeJoin.d.ts +6 -0
- package/dist/docx/bookmarkRangeJoin.js +43 -0
- package/dist/docx/canonicalSave.js +11 -2
- package/dist/docx/canonicalSessionInput.d.ts +5 -1
- package/dist/docx/canonicalSessionInput.js +7 -2
- package/dist/docx/commentAnchorIndex.d.ts +40 -5
- package/dist/docx/commentAnchorIndex.js +94 -12
- package/dist/docx/commentRangeIntegrity.js +30 -24
- package/dist/docx/commentRangeJoin.d.ts +4 -0
- package/dist/docx/commentRangeJoin.js +26 -12
- package/dist/docx/commentReferenceCompletion.js +5 -4
- package/dist/docx/commentReferenceNormalization.js +40 -18
- package/dist/docx/compatibility.js +9 -2
- package/dist/docx/containerChildren.js +22 -1
- package/dist/docx/contentTypeRegistry.js +1 -1
- package/dist/docx/encryption/compoundFile.js +9 -1
- package/dist/docx/encryption/encryptionInfo.js +16 -2
- package/dist/docx/ensureParaIds.js +46 -7
- package/dist/docx/ensureUniqueControlIds.d.ts +25 -0
- package/dist/docx/ensureUniqueControlIds.js +110 -0
- package/dist/docx/headerFooterVerbatim.d.ts +7 -0
- package/dist/docx/headerFooterVerbatim.js +13 -2
- package/dist/docx/hostCommentThreads.d.ts +27 -0
- package/dist/docx/hostCommentThreads.js +72 -0
- package/dist/docx/hyperlinkParser.js +9 -2
- package/dist/docx/inlineWrapperContent.d.ts +8 -1
- package/dist/docx/inlineWrapperContent.js +9 -2
- package/dist/docx/listMarkerComputation.d.ts +35 -1
- package/dist/docx/listMarkerComputation.js +39 -1
- package/dist/docx/listModelNormalization.d.ts +44 -1
- package/dist/docx/listModelNormalization.js +226 -96
- package/dist/docx/listNumberingInstances.d.ts +1 -1
- package/dist/docx/listNumberingInstances.js +2 -2
- package/dist/docx/markupRangeMarker.d.ts +14 -0
- package/dist/docx/markupRangeMarker.js +15 -1
- package/dist/docx/metadataPrivacy.js +43 -22
- package/dist/docx/normalizeBaseDirection.js +3 -1
- package/dist/docx/numberingIds.d.ts +6 -0
- package/dist/docx/numberingIds.js +6 -1
- package/dist/docx/numberingReferenceNormalization.d.ts +4 -0
- package/dist/docx/numberingReferenceNormalization.js +12 -2
- package/dist/docx/paragraphParser.js +159 -48
- package/dist/docx/paragraphPropertySource.d.ts +29 -0
- package/dist/docx/paragraphPropertySource.js +106 -16
- package/dist/docx/paragraphTextBoxEnrichment.js +2 -1
- package/dist/docx/paragraphTraversal.js +2 -0
- package/dist/docx/parseWarningMessage.js +2 -1
- package/dist/docx/parser.js +8 -0
- package/dist/docx/removeHeaderFooterParts.js +1 -1
- package/dist/docx/renderedPageBreakNormalization.js +1 -1
- package/dist/docx/reviewProvenanceDiagnostics.d.ts +7 -0
- package/dist/docx/reviewProvenanceDiagnostics.js +39 -0
- package/dist/docx/reviewResolutionProvenance.d.ts +29 -3
- package/dist/docx/reviewResolutionProvenance.js +171 -33
- package/dist/docx/rezip.d.ts +6 -0
- package/dist/docx/rezip.js +38 -21
- package/dist/docx/selectiveSave.js +6 -10
- package/dist/docx/selectiveXmlPatch.d.ts +5 -4
- package/dist/docx/selectiveXmlPatch.js +11 -7
- package/dist/docx/serializer/documentSerializer.js +5 -2
- package/dist/docx/serializer/headerFooterSerializer.js +3 -1
- package/dist/docx/serializer/markupRangeAttributes.d.ts +6 -1
- package/dist/docx/serializer/markupRangeAttributes.js +6 -1
- package/dist/docx/serializer/noteSerializer.d.ts +17 -4
- package/dist/docx/serializer/noteSerializer.js +23 -16
- package/dist/docx/serializer/paragraphSerializer.js +56 -12
- package/dist/docx/serializer/partNamespaces.d.ts +1 -1
- package/dist/docx/serializer/partNamespaces.js +1 -1
- package/dist/docx/serializer/runSerializer.d.ts +1 -3
- package/dist/docx/serializer/runSerializer.js +2 -2
- package/dist/docx/serializer/tableSerializer.d.ts +4 -0
- package/dist/docx/serializer/tableSerializer.js +4 -2
- package/dist/docx/server/applyDocxXmlPatchProposal.js +8 -4
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/docx/server/createBilingualDocument.js +27 -5
- package/dist/docx/server/migrateYjsAttrSchema.js +4 -0
- package/dist/docx/sessionListPruning.d.ts +2 -0
- package/dist/docx/sessionListPruning.js +50 -0
- package/dist/docx/splitRevisionPieces.d.ts +10 -0
- package/dist/docx/splitRevisionPieces.js +14 -0
- package/dist/docx/storyBlockReplay.js +19 -2
- package/dist/docx/structuralXmlPatch.js +44 -11
- package/dist/docx/tableParser.d.ts +6 -2
- package/dist/docx/tableParser.js +2 -3
- package/dist/docx/textBoxContentParser.d.ts +11 -0
- package/dist/docx/textBoxContentParser.js +51 -0
- package/dist/docx/textBoxParser.d.ts +0 -5
- package/dist/docx/textBoxParser.js +1 -23
- package/dist/docx/verticalMergeProjection.js +1 -1
- package/dist/docx/xmlParser.d.ts +1 -1
- package/dist/docx/xmlParser.js +2 -3
- package/dist/fonts/fontsourceFaces.d.ts +2 -8
- package/dist/fonts/fontsourceFaces.js +1 -7
- package/dist/i18n/messages/ar.gen.js +3 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +51 -0
- package/dist/i18n/messages/catalogs.gen.js +51 -0
- package/dist/i18n/messages/cs.gen.js +3 -0
- package/dist/i18n/messages/de.gen.js +3 -0
- package/dist/i18n/messages/en.gen.js +3 -0
- package/dist/i18n/messages/es.gen.js +3 -0
- package/dist/i18n/messages/et.gen.js +3 -0
- package/dist/i18n/messages/fr.gen.js +3 -0
- package/dist/i18n/messages/he.gen.js +3 -0
- package/dist/i18n/messages/hi.gen.js +3 -0
- package/dist/i18n/messages/hu.gen.js +3 -0
- package/dist/i18n/messages/lt.gen.js +3 -0
- package/dist/i18n/messages/lv.gen.js +3 -0
- package/dist/i18n/messages/messages.gen.d.ts +3 -0
- package/dist/i18n/messages/pl.gen.js +3 -0
- package/dist/i18n/messages/pt-BR.gen.js +3 -0
- package/dist/i18n/messages/sk.gen.js +3 -0
- package/dist/i18n/messages/tr.gen.js +3 -0
- package/dist/i18n/messages/zh-CN.gen.js +3 -0
- package/dist/internal/acceptedBlockProjection.js +2 -0
- package/dist/internal/pageBreakRunDescendantIndex.d.ts +7 -2
- package/dist/internal/pageBreakRunDescendantIndex.js +12 -3
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +5 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -0
- package/dist/internal/revisionResolutionInline.js +1 -2
- package/dist/internal/subtreeHolds.d.ts +12 -0
- package/dist/internal/subtreeHolds.js +25 -0
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/layout-bridge/cellSelectionHighlight.js +3 -3
- package/dist/layout-bridge/convert/flowBlockPostprocessing.js +20 -12
- package/dist/layout-bridge/convert/flowConversionShared.d.ts +15 -1
- package/dist/layout-bridge/convert/flowConversionShared.js +9 -1
- package/dist/layout-bridge/convert/paragraphAttrs.d.ts +15 -4
- package/dist/layout-bridge/convert/paragraphAttrs.js +11 -4
- package/dist/layout-bridge/convert/paragraphBlockCache.d.ts +26 -0
- package/dist/layout-bridge/convert/paragraphBlockCache.js +137 -0
- package/dist/layout-bridge/convert/paragraphConversion.d.ts +12 -2
- package/dist/layout-bridge/convert/paragraphConversion.js +37 -5
- package/dist/layout-bridge/convert/paragraphRuns.d.ts +2 -2
- package/dist/layout-bridge/convert/sectionBoundaries.js +16 -0
- package/dist/layout-bridge/convert/tableConversion.js +19 -8
- package/dist/layout-bridge/convert/toFlowBlocks.js +144 -15
- package/dist/layout-bridge/convert/topLevelConversion.d.ts +74 -0
- package/dist/layout-bridge/convert/topLevelConversion.js +109 -0
- package/dist/layout-bridge/dom/clickToPositionDom.js +41 -40
- package/dist/layout-bridge/dom/findBodyPmSpans.js +4 -3
- package/dist/layout-bridge/dom/findHfPmSpans.js +10 -15
- package/dist/layout-bridge/dom/imeCaretAnchor.d.ts +8 -0
- package/dist/layout-bridge/dom/imeCaretAnchor.js +71 -7
- package/dist/layout-bridge/dom/textStreamDom.js +3 -2
- package/dist/layout-bridge/engine/blockIndex.d.ts +7 -0
- package/dist/layout-bridge/engine/blockIndex.js +12 -0
- package/dist/layout-bridge/engine/hitTest.js +9 -10
- package/dist/layout-bridge/engine/selectionRects.js +6 -6
- package/dist/layout-bridge/headerFooterLayout.js +12 -11
- package/dist/layout-bridge/tableInsertHover.js +2 -1
- package/dist/layout-engine/footnoteContinuation.d.ts +36 -0
- package/dist/layout-engine/footnoteContinuation.js +210 -0
- package/dist/layout-engine/index.d.ts +2 -2
- package/dist/layout-engine/index.js +7 -2
- package/dist/layout-engine/measure/cache.d.ts +2 -0
- package/dist/layout-engine/measure/cache.js +16 -6
- package/dist/layout-engine/measure/measureParagraph.js +1 -1
- package/dist/layout-engine/measure/paragraphKeyMemo.d.ts +8 -0
- package/dist/layout-engine/measure/paragraphKeyMemo.js +92 -0
- package/dist/layout-engine/tableLayout.js +29 -5
- package/dist/layout-engine/tableRowBreak.d.ts +36 -0
- package/dist/layout-engine/tableRowBreak.js +43 -1
- package/dist/layout-engine/types.d.ts +42 -1
- package/dist/layout-painter/imageLayout.js +2 -1
- package/dist/layout-painter/pageShellStyles.d.ts +10 -0
- package/dist/layout-painter/pageShellStyles.js +32 -0
- package/dist/layout-painter/reconcileRenderedContent.d.ts +19 -0
- package/dist/layout-painter/reconcileRenderedContent.js +117 -0
- package/dist/layout-painter/renderFragment.js +4 -6
- package/dist/layout-painter/renderImage.js +2 -2
- package/dist/layout-painter/renderPage.d.ts +4 -4
- package/dist/layout-painter/renderPage.js +54 -46
- package/dist/layout-painter/renderParagraph.js +3 -3
- package/dist/layout-painter/renderTable.js +16 -16
- package/dist/layout-painter/renderTextBox.js +2 -2
- package/dist/layout-painter/sdtBoundary.js +3 -2
- package/dist/managers/AutoSaveManager.d.ts +5 -1
- package/dist/managers/FindReplaceManager.js +3 -10
- package/dist/markdown/escape.d.ts +20 -1
- package/dist/markdown/escape.js +43 -1
- package/dist/markdown/renderBlock.js +4 -1
- package/dist/markdown/renderParagraph.js +13 -27
- package/dist/markdown/renderTable.js +6 -2
- package/dist/markdown/trailers.js +1 -0
- package/dist/paged-layout/blockGeometry.js +3 -2
- package/dist/paged-layout/editorScrollRoot.d.ts +9 -0
- package/dist/paged-layout/editorScrollRoot.js +10 -1
- package/dist/paged-layout/rangeProjection.js +5 -4
- package/dist/paged-layout/scrollToPmPosition.js +3 -3
- package/dist/paged-layout/selectionViewportRect.d.ts +6 -0
- package/dist/paged-layout/selectionViewportRect.js +8 -2
- package/dist/pdf/images.d.ts +17 -1
- package/dist/pdf/images.js +22 -4
- package/dist/pdf/writePdf.js +4 -2
- package/dist/prosemirror/attrs/index.js +2 -0
- package/dist/prosemirror/canonicalCommands.d.ts +39 -1
- package/dist/prosemirror/canonicalTableCommands.d.ts +28 -0
- package/dist/prosemirror/canonicalTableCommands.js +362 -0
- package/dist/prosemirror/commands/comments.d.ts +30 -2
- package/dist/prosemirror/commands/comments.js +189 -18
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/index.d.ts +1 -1
- package/dist/prosemirror/commentIdAllocator.js +2 -2
- package/dist/prosemirror/commentRangeBoundaryAttrs.d.ts +6 -0
- package/dist/prosemirror/commentRangeBoundaryAttrs.js +9 -3
- package/dist/prosemirror/commentRecords.d.ts +137 -0
- package/dist/prosemirror/commentRecords.js +400 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +3 -4
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +85 -34
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +140 -4
- package/dist/prosemirror/conversion/toProseDoc.js +432 -76
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +23 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +61 -32
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +5 -4
- package/dist/prosemirror/extensions/marks/CommentExtension.js +8 -3
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.d.ts +4 -0
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.js +49 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +3 -1
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +12 -3
- package/dist/prosemirror/extensions/nodes/TableExtension.js +32 -31
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +1 -1
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/listLabels.js +3 -2
- package/dist/prosemirror/listNumbering.d.ts +6 -0
- package/dist/prosemirror/listNumbering.js +12 -9
- package/dist/prosemirror/lockedControls.d.ts +13 -0
- package/dist/prosemirror/lockedControls.js +106 -0
- package/dist/prosemirror/markupViewProjection.js +1 -1
- package/dist/prosemirror/nativeSelection.d.ts +33 -0
- package/dist/prosemirror/nativeSelection.js +74 -0
- package/dist/prosemirror/noteReferenceReview.js +2 -2
- package/dist/prosemirror/numberedRefFields.d.ts +2 -0
- package/dist/prosemirror/numberedRefFields.js +16 -5
- package/dist/prosemirror/paragraphMarkJoin.d.ts +6 -8
- package/dist/prosemirror/paragraphMarkJoin.js +155 -16
- package/dist/prosemirror/plugins/contentControlWidgets.js +2 -2
- package/dist/prosemirror/plugins/documentNumbering.js +37 -15
- package/dist/prosemirror/plugins/suggestionMode.js +33 -10
- package/dist/prosemirror/plugins/templatePreviewValues.js +16 -1
- package/dist/prosemirror/rebaseParagraphRuns.js +1 -1
- package/dist/prosemirror/replacedAnnotations.js +1 -0
- package/dist/prosemirror/runFormattingFromMarks.d.ts +0 -1
- package/dist/prosemirror/runFormattingFromMarks.js +2 -4
- package/dist/prosemirror/runFormattingReconciliation.js +2 -2
- package/dist/prosemirror/runIdentityAcrossRevisions.d.ts +23 -1
- package/dist/prosemirror/runIdentityAcrossRevisions.js +57 -8
- package/dist/prosemirror/runPropertyChangeResolution.js +1 -2
- package/dist/prosemirror/runStyleFormatting.d.ts +14 -4
- package/dist/prosemirror/runStyleFormatting.js +16 -13
- package/dist/prosemirror/schema/marks.d.ts +13 -1
- package/dist/prosemirror/storyListNumbering.js +7 -2
- package/dist/prosemirror/styles/paragraphStyleCascade.js +2 -2
- package/dist/prosemirror/tableResize.d.ts +10 -9
- package/dist/prosemirror/tableResize.js +60 -49
- package/dist/prosemirror/textInput.d.ts +30 -1
- package/dist/prosemirror/textInput.js +144 -17
- package/dist/prosemirror/utils/visualLineNavigation.js +20 -18
- package/dist/prosemirror/validation.d.ts +19 -0
- package/dist/prosemirror/validation.js +79 -5
- package/dist/redline.js +23 -9
- package/dist/render-dom/HeaderFooterSelectionOverlay.js +5 -4
- package/dist/render-dom/RenderedDomContext.js +7 -6
- package/dist/server.d.ts +2 -2
- package/dist/style-sets/extract.js +2 -2
- package/dist/types/canonicalCapabilities.d.ts +38 -16
- package/dist/types/canonicalCapabilities.js +21 -18
- package/dist/utils/cssString.d.ts +7 -0
- package/dist/utils/cssString.js +9 -0
- package/dist/utils/findMatchView.js +4 -3
- package/dist/utils/fontResolver.js +4 -1
- package/dist/utils/formatToStyle.d.ts +1 -1
- package/dist/utils/mergeDocumentContent.js +2 -2
- package/dist/utils/paintedPositions.d.ts +60 -0
- package/dist/utils/paintedPositions.js +101 -0
- package/dist/utils/replaceText.d.ts +11 -0
- package/dist/utils/replaceText.js +39 -7
- package/dist/version-comparison.d.ts +9 -1
- package/dist/version-comparison.js +11 -5
- package/package.json +2 -3
|
@@ -20,6 +20,7 @@ import { PasteStyleInlinerExtension } from "./features/PasteStyleInlinerExtensio
|
|
|
20
20
|
import { SelectionTrackerExtension } from "./features/SelectionTrackerExtension.js";
|
|
21
21
|
import { MARK_EXTENSIONS, MARK_NESTING_ORDER } from "./markRegistry.js";
|
|
22
22
|
import { BlockBookmarkBoundaryExtension } from "./nodes/BlockBookmarkBoundaryExtension.js";
|
|
23
|
+
import { BlockCommentRangeBoundaryExtension } from "./nodes/BlockCommentRangeBoundaryExtension.js";
|
|
23
24
|
import { BlockCustomXmlExtension } from "./nodes/BlockCustomXmlExtension.js";
|
|
24
25
|
import { BlockMoveRangeBoundaryExtension } from "./nodes/BlockMoveRangeBoundaryExtension.js";
|
|
25
26
|
import { BlockSdtExtension } from "./nodes/BlockSdtExtension.js";
|
|
@@ -73,6 +74,7 @@ function createStarterKit(options = {}) {
|
|
|
73
74
|
add("bookmarkBoundary", BookmarkBoundaryExtension({ getInternalClipboardToken }));
|
|
74
75
|
add("blockBookmarkBoundary", BlockBookmarkBoundaryExtension({ getInternalClipboardToken }));
|
|
75
76
|
add("blockMoveRangeBoundary", BlockMoveRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
77
|
+
add("blockCommentRangeBoundary", BlockCommentRangeBoundaryExtension());
|
|
76
78
|
add("commentReference", CommentReferenceExtension({ getInternalClipboardToken }));
|
|
77
79
|
add("commentRangeBoundary", CommentRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
78
80
|
add("moveRangeBoundary", MoveRangeBoundaryExtension({ getInternalClipboardToken }));
|
|
@@ -14,7 +14,7 @@ const DocExtension = createNodeExtension({
|
|
|
14
14
|
_adjustLineHeightInTable: { default: false },
|
|
15
15
|
_doNotUseIndentAsNumberingTabStop: { default: false }
|
|
16
16
|
},
|
|
17
|
-
content: "(paragraph | horizontalRule | pageBreak | table | textBox | blockSdt | blockCustomXml | preservedBlock | blockBookmarkBoundary | blockMoveRangeBoundary)+"
|
|
17
|
+
content: "(paragraph | horizontalRule | pageBreak | table | textBox | blockSdt | blockCustomXml | preservedBlock | blockBookmarkBoundary | blockMoveRangeBoundary | blockCommentRangeBoundary)+"
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
export { DocExtension };
|
|
@@ -22,4 +22,4 @@ export declare const autoBidiDetectionKey: Readonly<{
|
|
|
22
22
|
* document already carried, is unaffected — it always round-trips.
|
|
23
23
|
*/
|
|
24
24
|
export declare const ensureBaseDirectionInState: (state: EditorState) => EditorState;
|
|
25
|
-
export declare const AutoBidiDetectionExtension: (options?: Partial<
|
|
25
|
+
export declare const AutoBidiDetectionExtension: (options?: Partial<Record<never, never>> | undefined) => Extension;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Extension } from "../types.js";
|
|
2
2
|
export declare const JOINED_RUNS_RESTYLED_META = "joinedRunsRestyled";
|
|
3
|
-
export declare const JoinedRunStyleExtension: (options?: Partial<
|
|
3
|
+
export declare const JoinedRunStyleExtension: (options?: Partial<Record<never, never>> | undefined) => Extension;
|
|
@@ -52,5 +52,5 @@ export declare const mapParagraphKeepers: (oldDoc: Node, transactions: readonly
|
|
|
52
52
|
export declare const ensureParaIdsInDoc: (doc: Node) => Node;
|
|
53
53
|
/** {@link ensureParaIdsInDoc} for a state that already exists. */
|
|
54
54
|
export declare const ensureParaIdsInState: (state: EditorState) => EditorState;
|
|
55
|
-
export declare const ParaIdAllocatorExtension: (options?: Partial<
|
|
55
|
+
export declare const ParaIdAllocatorExtension: (options?: Partial<Record<never, never>> | undefined) => Extension;
|
|
56
56
|
export {};
|
|
@@ -35,6 +35,28 @@ type InternalParagraphChangeTrackerState = ParagraphChangeTrackerState & {
|
|
|
35
35
|
/** The section records themselves, by identity. */
|
|
36
36
|
sectionRecords: ReadonlySet<document_d_exports.SectionProperties>;
|
|
37
37
|
};
|
|
38
|
+
type DocumentStructureCounts = {
|
|
39
|
+
blockStructureFingerprint: string;
|
|
40
|
+
sectionRecords: ReadonlySet<document_d_exports.SectionProperties>;
|
|
41
|
+
paragraphs: number;
|
|
42
|
+
/**
|
|
43
|
+
* Distinct section records the paragraphs carry, which is the number of
|
|
44
|
+
* `w:sectPr` the package states for them. A split copies a node's attrs, so
|
|
45
|
+
* both halves of a split section-ending paragraph hold one record until the
|
|
46
|
+
* from-leg keeps it on the trailing half: one section, not two.
|
|
47
|
+
*/
|
|
48
|
+
sectionEndpoints: number;
|
|
49
|
+
sectionEndpointFingerprint: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Count the structural values the tracker compares for every transaction.
|
|
53
|
+
*
|
|
54
|
+
* Each top-level block's records are kept for the block node, so a keystroke
|
|
55
|
+
* recomputes only the block it changed. The fingerprint joins the blocks'
|
|
56
|
+
* records in order: two documents' fingerprints are equal exactly when their
|
|
57
|
+
* full record lists (every block and nested block with its path) are.
|
|
58
|
+
*/
|
|
59
|
+
export declare function countDocumentStructure(doc: Node): DocumentStructureCounts;
|
|
38
60
|
export declare function createParagraphChangeTrackerPlugin(): Plugin<InternalParagraphChangeTrackerState>;
|
|
39
61
|
/**
|
|
40
62
|
* Get the change tracker state from an EditorState
|
|
@@ -104,5 +126,5 @@ type MarkChangedParagraphRangesOptions = {
|
|
|
104
126
|
};
|
|
105
127
|
/** Record mark-only paragraph changes whose replacement step has a granular map. */
|
|
106
128
|
export declare function markChangedParagraphRanges(tr: Transaction, batch: MarkChangedParagraphRangesOptions): Transaction;
|
|
107
|
-
export declare const ParagraphChangeTrackerExtension: (options?: Partial<
|
|
129
|
+
export declare const ParagraphChangeTrackerExtension: (options?: Partial<Record<never, never>> | undefined) => Extension;
|
|
108
130
|
export {};
|
|
@@ -30,43 +30,72 @@ const isRemovedSectionReference = (value) => typeof value === "object" && value
|
|
|
30
30
|
const isTrackedSectionEndpointRemoval = (value) => typeof value === "object" && value !== null && "type" in value && value.type === "tracked-section-endpoint-removal" && "sourceParagraphEndpointCount" in value && typeof value.sourceParagraphEndpointCount === "number" && Number.isSafeInteger(value.sourceParagraphEndpointCount) && "expectedParagraphEndpointCount" in value && typeof value.expectedParagraphEndpointCount === "number" && Number.isSafeInteger(value.expectedParagraphEndpointCount) && value.sourceParagraphEndpointCount > value.expectedParagraphEndpointCount && value.expectedParagraphEndpointCount >= 0 && "sourceEndpointFingerprint" in value && typeof value.sourceEndpointFingerprint === "string" && "expectedEndpointFingerprint" in value && typeof value.expectedEndpointFingerprint === "string" && "removedReferences" in value && Array.isArray(value.removedReferences) && value.removedReferences.every(isRemovedSectionReference);
|
|
31
31
|
const isTrackedSectionEndpointRemovalMeta = (value) => typeof value === "object" && value !== null && "type" in value && value.type === "tracked-section-endpoint-removal-meta" && "authorization" in value && isTrackedSectionEndpointRemoval(value.authorization);
|
|
32
32
|
const isSectionEditMeta = (value) => typeof value === "object" && value !== null && "type" in value && value.type === "section-edit-meta" && "authorization" in value && (value.authorization === null || isTrackedSectionEndpointRemoval(value.authorization)) && "expectedEndpointFingerprint" in value && typeof value.expectedEndpointFingerprint === "string";
|
|
33
|
-
|
|
33
|
+
const blockStructures = /* @__PURE__ */ new WeakMap();
|
|
34
|
+
const relativePath = (parentPath, index) => parentPath.length === 0 ? `${index}` : `${parentPath}.${index}`;
|
|
35
|
+
const blockStructureOf = (block) => {
|
|
36
|
+
const cached = blockStructures.get(block);
|
|
37
|
+
if (cached) return cached;
|
|
38
|
+
const records = [];
|
|
39
|
+
const endpoints = [];
|
|
40
|
+
let paragraphs = 0;
|
|
41
|
+
const visit = (node, path) => {
|
|
42
|
+
records.push(node.type.name === "paragraph" ? [
|
|
43
|
+
path,
|
|
44
|
+
node.type.name,
|
|
45
|
+
node.attrs["paraId"] ?? null
|
|
46
|
+
] : [
|
|
47
|
+
path,
|
|
48
|
+
node.type.name,
|
|
49
|
+
canonicalJson(node.attrs)
|
|
50
|
+
]);
|
|
51
|
+
if (node.type.name === "paragraph") {
|
|
52
|
+
paragraphs++;
|
|
53
|
+
const sectionProperties = sectionPropertiesOf(node);
|
|
54
|
+
if (sectionProperties !== null) endpoints.push({
|
|
55
|
+
path,
|
|
56
|
+
paraId: node.attrs["paraId"] ?? null,
|
|
57
|
+
sectionProperties
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
node.forEach((child, _offset, index) => visit(child, relativePath(path, index)));
|
|
62
|
+
};
|
|
63
|
+
visit(block, "");
|
|
64
|
+
const structure = {
|
|
65
|
+
records: JSON.stringify(records),
|
|
66
|
+
paragraphs,
|
|
67
|
+
endpoints
|
|
68
|
+
};
|
|
69
|
+
blockStructures.set(block, structure);
|
|
70
|
+
return structure;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Count the structural values the tracker compares for every transaction.
|
|
74
|
+
*
|
|
75
|
+
* Each top-level block's records are kept for the block node, so a keystroke
|
|
76
|
+
* recomputes only the block it changed. The fingerprint joins the blocks'
|
|
77
|
+
* records in order: two documents' fingerprints are equal exactly when their
|
|
78
|
+
* full record lists (every block and nested block with its path) are.
|
|
79
|
+
*/
|
|
34
80
|
function countDocumentStructure(doc) {
|
|
35
81
|
let paragraphs = 0;
|
|
36
82
|
const sectionRecords = /* @__PURE__ */ new Set();
|
|
37
83
|
const blockRecords = [];
|
|
38
84
|
const endpointRecords = [];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
path
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (node.type.name === "paragraph") {
|
|
52
|
-
paragraphs++;
|
|
53
|
-
const sectionProperties = sectionPropertiesOf(node);
|
|
54
|
-
if (sectionProperties !== null) {
|
|
55
|
-
sectionRecords.add(sectionProperties);
|
|
56
|
-
endpointRecords.push({
|
|
57
|
-
path: parentPath.length === 0 ? `${index}` : `${parentPath}.${index}`,
|
|
58
|
-
paraId: node.attrs["paraId"] ?? null,
|
|
59
|
-
sectionProperties
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (node.childCount > 0) visit(node, path);
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
visit(doc, "");
|
|
85
|
+
doc.forEach((block, _offset, index) => {
|
|
86
|
+
const structure = blockStructureOf(block);
|
|
87
|
+
blockRecords.push(structure.records);
|
|
88
|
+
paragraphs += structure.paragraphs;
|
|
89
|
+
for (const endpoint of structure.endpoints) {
|
|
90
|
+
sectionRecords.add(endpoint.sectionProperties);
|
|
91
|
+
endpointRecords.push({
|
|
92
|
+
...endpoint,
|
|
93
|
+
path: endpoint.path.length === 0 ? `${index}` : `${index}.${endpoint.path}`
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
68
97
|
return {
|
|
69
|
-
blockStructureFingerprint:
|
|
98
|
+
blockStructureFingerprint: blockRecords.join(""),
|
|
70
99
|
sectionRecords,
|
|
71
100
|
paragraphs,
|
|
72
101
|
sectionEndpoints: sectionRecords.size,
|
|
@@ -543,4 +572,4 @@ const ParagraphChangeTrackerExtension = createExtension({
|
|
|
543
572
|
return { plugins: [createParagraphChangeTrackerPlugin()] };
|
|
544
573
|
}
|
|
545
574
|
});
|
|
546
|
-
export { ParagraphChangeTrackerExtension, clearTrackedChanges, createParagraphChangeTrackerPlugin, getChangeTrackerState, getChangedParagraphIds, getTrackedSectionEndpointRemoval, hasStructuralChanges, hasUntrackedChanges, ignoreTrackedChanges, markChangedParagraphRanges, markPackageChange, markSectionBreakRemoval, markStructuralChange, markTrackedSectionEndpointRemoval, paragraphChangeTrackerKey, repackWithEditorSectionRemovals };
|
|
575
|
+
export { ParagraphChangeTrackerExtension, clearTrackedChanges, countDocumentStructure, createParagraphChangeTrackerPlugin, getChangeTrackerState, getChangedParagraphIds, getTrackedSectionEndpointRemoval, hasStructuralChanges, hasUntrackedChanges, ignoreTrackedChanges, markChangedParagraphRanges, markPackageChange, markSectionBreakRemoval, markStructuralChange, markTrackedSectionEndpointRemoval, paragraphChangeTrackerKey, repackWithEditorSectionRemovals };
|
|
@@ -17,18 +17,19 @@ const hasListHint = (node) => node?.type.name === "paragraph" && Boolean(expectP
|
|
|
17
17
|
*/
|
|
18
18
|
const flattenPastedHtmlLists = (html) => {
|
|
19
19
|
if (!/<(?:ul|ol)\b/iu.test(html)) return html;
|
|
20
|
-
const
|
|
20
|
+
const owner = document.implementation.createHTMLDocument("");
|
|
21
|
+
const host = owner.createElement("div");
|
|
21
22
|
host.innerHTML = html;
|
|
22
23
|
let nextGroup = 0;
|
|
23
24
|
const flatten = (list, level) => {
|
|
24
|
-
const fragment =
|
|
25
|
+
const fragment = owner.createDocumentFragment();
|
|
25
26
|
const group = ++nextGroup;
|
|
26
27
|
const kind = list.localName === "ul" ? "bullet" : "numbered";
|
|
27
28
|
const rawStart = Number(list.getAttribute("start"));
|
|
28
29
|
const start = Number.isSafeInteger(rawStart) && rawStart > 0 ? rawStart : void 0;
|
|
29
30
|
for (const item of Array.from(list.children)) {
|
|
30
31
|
if (item.localName !== "li") continue;
|
|
31
|
-
let paragraph =
|
|
32
|
+
let paragraph = owner.createElement("p");
|
|
32
33
|
let emitted = false;
|
|
33
34
|
const mark = (element) => {
|
|
34
35
|
element.setAttribute("data-folio-list-group", String(group));
|
|
@@ -40,7 +41,7 @@ const flattenPastedHtmlLists = (html) => {
|
|
|
40
41
|
if (!paragraph.hasChildNodes()) return;
|
|
41
42
|
mark(paragraph);
|
|
42
43
|
fragment.append(paragraph);
|
|
43
|
-
paragraph =
|
|
44
|
+
paragraph = owner.createElement("p");
|
|
44
45
|
emitted = true;
|
|
45
46
|
};
|
|
46
47
|
for (const child of Array.from(item.childNodes)) if (child instanceof Element && isList(child)) {
|
|
@@ -12,9 +12,14 @@ const CommentExtension = createMarkExtension({
|
|
|
12
12
|
schemaMarkName: "comment",
|
|
13
13
|
markSpec: {
|
|
14
14
|
excludes: "",
|
|
15
|
-
attrs: {
|
|
16
|
-
|
|
17
|
-
commentId: { default: 0 }
|
|
15
|
+
attrs: {
|
|
16
|
+
/** Comment ID (matches Comment.id) */
|
|
17
|
+
commentId: { default: 0 },
|
|
18
|
+
/** Shown at a point comment's reference; see `CommentAttrs.point`. */
|
|
19
|
+
point: { default: false },
|
|
20
|
+
/** The pending suggestion proposing it; see `CommentAttrs.suggestionId`. */
|
|
21
|
+
suggestionId: { default: null }
|
|
22
|
+
},
|
|
18
23
|
inclusive: false,
|
|
19
24
|
parseDOM: [{
|
|
20
25
|
tag: "span.docx-comment",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NodeExtension } from "../types.js";
|
|
2
|
+
/** The node name, for callers asking what a block container holds. */
|
|
3
|
+
export declare const BLOCK_COMMENT_RANGE_BOUNDARY_NODE_NAME = "blockCommentRangeBoundary";
|
|
4
|
+
export declare const BlockCommentRangeBoundaryExtension: () => NodeExtension;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { expectCommentRangeBoundaryAttrs, readCommentRangeBoundaryMarker } from "../../commentRangeBoundaryAttrs.js";
|
|
2
|
+
import { createNodeExtension } from "../create.js";
|
|
3
|
+
// src/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.ts
|
|
4
|
+
/**
|
|
5
|
+
* A comment range boundary that stands between two blocks.
|
|
6
|
+
*
|
|
7
|
+
* The block-level twin of `commentRangeBoundary`, as `blockBookmarkBoundary`
|
|
8
|
+
* is of `bookmarkBoundary`: `CT_Body`, `CT_Tc` and `CT_SdtContentBlock`
|
|
9
|
+
* declare `w:commentRangeStart` and `w:commentRangeEnd` beside their blocks,
|
|
10
|
+
* and a range that opens beside a content control is written there. The node
|
|
11
|
+
* carries the same marker, read by the same reader, so the two levels cannot
|
|
12
|
+
* describe a comment range differently. The comment's mark still covers the
|
|
13
|
+
* text; the save keeps this node's marker as the range's own start or end.
|
|
14
|
+
*/
|
|
15
|
+
/** The node name, for callers asking what a block container holds. */
|
|
16
|
+
const BLOCK_COMMENT_RANGE_BOUNDARY_NODE_NAME = "blockCommentRangeBoundary";
|
|
17
|
+
const BLOCK_COMMENT_RANGE_BOUNDARY_DOM_ATTRIBUTE = "data-docx-block-comment-range-boundary";
|
|
18
|
+
const BlockCommentRangeBoundaryExtension = createNodeExtension({
|
|
19
|
+
name: BLOCK_COMMENT_RANGE_BOUNDARY_NODE_NAME,
|
|
20
|
+
schemaNodeName: BLOCK_COMMENT_RANGE_BOUNDARY_NODE_NAME,
|
|
21
|
+
nodeSpec: {
|
|
22
|
+
group: "block",
|
|
23
|
+
atom: true,
|
|
24
|
+
selectable: false,
|
|
25
|
+
attrs: { marker: {} },
|
|
26
|
+
parseDOM: [{
|
|
27
|
+
tag: `div[${BLOCK_COMMENT_RANGE_BOUNDARY_DOM_ATTRIBUTE}]`,
|
|
28
|
+
getAttrs(dom) {
|
|
29
|
+
const raw = dom.getAttribute(BLOCK_COMMENT_RANGE_BOUNDARY_DOM_ATTRIBUTE);
|
|
30
|
+
if (raw === null) return false;
|
|
31
|
+
try {
|
|
32
|
+
const marker = readCommentRangeBoundaryMarker(JSON.parse(raw));
|
|
33
|
+
return marker ? { marker } : false;
|
|
34
|
+
} catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}],
|
|
39
|
+
toDOM(node) {
|
|
40
|
+
return ["div", {
|
|
41
|
+
[BLOCK_COMMENT_RANGE_BOUNDARY_DOM_ATTRIBUTE]: JSON.stringify(expectCommentRangeBoundaryAttrs(node).marker),
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
contenteditable: "false",
|
|
44
|
+
style: "display: none;"
|
|
45
|
+
}];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export { BLOCK_COMMENT_RANGE_BOUNDARY_NODE_NAME, BlockCommentRangeBoundaryExtension };
|
|
@@ -2,7 +2,7 @@ import { readCommentReferenceAttrs } from "../../commentReferenceAttrs.js";
|
|
|
2
2
|
import { COMMENT_REFERENCE_NODE_NAME, resolveCommentReferences } from "../../commentReferenceIntegrity.js";
|
|
3
3
|
import { createNodeExtension } from "../create.js";
|
|
4
4
|
import { INLINE_ANCHOR_DOM_STYLE } from "./inlineAnchorDom.js";
|
|
5
|
-
import { Plugin } from "prosemirror-state";
|
|
5
|
+
import { Plugin, TextSelection } from "prosemirror-state";
|
|
6
6
|
// src/prosemirror/extensions/nodes/CommentReferenceExtension.ts
|
|
7
7
|
/** Zero-width `w:commentReference`: where a comment's visible mark is painted. */
|
|
8
8
|
const CommentReferenceExtension = createNodeExtension({
|
|
@@ -41,6 +41,8 @@ const CommentReferenceExtension = createNodeExtension({
|
|
|
41
41
|
if (!resolution) return null;
|
|
42
42
|
const transaction = newState.tr;
|
|
43
43
|
for (const step of resolution.steps) transaction.step(step);
|
|
44
|
+
const { selection } = newState;
|
|
45
|
+
if (selection instanceof TextSelection && selection.empty) transaction.setSelection(TextSelection.create(transaction.doc, transaction.mapping.map(selection.head, -1)));
|
|
44
46
|
return transaction;
|
|
45
47
|
} })] })
|
|
46
48
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { imageLuminanceFilter } from "../../../utils/imageLuminance.js";
|
|
2
|
+
import { sanitizeImageSrc } from "../../../utils/sanitizeImageSrc.js";
|
|
2
3
|
import { expectImageAttrs } from "../../attrs/index.js";
|
|
3
4
|
import { pictureNamesDomAttrs, pictureNamesFromDom } from "../../imagePictureNames.js";
|
|
4
5
|
import { createNodeExtension } from "../create.js";
|
|
@@ -6,6 +7,12 @@ import { createNodeExtension } from "../create.js";
|
|
|
6
7
|
/**
|
|
7
8
|
* Image Extension — inline/floating image node
|
|
8
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* A source the DOM must not load (anything `sanitizeImageSrc` rejects, such
|
|
12
|
+
* as a linked `https:` image) is kept under this attribute instead of `src`,
|
|
13
|
+
* so the node still round-trips through the clipboard without a request.
|
|
14
|
+
*/
|
|
15
|
+
const UNLOADED_SRC_ATTRIBUTE = "data-folio-src";
|
|
9
16
|
const ImageExtension = createNodeExtension({
|
|
10
17
|
name: "image",
|
|
11
18
|
schemaNodeName: "image",
|
|
@@ -72,9 +79,10 @@ const ImageExtension = createNodeExtension({
|
|
|
72
79
|
_docxRunFormatting: { default: null }
|
|
73
80
|
},
|
|
74
81
|
parseDOM: [{
|
|
75
|
-
tag:
|
|
82
|
+
tag: `img[src], img[${UNLOADED_SRC_ATTRIBUTE}]`,
|
|
76
83
|
getAttrs(dom) {
|
|
77
84
|
const element = dom;
|
|
85
|
+
const src = element.getAttribute("src") || element.getAttribute(UNLOADED_SRC_ATTRIBUTE) || "";
|
|
78
86
|
const pictureNames = pictureNamesFromDom(element);
|
|
79
87
|
const alt = element.getAttribute("alt");
|
|
80
88
|
const title = element.getAttribute("title");
|
|
@@ -87,7 +95,7 @@ const ImageExtension = createNodeExtension({
|
|
|
87
95
|
const contrastRaw = element.dataset["contrast"];
|
|
88
96
|
const contrast = contrastRaw === void 0 ? NaN : Number(contrastRaw);
|
|
89
97
|
return {
|
|
90
|
-
src
|
|
98
|
+
src,
|
|
91
99
|
...element.dataset["docPrName"] === void 0 ? {} : { docPrName: element.dataset["docPrName"] },
|
|
92
100
|
...Object.keys(pictureNames).length > 0 ? { pictureNames } : {},
|
|
93
101
|
...alt ? { alt } : {},
|
|
@@ -110,8 +118,9 @@ const ImageExtension = createNodeExtension({
|
|
|
110
118
|
}],
|
|
111
119
|
toDOM(node) {
|
|
112
120
|
const attrs = expectImageAttrs(node);
|
|
121
|
+
const loadable = sanitizeImageSrc(attrs.src);
|
|
113
122
|
const domAttrs = {
|
|
114
|
-
|
|
123
|
+
...loadable === void 0 ? { [UNLOADED_SRC_ATTRIBUTE]: attrs.src } : { src: loadable },
|
|
115
124
|
class: "docx-image",
|
|
116
125
|
...pictureNamesDomAttrs(attrs.pictureNames)
|
|
117
126
|
};
|
|
@@ -6,6 +6,7 @@ import { isValidHexColor, resolveColor } from "../../../utils/colorResolver.js";
|
|
|
6
6
|
import { resolveTablePlacementAlignment } from "../../../utils/tablePlacement.js";
|
|
7
7
|
import { textFlowCss } from "../../../utils/textDirectionFlow.js";
|
|
8
8
|
import { expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs } from "../../attrs/index.js";
|
|
9
|
+
import { withCanonicalCellMerge, withCanonicalCellSplit, withCanonicalColumnDeletion, withCanonicalColumnInsertion, withCanonicalRowDeletion, withCanonicalRowInsertion, withCanonicalTableAttributeCommand, withCanonicalTableDeletion, withCanonicalTableInsertion } from "../../canonicalTableCommands.js";
|
|
9
10
|
import { mintRevisionId } from "../../plugins/revisionIds.js";
|
|
10
11
|
import { makeRevisionInfo } from "../../plugins/suggestionMode.js";
|
|
11
12
|
import { pasteTableCells, pastedSliceWithNewTableCells } from "../../tableCellPaste.js";
|
|
@@ -398,7 +399,7 @@ const statedCellWidth = (value, type) => ({
|
|
|
398
399
|
}
|
|
399
400
|
});
|
|
400
401
|
const tableCellSpec = {
|
|
401
|
-
content: "(paragraph | table | textBox | blockSdt | blockCustomXml | preservedBlock | blockBookmarkBoundary | blockMoveRangeBoundary)+",
|
|
402
|
+
content: "(paragraph | table | textBox | blockSdt | blockCustomXml | preservedBlock | blockBookmarkBoundary | blockMoveRangeBoundary | blockCommentRangeBoundary)+",
|
|
402
403
|
tableRole: "cell",
|
|
403
404
|
isolating: true,
|
|
404
405
|
attrs: {
|
|
@@ -468,7 +469,7 @@ const tableCellSpec = {
|
|
|
468
469
|
}
|
|
469
470
|
};
|
|
470
471
|
const tableHeaderSpec = {
|
|
471
|
-
content: "(paragraph | table | textBox | blockSdt | blockCustomXml | preservedBlock | blockBookmarkBoundary | blockMoveRangeBoundary)+",
|
|
472
|
+
content: "(paragraph | table | textBox | blockSdt | blockCustomXml | preservedBlock | blockBookmarkBoundary | blockMoveRangeBoundary | blockCommentRangeBoundary)+",
|
|
472
473
|
tableRole: "header_cell",
|
|
473
474
|
isolating: true,
|
|
474
475
|
attrs: {
|
|
@@ -2004,39 +2005,39 @@ const TablePluginExtension = createExtension({
|
|
|
2004
2005
|
Delete: chainCommands(deleteTableIfSelected(), preventTableMergeAtGap())
|
|
2005
2006
|
},
|
|
2006
2007
|
commands: {
|
|
2007
|
-
insertTable: (rows, cols) => insertTable(rows, cols),
|
|
2008
|
-
addRowAbove: () => addRowAbove,
|
|
2009
|
-
addRowBelow: () => addRowBelow,
|
|
2010
|
-
deleteRow: () => deleteRow,
|
|
2011
|
-
addColumnLeft: () => addColumnLeft,
|
|
2012
|
-
addColumnRight: () => addColumnRight,
|
|
2013
|
-
deleteColumn: () => deleteColumn,
|
|
2014
|
-
deleteTable: () => deleteTable,
|
|
2008
|
+
insertTable: (rows, cols) => withCanonicalTableInsertion(insertTable(rows, cols)),
|
|
2009
|
+
addRowAbove: () => withCanonicalRowInsertion(addRowAbove, "above"),
|
|
2010
|
+
addRowBelow: () => withCanonicalRowInsertion(addRowBelow, "below"),
|
|
2011
|
+
deleteRow: () => withCanonicalRowDeletion(deleteRow),
|
|
2012
|
+
addColumnLeft: () => withCanonicalColumnInsertion(addColumnLeft, "left"),
|
|
2013
|
+
addColumnRight: () => withCanonicalColumnInsertion(addColumnRight, "right"),
|
|
2014
|
+
deleteColumn: () => withCanonicalColumnDeletion(deleteColumn),
|
|
2015
|
+
deleteTable: () => withCanonicalTableDeletion(deleteTable),
|
|
2015
2016
|
selectTable: () => selectTable,
|
|
2016
2017
|
selectRow: () => selectRow,
|
|
2017
2018
|
selectColumn: () => selectColumn,
|
|
2018
|
-
mergeCells: () => preserveOmittedGridSlots(mergeCells),
|
|
2019
|
-
splitCell: () => preserveOmittedGridSlots(preserveSourceCellIdentity(splitCell)),
|
|
2020
|
-
setCellBorder: (side, spec, clearOthers) => setCellBorder(side, spec, clearOthers),
|
|
2021
|
-
setTableBorders: (preset, borderSpec) => setTableBorders(preset, borderSpec),
|
|
2022
|
-
setTableBorderPreset: (preset) => setTableBorderPreset(preset),
|
|
2023
|
-
setCellVerticalAlign: (align) => setCellVerticalAlign(align),
|
|
2024
|
-
setCellMargins: (margins) => setCellMargins(margins),
|
|
2025
|
-
setCellTextDirection: (direction) => setCellTextDirection(direction),
|
|
2026
|
-
toggleNoWrap: () => toggleNoWrap(),
|
|
2027
|
-
setRowHeight: (height, rule) => setRowHeight(height, rule),
|
|
2028
|
-
toggleHeaderRow: () => toggleHeaderRow(),
|
|
2029
|
-
distributeColumns: () => distributeColumns(),
|
|
2019
|
+
mergeCells: () => withCanonicalCellMerge(preserveOmittedGridSlots(mergeCells)),
|
|
2020
|
+
splitCell: () => withCanonicalCellSplit(preserveOmittedGridSlots(preserveSourceCellIdentity(splitCell))),
|
|
2021
|
+
setCellBorder: (side, spec, clearOthers) => withCanonicalTableAttributeCommand(setCellBorder(side, spec, clearOthers)),
|
|
2022
|
+
setTableBorders: (preset, borderSpec) => withCanonicalTableAttributeCommand(setTableBorders(preset, borderSpec)),
|
|
2023
|
+
setTableBorderPreset: (preset) => withCanonicalTableAttributeCommand(setTableBorderPreset(preset)),
|
|
2024
|
+
setCellVerticalAlign: (align) => withCanonicalTableAttributeCommand(setCellVerticalAlign(align)),
|
|
2025
|
+
setCellMargins: (margins) => withCanonicalTableAttributeCommand(setCellMargins(margins)),
|
|
2026
|
+
setCellTextDirection: (direction) => withCanonicalTableAttributeCommand(setCellTextDirection(direction)),
|
|
2027
|
+
toggleNoWrap: () => withCanonicalTableAttributeCommand(toggleNoWrap()),
|
|
2028
|
+
setRowHeight: (height, rule) => withCanonicalTableAttributeCommand(setRowHeight(height, rule)),
|
|
2029
|
+
toggleHeaderRow: () => withCanonicalTableAttributeCommand(toggleHeaderRow()),
|
|
2030
|
+
distributeColumns: () => withCanonicalTableAttributeCommand(distributeColumns()),
|
|
2030
2031
|
autoFitContents: () => autoFitContents(),
|
|
2031
|
-
setTableProperties: (props) => setTableProperties(props),
|
|
2032
|
-
applyTableStyle: (styleData) => applyTableStyle(styleData),
|
|
2033
|
-
setCellFillColor: (color) => setCellFillColor(color),
|
|
2034
|
-
setTableBorderColor: (color) => setTableBorderColor(color),
|
|
2035
|
-
setTableBorderWidth: (size) => setTableBorderWidth(size),
|
|
2036
|
-
removeTableBorders: () => setTableBorders("none"),
|
|
2037
|
-
setAllTableBorders: (borderSpec) => setTableBorders("all", borderSpec),
|
|
2038
|
-
setOutsideTableBorders: (borderSpec) => setTableBorders("outside", borderSpec),
|
|
2039
|
-
setInsideTableBorders: (borderSpec) => setTableBorders("inside", borderSpec)
|
|
2032
|
+
setTableProperties: (props) => withCanonicalTableAttributeCommand(setTableProperties(props)),
|
|
2033
|
+
applyTableStyle: (styleData) => withCanonicalTableAttributeCommand(applyTableStyle(styleData)),
|
|
2034
|
+
setCellFillColor: (color) => withCanonicalTableAttributeCommand(setCellFillColor(color)),
|
|
2035
|
+
setTableBorderColor: (color) => withCanonicalTableAttributeCommand(setTableBorderColor(color)),
|
|
2036
|
+
setTableBorderWidth: (size) => withCanonicalTableAttributeCommand(setTableBorderWidth(size)),
|
|
2037
|
+
removeTableBorders: () => withCanonicalTableAttributeCommand(setTableBorders("none")),
|
|
2038
|
+
setAllTableBorders: (borderSpec) => withCanonicalTableAttributeCommand(setTableBorders("all", borderSpec)),
|
|
2039
|
+
setOutsideTableBorders: (borderSpec) => withCanonicalTableAttributeCommand(setTableBorders("outside", borderSpec)),
|
|
2040
|
+
setInsideTableBorders: (borderSpec) => withCanonicalTableAttributeCommand(setTableBorders("inside", borderSpec))
|
|
2040
2041
|
}
|
|
2041
2042
|
};
|
|
2042
2043
|
}
|
|
@@ -71,7 +71,7 @@ const TextBoxExtension = createNodeExtension({
|
|
|
71
71
|
schemaNodeName: "textBox",
|
|
72
72
|
nodeSpec: {
|
|
73
73
|
group: "block",
|
|
74
|
-
content: "(paragraph | table)+",
|
|
74
|
+
content: "(paragraph | table | blockSdt | blockCustomXml | preservedBlock | blockBookmarkBoundary | blockMoveRangeBoundary | blockCommentRangeBoundary)+",
|
|
75
75
|
isolating: true,
|
|
76
76
|
draggable: true,
|
|
77
77
|
attrs: {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { FontFamilyAttrs, FontSizeAttrs, HyperlinkAttrs, TextColorAttrs, UnderlineAttrs } from "./schema/marks.js";
|
|
2
2
|
import { ImageAttrs, ParagraphAttrs } from "./schema/nodes.js";
|
|
3
3
|
import { ResolvedParagraphStyle, StyleResolver, createStyleResolver } from "./styles/styleResolver.js";
|
|
4
|
+
import { clearFormatting, getMarkAttr, isMarkActive } from "./extensions/marks/markUtils.js";
|
|
5
|
+
import { ProseMirrorDocumentValidationIssue, ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "./validation.js";
|
|
6
|
+
import { ToProseDocOptions, createEmptyDoc, toProseDoc } from "./conversion/toProseDoc.js";
|
|
4
7
|
import { schema, singletonManager } from "./schema/index.js";
|
|
5
8
|
import { getParagraphAlignment, getParagraphBidi, getStyleId } from "./extensions/core/ParagraphExtension.js";
|
|
6
9
|
import { BorderPreset, TableBorderPreset, TableContextInfo, getTableContext, isInTable as isInTableCell } from "./extensions/nodes/TableExtension.js";
|
|
7
10
|
import { TableBorderCommandSpec, TableCellBorderCommandSpec } from "./extensions/types.js";
|
|
8
11
|
import { ListNumberingMenuState, NO_LIST_NUMBERING_MENU, listNumberingMenuState } from "./listNumbering.js";
|
|
9
12
|
import { CapturedTextFormatting, PAINTABLE_MARK_NAMES, applyFormatMarks, captureFormatMarks } from "./commands/formatPainter.js";
|
|
10
|
-
import { clearFormatting, getMarkAttr, isMarkActive } from "./extensions/marks/markUtils.js";
|
|
11
13
|
import { getHyperlinkAttrs, getSelectedText, isHyperlinkActive } from "./extensions/marks/HyperlinkExtension.js";
|
|
12
14
|
import { clearFontFamily, clearFontSize, clearHighlight, clearTextColor, insertHyperlink, removeHyperlink, setFontFamily, setFontSize, setHighlight, setHyperlink, setTextColor, toggleBold, toggleItalic, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline } from "./commands/formatting.js";
|
|
13
15
|
import { insertImageFromFile } from "./commands/image.js";
|
|
@@ -17,8 +19,6 @@ import { addColumnLeft, addColumnRight, addRowAbove, addRowBelow, applyTableStyl
|
|
|
17
19
|
import { insertPageBreak } from "./commands/pageBreak.js";
|
|
18
20
|
import "./commands/index.js";
|
|
19
21
|
import { FromProseDocOptions, ProjectionReuse, fromProseDoc, updateDocumentContent } from "./conversion/fromProseDoc.js";
|
|
20
|
-
import { ToProseDocOptions, createEmptyDoc, toProseDoc } from "./conversion/toProseDoc.js";
|
|
21
|
-
import { ProseMirrorDocumentValidationIssue, ValidateProseMirrorDocumentResult, assertValidProseMirrorDocument, formatProseMirrorDocumentIssues, validateProseMirrorDocument } from "./validation.js";
|
|
22
22
|
import "./conversion/index.js";
|
|
23
23
|
import { ActiveListState, ListState, ListType, NO_LIST_STATE, isInListState, listStateLevel, resolveListState, sameListState } from "./listState.js";
|
|
24
24
|
import { SelectionChangeCallback, SelectionContext, createSelectionTrackerPlugin, extractSelectionContext, getSelectionContext, selectionTrackerKey } from "./plugins/selectionTracker.js";
|
|
@@ -134,11 +134,12 @@ const createListLabelCounter = (numberingOrStreams = null, suppliedStreams) => {
|
|
|
134
134
|
numPrFromStyle: counterAttrs.numPrFromStyle
|
|
135
135
|
});
|
|
136
136
|
const countedNumbering = effectiveParagraphNumberingReference(countedSources);
|
|
137
|
-
const revisionSelectedRendering = counterInput._propertyChanges?.length && counterAttrs !== counterInput && numbering === null ? listRenderingFromAttrs({
|
|
137
|
+
const revisionSelectedRendering = counterInput._propertyChanges?.length && counterAttrs !== counterInput && numbering === null && countedNumbering !== void 0 ? listRenderingFromAttrs({
|
|
138
138
|
attrs: counterAttrs,
|
|
139
139
|
numId: countedNumbering?.numId ?? 1
|
|
140
140
|
}) : void 0;
|
|
141
|
-
const
|
|
141
|
+
const revisionSelected = counterInput._propertyChanges?.length && counterAttrs !== counterInput && numbering === null;
|
|
142
|
+
const countedList = resolveParagraphList(countedSources, numbering, revisionSelected ? revisionSelectedRendering : revisionSelectedRendering ?? projectedRendering);
|
|
142
143
|
switch (countedList.kind) {
|
|
143
144
|
case "none": return {
|
|
144
145
|
kind: "none",
|
|
@@ -29,6 +29,12 @@ type ResolveListTargetOptions = {
|
|
|
29
29
|
/** Candidate requests, most likely first (see `listRequestsForMarker`). */
|
|
30
30
|
requests: readonly ListRequest[];
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* The instance the package already defines for `request` that no paragraph
|
|
34
|
+
* of the story refers to (`referenced`): a new list takes it before one is
|
|
35
|
+
* minted. One rule for both engines.
|
|
36
|
+
*/
|
|
37
|
+
export declare const unusedListInstanceFor: (numbering: NumberingMap, referenced: ReadonlySet<number>, request: ListRequest) => number | undefined;
|
|
32
38
|
/**
|
|
33
39
|
* The list a paragraph range joins: the list directly above it, else the one
|
|
34
40
|
* directly below it, when it matches one of `requests`; otherwise a new list:
|
|
@@ -149,14 +149,17 @@ const referencedNumIds = (doc) => {
|
|
|
149
149
|
* naming a `w:pStyle`, or a style link) belongs to that style and is never
|
|
150
150
|
* offered.
|
|
151
151
|
*/
|
|
152
|
-
const unusedInstanceFor = (numbering, doc, request) =>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
const unusedInstanceFor = (numbering, doc, request) => unusedListInstanceFor(numbering, referencedNumIds(doc), request);
|
|
153
|
+
/**
|
|
154
|
+
* The instance the package already defines for `request` that no paragraph
|
|
155
|
+
* of the story refers to (`referenced`): a new list takes it before one is
|
|
156
|
+
* minted. One rule for both engines.
|
|
157
|
+
*/
|
|
158
|
+
const unusedListInstanceFor = (numbering, referenced, request) => numbering.definitions.nums.find(({ numId, abstractNumId }) => {
|
|
159
|
+
const abstract = numbering.getAbstract(abstractNumId);
|
|
160
|
+
const level = numbering.getLevel(numId, 0);
|
|
161
|
+
return !referenced.has(numId) && abstract !== null && abstract.styleLink === void 0 && abstract.numStyleLink === void 0 && abstract.levels.every(({ pStyle }) => pStyle === void 0) && level !== null && levelMatches(level, request) && (level.start ?? 1) === (request.start ?? level.start ?? 1);
|
|
162
|
+
})?.numId;
|
|
160
163
|
/**
|
|
161
164
|
* The list a paragraph range joins: the list directly above it, else the one
|
|
162
165
|
* directly below it, when it matches one of `requests`; otherwise a new list:
|
|
@@ -348,4 +351,4 @@ const listNumberingMenuState = (state) => restartNumbering(state) ? {
|
|
|
348
351
|
type: "listItem",
|
|
349
352
|
canContinue: continueNumbering(state)
|
|
350
353
|
} : NO_LIST_NUMBERING_MENU;
|
|
351
|
-
export { NO_LIST_NUMBERING_MENU, applyParagraphUpdates, continueNumbering, listItemAttrs, listNumberingMenuState, resolveListTarget, restartNumbering, setNumberingValue };
|
|
354
|
+
export { NO_LIST_NUMBERING_MENU, applyParagraphUpdates, continueNumbering, listItemAttrs, listNumberingMenuState, resolveListTarget, restartNumbering, setNumberingValue, unusedListInstanceFor };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Node } from "prosemirror-model";
|
|
2
|
+
import { LockedControlSpan, LockedControlTouch, LockedControlViolation } from "@stll/docx-core/model";
|
|
3
|
+
import { Transform } from "prosemirror-transform";
|
|
4
|
+
export declare const lockedControlSpans: (doc: Node) => readonly LockedControlSpan[];
|
|
5
|
+
/** What the locks of `doc` say about `touches`: `null` when they permit them all. */
|
|
6
|
+
export declare const lockedControlViolationIn: (doc: Node, touches: readonly LockedControlTouch[]) => LockedControlViolation | null;
|
|
7
|
+
/**
|
|
8
|
+
* What the locks of `transform`'s starting document say about its result: a
|
|
9
|
+
* control whose content is locked must come through with the same content,
|
|
10
|
+
* and one locked against removal must come through at all. Read from the
|
|
11
|
+
* result rather than the steps, so it holds for any step a command takes.
|
|
12
|
+
*/
|
|
13
|
+
export declare const lockedControlViolationOfTransform: (transform: Transform) => LockedControlViolation | null;
|