@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
|
@@ -14,7 +14,7 @@ import { rebaseParagraphRuns } from "../rebaseParagraphRunFormatting.js";
|
|
|
14
14
|
import { RUN_FORMATTING_MARK_NAMES } from "../runFormattingMarkNames.js";
|
|
15
15
|
import { paragraphRunStyleContext } from "../runStyleFormatting.js";
|
|
16
16
|
import { cellPasteRange, pasteTableCells } from "../tableCellPaste.js";
|
|
17
|
-
import { afterNativeCompositionFlush, formattingMarksBesideLockedControl, handleEditorBeforeInput } from "../textInput.js";
|
|
17
|
+
import { afterNativeCompositionFlush, formattingMarksBesideLockedControl, handleEditorBeforeInput, keepTypedTextInComments } from "../textInput.js";
|
|
18
18
|
import { canCarryTrackedRunMark } from "../trackedRunInlineAtoms.js";
|
|
19
19
|
import { getDocumentNumbering } from "./documentNumbering.js";
|
|
20
20
|
import { documentStylesKey, getDocumentStyleResolver } from "./documentStyleState.js";
|
|
@@ -266,8 +266,9 @@ function handleSuggestionPaste(view, slice, pluginState) {
|
|
|
266
266
|
suffix.forEach((node) => {
|
|
267
267
|
if (!node.marks.some((mark) => mark.type === deletionType)) deletedSuffix = false;
|
|
268
268
|
});
|
|
269
|
+
const rotates = deletedSuffix && ($from.parent.attrs["pPrMark"]?.kind ?? "del") === "del" && paragraphEndsItsContainer($from.doc.resolve($from.before()), "paragraph") && slice.content.firstChild?.type === $from.parent.type && slice.content.lastChild?.type === $from.parent.type;
|
|
269
270
|
const tr = view.state.tr.setMeta(SUGGESTION_META, true).setMeta("paste", true);
|
|
270
|
-
const at = $from.before();
|
|
271
|
+
const at = rotates ? $from.after() : $from.before();
|
|
271
272
|
tr.replaceRange(at, at, slice);
|
|
272
273
|
const revision = makeMarkAttrs(pluginState);
|
|
273
274
|
const end = tr.mapping.map(at, 1);
|
|
@@ -290,6 +291,13 @@ function handleSuggestionPaste(view, slice, pluginState) {
|
|
|
290
291
|
return false;
|
|
291
292
|
});
|
|
292
293
|
markRangeAsInserted(tr, tr.doc, at, end, insertionType, deletionType, revision);
|
|
294
|
+
if (rotates) {
|
|
295
|
+
const rotation = tr.steps.length;
|
|
296
|
+
rotateIntoFinalParagraph(view.state, tr, $from.before(), revision);
|
|
297
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(tr.mapping.slice(rotation).map(end, -1)), -1));
|
|
298
|
+
view.dispatch(tr.scrollIntoView());
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
293
301
|
if (deletedSuffix && $from.parent.attrs["pPrMark"] == null && !paragraphEndsItsContainer($from.doc.resolve($from.before()), "paragraph")) tr.setNodeAttribute(tr.mapping.map($from.before()), "pPrMark", {
|
|
294
302
|
kind: "del",
|
|
295
303
|
info: makeParagraphMarkInfo(pluginState)
|
|
@@ -362,9 +370,9 @@ function handleSuggestionPaste(view, slice, pluginState) {
|
|
|
362
370
|
});
|
|
363
371
|
markRangeAsInserted(tr, tr.doc, insertFrom, insertTo, insertionType, deletionType, insertAttrs);
|
|
364
372
|
if (!inlineSlice) carryAcross();
|
|
365
|
-
if (
|
|
366
|
-
const $end = tr.doc.resolve(tr.mapping.map(to));
|
|
367
|
-
if ($end.parent.type.name === "paragraph" && $end.before() !== tr.mapping.map($from.before())) recordReplacedParagraphProperties({
|
|
373
|
+
if ($to.parent.type.name === "paragraph") {
|
|
374
|
+
const $end = tr.doc.resolve(closedBlocks ? Math.max(insertFrom, insertTo - 1) : tr.mapping.map(to));
|
|
375
|
+
if ($end.parent.type.name === "paragraph" && $end.before() !== tr.mapping.map($from.before()) && expectParagraphAttrs($end.parent).pPrMark?.kind !== "ins") recordReplacedParagraphProperties({
|
|
368
376
|
tr,
|
|
369
377
|
position: $end.before(),
|
|
370
378
|
replaced: $to.parent,
|
|
@@ -604,6 +612,18 @@ function applySuggestionInsert(view, from, to, text, pluginState) {
|
|
|
604
612
|
}
|
|
605
613
|
separateSplitStretch(tr, typedFrom, typedTo, insertAttrs.revisionId);
|
|
606
614
|
if (typesOverSelection) tr.setSelection(TextSelection.create(tr.doc, typedTo));
|
|
615
|
+
keepTypedTextInComments({
|
|
616
|
+
state: view.state,
|
|
617
|
+
tr,
|
|
618
|
+
replaced: {
|
|
619
|
+
from,
|
|
620
|
+
to
|
|
621
|
+
},
|
|
622
|
+
typed: {
|
|
623
|
+
from: typedFrom,
|
|
624
|
+
to: typedTo
|
|
625
|
+
}
|
|
626
|
+
});
|
|
607
627
|
view.dispatch(tr.scrollIntoView());
|
|
608
628
|
return true;
|
|
609
629
|
}
|
|
@@ -833,7 +853,7 @@ function isCurrentAuthorParagraphInsertion(value, author) {
|
|
|
833
853
|
/**
|
|
834
854
|
* Handle delete (forward or backward) in suggestion mode.
|
|
835
855
|
*/
|
|
836
|
-
function handleSuggestionDelete(state, dispatch, direction) {
|
|
856
|
+
function handleSuggestionDelete(state, dispatch, direction, { cut = false } = {}) {
|
|
837
857
|
const pluginState = suggestionModeKey.getState(state);
|
|
838
858
|
if (!pluginState?.active) return false;
|
|
839
859
|
const { $from, $to, empty } = state.selection;
|
|
@@ -849,8 +869,11 @@ function handleSuggestionDelete(state, dispatch, direction) {
|
|
|
849
869
|
to: rangeTo.pos
|
|
850
870
|
}).sort((a, b) => b.from - a.from);
|
|
851
871
|
for (const { from, to } of ranges) markRangeAsDeleted(tr, state.doc, from, to, deletionType, pluginState, state);
|
|
852
|
-
if (state.selection instanceof CellSelection) tr.setSelection(state.selection.map(tr.doc, tr.mapping));
|
|
853
|
-
else {
|
|
872
|
+
if (state.selection instanceof CellSelection && !cut) tr.setSelection(state.selection.map(tr.doc, tr.mapping));
|
|
873
|
+
else if (state.selection instanceof CellSelection) {
|
|
874
|
+
const caret = Selection.findFrom(tr.doc.resolve(tr.mapping.map(state.selection.to)), -1);
|
|
875
|
+
if (caret) tr.setSelection(caret);
|
|
876
|
+
} else {
|
|
854
877
|
const cursorPos = tr.mapping.map($to.pos);
|
|
855
878
|
tr.setSelection(TextSelection.near(tr.doc.resolve(cursorPos)));
|
|
856
879
|
}
|
|
@@ -894,7 +917,7 @@ function handleSuggestionDelete(state, dispatch, direction) {
|
|
|
894
917
|
return true;
|
|
895
918
|
}
|
|
896
919
|
/** Apply the editor's selected-content deletion path for a host cut action. */
|
|
897
|
-
const deleteSelectionAsSuggestion = (state, dispatch) => state.selection.empty ? false : handleSuggestionDelete(state, dispatch, "forward");
|
|
920
|
+
const deleteSelectionAsSuggestion = (state, dispatch) => state.selection.empty ? false : handleSuggestionDelete(state, dispatch, "forward", { cut: true });
|
|
898
921
|
/**
|
|
899
922
|
* PM reads the removal of cancelled text back from the DOM, which can take the
|
|
900
923
|
* text around it along and drop its revision marks. The same text was there when
|
|
@@ -1123,7 +1146,7 @@ function createSuggestionModePlugin(initialActive = false, author = "User") {
|
|
|
1123
1146
|
data.setData("text/html", dom.innerHTML);
|
|
1124
1147
|
data.setData("text/plain", text);
|
|
1125
1148
|
event.preventDefault();
|
|
1126
|
-
return handleSuggestionDelete(view.state, view.dispatch, "forward");
|
|
1149
|
+
return handleSuggestionDelete(view.state, view.dispatch, "forward", { cut: true });
|
|
1127
1150
|
},
|
|
1128
1151
|
compositionstart(view) {
|
|
1129
1152
|
if (!suggestionModeKey.getState(view.state)?.active) return false;
|
|
@@ -78,6 +78,21 @@ const FIELD_PATH_HEAD_RE = /^[\p{L}_]/u;
|
|
|
78
78
|
* keeps a real expression on exact matching.
|
|
79
79
|
*/
|
|
80
80
|
const filterChainPath = ({ conditionPath }) => conditionPath !== void 0 && isFieldPath(conditionPath) && FIELD_PATH_HEAD_RE.test(conditionPath) ? conditionPath : void 0;
|
|
81
|
+
const isPreviewSpan = (span) => typeof span === "object" && span !== null && typeof Reflect.get(span, "text") === "string";
|
|
82
|
+
/**
|
|
83
|
+
* The value stored under one key, read like {@link ownVerdict}: only a key the
|
|
84
|
+
* host set itself, holding text or a list of text spans, counts. A marker named
|
|
85
|
+
* after an inherited property (`constructor`) or holding a malformed value
|
|
86
|
+
* keeps its authored text.
|
|
87
|
+
*/
|
|
88
|
+
const ownPreviewValue = (values, key) => {
|
|
89
|
+
if (!Object.hasOwn(values, key)) return;
|
|
90
|
+
const value = values[key];
|
|
91
|
+
if (typeof value === "string") return value;
|
|
92
|
+
if (typeof value !== "object" || value === null) return;
|
|
93
|
+
const runs = Reflect.get(value, "runs");
|
|
94
|
+
return Array.isArray(runs) && runs.every(isPreviewSpan) ? { runs } : void 0;
|
|
95
|
+
};
|
|
81
96
|
/**
|
|
82
97
|
* The verdict stored under one key. Only a key the host set itself, holding a
|
|
83
98
|
* real boolean, counts: an inherited property (`constructor`, or a boolean the
|
|
@@ -189,7 +204,7 @@ function collectPreviewEntries(ranges, values, hidden) {
|
|
|
189
204
|
const entries = [];
|
|
190
205
|
for (const range of ranges) {
|
|
191
206
|
if (range.kind !== "placeholder" && range.kind !== "clause") continue;
|
|
192
|
-
const value = values
|
|
207
|
+
const value = ownPreviewValue(values, range.expr);
|
|
193
208
|
if (value === void 0 || templatePreviewValueText(value) === "") continue;
|
|
194
209
|
if (hidden.some((block) => range.from >= block.from && range.from < block.to)) continue;
|
|
195
210
|
entries.push({
|
|
@@ -6,7 +6,7 @@ import { paragraphRunStyleContext } from "./runStyleFormatting.js";
|
|
|
6
6
|
import { Mark } from "prosemirror-model";
|
|
7
7
|
// src/prosemirror/rebaseParagraphRuns.ts
|
|
8
8
|
/** Two contexts that lend runs the same formatting: rebasing between them changes nothing. */
|
|
9
|
-
const sameRunStyleContext = (source, target) =>
|
|
9
|
+
const sameRunStyleContext = (source, target) => formattingEquals(source.baseParagraphFormatting, target.baseParagraphFormatting) && formattingEquals(source.paragraphFormatting, target.paragraphFormatting) && formattingEquals(source.paragraphMarkFormatting, target.paragraphMarkFormatting);
|
|
10
10
|
/** Rebuild rendered marks after the paragraph's style cascade changes. */
|
|
11
11
|
const rebaseParagraphRuns = ({ tr, position, previous, target, styleResolver, range, storedMarks: initialStoredMarks }) => {
|
|
12
12
|
const paragraph = tr.doc.nodeAt(position);
|
|
@@ -147,6 +147,7 @@ const createResolvedCommentPointCollector = ({ removes, retiresStructure }) => {
|
|
|
147
147
|
const removedWithStructure = removedStructures.some(({ from, to }) => position > from && position < to);
|
|
148
148
|
for (const mark of node.marks) {
|
|
149
149
|
if (mark.type.name !== "comment") continue;
|
|
150
|
+
if (mark.attrs["point"] === true) continue;
|
|
150
151
|
const id = mark.attrs["commentId"];
|
|
151
152
|
if (!removedWithStructure && !removes(node, position)) retained.add(id);
|
|
152
153
|
else if (!points.has(id)) points.set(id, position);
|
|
@@ -9,7 +9,6 @@ export type MarksToTextFormattingOptions = {
|
|
|
9
9
|
baseParagraphFormatting?: document_d_exports.TextFormatting | undefined;
|
|
10
10
|
inheritedFormatting?: document_d_exports.TextFormatting | undefined;
|
|
11
11
|
paragraphMarkFormatting?: document_d_exports.TextFormatting | undefined;
|
|
12
|
-
paragraphMarkPrecedesStyle?: boolean | undefined;
|
|
13
12
|
styleResolver?: RunStyleResolver | null | undefined;
|
|
14
13
|
};
|
|
15
14
|
/** Overlay only changed visual marks; private authored properties stay with the run. */
|
|
@@ -533,8 +533,7 @@ function marksToTextFormatting(marks, options) {
|
|
|
533
533
|
const runContext = {
|
|
534
534
|
baseParagraphFormatting: options?.baseParagraphFormatting,
|
|
535
535
|
paragraphFormatting: options?.inheritedFormatting,
|
|
536
|
-
paragraphMarkFormatting: options?.paragraphMarkFormatting
|
|
537
|
-
paragraphMarkPrecedesStyle: options?.paragraphMarkPrecedesStyle ?? false
|
|
536
|
+
paragraphMarkFormatting: options?.paragraphMarkFormatting
|
|
538
537
|
};
|
|
539
538
|
const paragraphFormatting = paragraphFormattingForRun({
|
|
540
539
|
context: runContext,
|
|
@@ -557,8 +556,7 @@ function marksToTextFormatting(marks, options) {
|
|
|
557
556
|
const suppressedParagraphFormatting = suppressParagraphMarkFormatting({
|
|
558
557
|
baseFormatting: options.baseParagraphFormatting,
|
|
559
558
|
directFormatting: authoredFormatting,
|
|
560
|
-
paragraphMarkFormatting: options.paragraphMarkFormatting
|
|
561
|
-
paragraphMarkPrecedesStyle: options.paragraphMarkPrecedesStyle ?? false
|
|
559
|
+
paragraphMarkFormatting: options.paragraphMarkFormatting
|
|
562
560
|
});
|
|
563
561
|
const suppressedInheritedFormatting = resolveEffectiveRunStyleFormatting({
|
|
564
562
|
marks,
|
|
@@ -12,7 +12,6 @@ const readAuthoredRunFormatting = ({ context, marks, styleResolver }) => marksTo
|
|
|
12
12
|
baseParagraphFormatting: context.baseParagraphFormatting,
|
|
13
13
|
inheritedFormatting: context.paragraphFormatting,
|
|
14
14
|
paragraphMarkFormatting: context.paragraphMarkFormatting,
|
|
15
|
-
paragraphMarkPrecedesStyle: context.paragraphMarkPrecedesStyle,
|
|
16
15
|
...styleResolver !== void 0 ? { styleResolver } : {}
|
|
17
16
|
});
|
|
18
17
|
/** Preserve the authored distinction between an absent and empty property set in revisions. */
|
|
@@ -49,7 +48,8 @@ const reconcileRunFormattingMarks = ({ authoredFormatting, context, node, styleR
|
|
|
49
48
|
const paragraphMarkOverrides = isParagraphMarkSuppressionEligible(authoredFormatting) ? getParagraphMarkSuppressionOverrides({
|
|
50
49
|
directFormatting: authoredFormatting,
|
|
51
50
|
paragraphMarkFormatting: context.paragraphMarkFormatting,
|
|
52
|
-
suppressedFormatting: paragraphFormatting
|
|
51
|
+
suppressedFormatting: paragraphFormatting,
|
|
52
|
+
characterStyleFormatting: authoredFormatting.styleId === void 0 ? void 0 : styleResolver?.getRunStyleOwnProperties(authoredFormatting.styleId) ?? void 0
|
|
53
53
|
}) : void 0;
|
|
54
54
|
const overrideFormatting = mergeTextFormatting(paragraphMarkOverrides, authoredFormatting);
|
|
55
55
|
const formattingMarks = textFormattingToMarks(effectiveFormatting, node.type.schema, {
|
|
@@ -14,4 +14,26 @@ export declare const continueSourceCarrierIdentitiesAcrossRevisions: (nodes: rea
|
|
|
14
14
|
* A deleted paragraph mark joined two source paragraphs, whose carriers were
|
|
15
15
|
* always separate, so it is not crossed.
|
|
16
16
|
*/
|
|
17
|
-
export declare const continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks: (blocks: readonly Node[]) => readonly Node[];
|
|
17
|
+
export declare const continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks: (blocks: readonly Node[]) => readonly Node[];
|
|
18
|
+
/** One pass of the continuation over a story's top-level blocks. */
|
|
19
|
+
export type ContinuedBlocks = {
|
|
20
|
+
blocks: readonly Node[];
|
|
21
|
+
continued: readonly Node[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Kept across passes over one story: the last pass and each container
|
|
25
|
+
* continued inside, so a container a pass left is not walked again.
|
|
26
|
+
*/
|
|
27
|
+
export declare class CarrierContinuationCache {
|
|
28
|
+
last: ContinuedBlocks | undefined;
|
|
29
|
+
readonly containers: WeakMap<Node, Node>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* {@link continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks} over a
|
|
33
|
+
* story's top-level blocks, keeping what the last pass gave the blocks it
|
|
34
|
+
* left. A block's continuation reads only the block and the one continued
|
|
35
|
+
* before it, so the run of blocks from the start that the last pass was given
|
|
36
|
+
* keeps its result, and a block of the run to the end keeps its result once
|
|
37
|
+
* the block before it continued to what it did then.
|
|
38
|
+
*/
|
|
39
|
+
export declare const continueSourceCarrierIdentitiesKeeping: (blocks: readonly Node[], cache: CarrierContinuationCache) => readonly Node[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expectHyperlinkMarkAttrs, expectRunIdentityMarkAttrs } from "./attrs/index.js";
|
|
2
2
|
import "./extensions/nodes/SdtExtension.js";
|
|
3
3
|
import { RUN_IDENTITY_MARK_NAME } from "./runIdentity.js";
|
|
4
|
+
import { panic } from "better-result";
|
|
4
5
|
import { Fragment, Mark } from "prosemirror-model";
|
|
5
6
|
// src/prosemirror/runIdentityAcrossRevisions.ts
|
|
6
7
|
/**
|
|
@@ -161,17 +162,65 @@ const continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks = (blocks) =>
|
|
|
161
162
|
let changed = false;
|
|
162
163
|
const result = [];
|
|
163
164
|
for (const block of blocks) {
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
const next = continuedBlock(result.at(-1), block);
|
|
166
|
+
changed ||= next !== block;
|
|
167
|
+
result.push(next);
|
|
168
|
+
}
|
|
169
|
+
return changed ? result : blocks;
|
|
170
|
+
};
|
|
171
|
+
/** `block` as it stands after `previous`, the block before it as continued. */
|
|
172
|
+
const continuedBlock = (previous, block, containers) => {
|
|
173
|
+
let next = block;
|
|
174
|
+
if (!block.isTextblock && !block.isLeaf && !block.inlineContent) {
|
|
175
|
+
const known = containers?.get(block);
|
|
176
|
+
if (known === void 0) {
|
|
166
177
|
const children = childrenOf(block);
|
|
167
178
|
const continued = continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks(children);
|
|
168
179
|
if (continued !== children) next = block.copy(Fragment.fromArray([...continued]));
|
|
180
|
+
containers?.set(block, next);
|
|
181
|
+
} else next = known;
|
|
182
|
+
}
|
|
183
|
+
if (previous !== void 0 && next.type.name === "paragraph" && endsWithInsertedMark(previous)) next = continueAcrossInsertedMark(previous, next);
|
|
184
|
+
return next;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Kept across passes over one story: the last pass and each container
|
|
188
|
+
* continued inside, so a container a pass left is not walked again.
|
|
189
|
+
*/
|
|
190
|
+
var CarrierContinuationCache = class {
|
|
191
|
+
last;
|
|
192
|
+
containers = /* @__PURE__ */ new WeakMap();
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* {@link continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks} over a
|
|
196
|
+
* story's top-level blocks, keeping what the last pass gave the blocks it
|
|
197
|
+
* left. A block's continuation reads only the block and the one continued
|
|
198
|
+
* before it, so the run of blocks from the start that the last pass was given
|
|
199
|
+
* keeps its result, and a block of the run to the end keeps its result once
|
|
200
|
+
* the block before it continued to what it did then.
|
|
201
|
+
*/
|
|
202
|
+
const continueSourceCarrierIdentitiesKeeping = (blocks, cache) => {
|
|
203
|
+
const last = cache.last;
|
|
204
|
+
const before = last?.blocks ?? [];
|
|
205
|
+
const kept = last?.continued ?? [];
|
|
206
|
+
let start = 0;
|
|
207
|
+
while (start < blocks.length && start < before.length && blocks[start] === before[start]) start += 1;
|
|
208
|
+
let after = 0;
|
|
209
|
+
while (after < blocks.length - start && after < before.length - start && blocks[blocks.length - 1 - after] === before[before.length - 1 - after]) after += 1;
|
|
210
|
+
const shift = before.length - blocks.length;
|
|
211
|
+
const continued = kept.slice(0, start);
|
|
212
|
+
for (let index = start; index < blocks.length; index += 1) {
|
|
213
|
+
const at = index + shift;
|
|
214
|
+
if (index >= blocks.length - after && continued[index - 1] === (at === 0 ? void 0 : kept[at - 1])) {
|
|
215
|
+
for (let rest = at; rest < kept.length; rest += 1) continued.push(kept[rest] ?? panic("Missing continued block"));
|
|
216
|
+
break;
|
|
169
217
|
}
|
|
170
|
-
|
|
171
|
-
if (previous !== void 0 && next.type.name === "paragraph" && endsWithInsertedMark(previous)) next = continueAcrossInsertedMark(previous, next);
|
|
172
|
-
changed ||= next !== block;
|
|
173
|
-
result.push(next);
|
|
218
|
+
continued.push(continuedBlock(continued[index - 1], blocks[index] ?? panic("Missing block"), cache.containers));
|
|
174
219
|
}
|
|
175
|
-
|
|
220
|
+
cache.last = {
|
|
221
|
+
blocks,
|
|
222
|
+
continued
|
|
223
|
+
};
|
|
224
|
+
return continued;
|
|
176
225
|
};
|
|
177
|
-
export { SOURCE_CARRIER_MARK_NAMES, continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks, continueSourceCarrierIdentitiesAcrossRevisions };
|
|
226
|
+
export { CarrierContinuationCache, SOURCE_CARRIER_MARK_NAMES, continueSourceCarrierIdentitiesAcrossInsertedParagraphMarks, continueSourceCarrierIdentitiesAcrossRevisions, continueSourceCarrierIdentitiesKeeping };
|
|
@@ -36,8 +36,7 @@ const restoreHistoricalRunFormatting = ({ node, paragraphContext, styleResolver
|
|
|
36
36
|
context: {
|
|
37
37
|
baseParagraphFormatting: paragraphContext.baseParagraphFormatting,
|
|
38
38
|
paragraphFormatting: paragraphContext.baseParagraphFormatting,
|
|
39
|
-
paragraphMarkFormatting: void 0
|
|
40
|
-
paragraphMarkPrecedesStyle: false
|
|
39
|
+
paragraphMarkFormatting: void 0
|
|
41
40
|
},
|
|
42
41
|
marks: node.marks,
|
|
43
42
|
...styleResolver !== void 0 ? { styleResolver } : {}
|
|
@@ -7,25 +7,35 @@ export declare const hasDirectRunFormatting: (formatting: document_d_exports.Tex
|
|
|
7
7
|
/** A stated run property or character style establishes paragraph-mark suppression. */
|
|
8
8
|
export declare const isParagraphMarkSuppressionEligible: (formatting: document_d_exports.TextFormatting | undefined) => boolean;
|
|
9
9
|
export declare const stripParagraphMarkOnlyFormatting: (formatting: document_d_exports.TextFormatting) => document_d_exports.TextFormatting | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a paragraph's mark lends its run properties to the paragraph's
|
|
12
|
+
* runs: only when the paragraph has no style. One rule for reading a run and
|
|
13
|
+
* for the save's view of what a run inherited.
|
|
14
|
+
*/
|
|
15
|
+
export declare const paragraphMarkLendsRuns: (styleId: string | undefined) => boolean;
|
|
10
16
|
export declare const stripParagraphMarkFormattingForBodyRuns: (formatting: document_d_exports.TextFormatting) => document_d_exports.TextFormatting | undefined;
|
|
11
17
|
type SuppressParagraphMarkFormattingOptions = {
|
|
12
18
|
baseFormatting: document_d_exports.TextFormatting | undefined;
|
|
13
19
|
directFormatting: document_d_exports.TextFormatting | undefined;
|
|
14
20
|
paragraphMarkFormatting: document_d_exports.TextFormatting | undefined;
|
|
15
|
-
paragraphMarkPrecedesStyle?: boolean;
|
|
16
21
|
};
|
|
17
|
-
export declare const suppressParagraphMarkFormatting: ({ baseFormatting, directFormatting, paragraphMarkFormatting
|
|
22
|
+
export declare const suppressParagraphMarkFormatting: ({ baseFormatting, directFormatting, paragraphMarkFormatting }: SuppressParagraphMarkFormattingOptions) => document_d_exports.TextFormatting | undefined;
|
|
18
23
|
type GetParagraphMarkSuppressionOverridesOptions = {
|
|
19
24
|
directFormatting: document_d_exports.TextFormatting | undefined;
|
|
20
25
|
paragraphMarkFormatting: document_d_exports.TextFormatting | undefined;
|
|
21
26
|
suppressedFormatting: document_d_exports.TextFormatting | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The run's own character style. A property it states is the style's to
|
|
29
|
+
* give, not the paragraph mark's to take away: the run keeps it as the
|
|
30
|
+
* style cascade resolves it, with no override saying it is off.
|
|
31
|
+
*/
|
|
32
|
+
characterStyleFormatting: document_d_exports.TextFormatting | undefined;
|
|
22
33
|
};
|
|
23
|
-
export declare const getParagraphMarkSuppressionOverrides: ({ directFormatting, paragraphMarkFormatting, suppressedFormatting }: GetParagraphMarkSuppressionOverridesOptions) => document_d_exports.TextFormatting | undefined;
|
|
34
|
+
export declare const getParagraphMarkSuppressionOverrides: ({ directFormatting, paragraphMarkFormatting, suppressedFormatting, characterStyleFormatting }: GetParagraphMarkSuppressionOverridesOptions) => document_d_exports.TextFormatting | undefined;
|
|
24
35
|
export type ParagraphRunStyleContext = {
|
|
25
36
|
baseParagraphFormatting: document_d_exports.TextFormatting | undefined;
|
|
26
37
|
paragraphFormatting: document_d_exports.TextFormatting | undefined;
|
|
27
38
|
paragraphMarkFormatting: document_d_exports.TextFormatting | undefined;
|
|
28
|
-
paragraphMarkPrecedesStyle: boolean;
|
|
29
39
|
};
|
|
30
40
|
export type RunStyleResolver = Pick<StyleEngine, "builtInStyles" | "getDefaultCharacterStyle" | "getDefaultParagraphStyle" | "getDocDefaults" | "getRunStyleOwnProperties" | "getStyle" | "resolveParagraphStyle">;
|
|
31
41
|
type ResolveParagraphBodyRunFormattingOptions = {
|
|
@@ -26,26 +26,32 @@ const stripParagraphMarkOnlyFormatting = (formatting) => {
|
|
|
26
26
|
const { allCaps: _allCaps, highlight: _highlight, shading: _shading, smallCaps: _smallCaps, vertAlign: _vertAlign, preserved: _preserved, ...formattingForBody } = formatting;
|
|
27
27
|
return Object.keys(formattingForBody).length > 0 ? formattingForBody : void 0;
|
|
28
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Whether a paragraph's mark lends its run properties to the paragraph's
|
|
31
|
+
* runs: only when the paragraph has no style. One rule for reading a run and
|
|
32
|
+
* for the save's view of what a run inherited.
|
|
33
|
+
*/
|
|
34
|
+
const paragraphMarkLendsRuns = (styleId) => styleId === void 0;
|
|
29
35
|
const stripParagraphMarkFormattingForBodyRuns = (formatting) => {
|
|
30
36
|
const paragraphMarkFormatting = stripParagraphMarkOnlyFormatting(formatting);
|
|
31
37
|
if (!paragraphMarkFormatting) return;
|
|
32
38
|
const { fontFamily: _fontFamily, ...bodyRunFormatting } = paragraphMarkFormatting;
|
|
33
39
|
return Object.keys(bodyRunFormatting).length > 0 ? bodyRunFormatting : void 0;
|
|
34
40
|
};
|
|
35
|
-
const suppressParagraphMarkFormatting = ({ baseFormatting, directFormatting, paragraphMarkFormatting
|
|
41
|
+
const suppressParagraphMarkFormatting = ({ baseFormatting, directFormatting, paragraphMarkFormatting }) => {
|
|
36
42
|
if (!paragraphMarkFormatting) return baseFormatting;
|
|
37
|
-
const result =
|
|
43
|
+
const result = mergeTextFormatting(baseFormatting, paragraphMarkFormatting) ?? {};
|
|
38
44
|
for (const property of PARAGRAPH_MARK_BOOLEAN_KEYS) if (paragraphMarkFormatting[property] !== void 0 && directFormatting?.[property] === void 0) Reflect.set(result, property, baseFormatting?.[property] ?? false);
|
|
39
45
|
for (const property of ["fontSize", "fontSizeCs"]) if (paragraphMarkFormatting[property] !== void 0 && directFormatting?.[property] === void 0 && baseFormatting?.[property] !== void 0) result[property] = baseFormatting[property];
|
|
40
46
|
if (paragraphMarkFormatting.underline !== void 0 && directFormatting?.underline === void 0) result.underline = { style: "none" };
|
|
41
47
|
if (paragraphMarkFormatting.spacing !== void 0 && directFormatting?.spacing === void 0) result.spacing = 0;
|
|
42
48
|
return Object.keys(result).length > 0 ? result : void 0;
|
|
43
49
|
};
|
|
44
|
-
const getParagraphMarkSuppressionOverrides = ({ directFormatting, paragraphMarkFormatting, suppressedFormatting }) => {
|
|
50
|
+
const getParagraphMarkSuppressionOverrides = ({ directFormatting, paragraphMarkFormatting, suppressedFormatting, characterStyleFormatting }) => {
|
|
45
51
|
if (!paragraphMarkFormatting) return;
|
|
46
52
|
const overrides = {};
|
|
47
|
-
for (const property of PARAGRAPH_MARK_BOOLEAN_KEYS) if (paragraphMarkFormatting[property] !== void 0 && directFormatting?.[property] === void 0 && suppressedFormatting?.[property] === false) Reflect.set(overrides, property, false);
|
|
48
|
-
if (paragraphMarkFormatting.underline !== void 0 && directFormatting?.underline === void 0 && suppressedFormatting?.underline?.style === "none") overrides.underline = { style: "none" };
|
|
53
|
+
for (const property of PARAGRAPH_MARK_BOOLEAN_KEYS) if (paragraphMarkFormatting[property] !== void 0 && directFormatting?.[property] === void 0 && characterStyleFormatting?.[property] === void 0 && suppressedFormatting?.[property] === false) Reflect.set(overrides, property, false);
|
|
54
|
+
if (paragraphMarkFormatting.underline !== void 0 && directFormatting?.underline === void 0 && characterStyleFormatting?.underline === void 0 && suppressedFormatting?.underline?.style === "none") overrides.underline = { style: "none" };
|
|
49
55
|
return Object.keys(overrides).length > 0 ? overrides : void 0;
|
|
50
56
|
};
|
|
51
57
|
const withoutFontFamily = (formatting) => {
|
|
@@ -137,7 +143,7 @@ const resolveParagraphInheritedRunFormatting = (options) => {
|
|
|
137
143
|
};
|
|
138
144
|
const paragraphRunStyleContext = (paragraph, styleResolver) => {
|
|
139
145
|
const attrs = expectParagraphAttrs(paragraph);
|
|
140
|
-
const paragraphMarkFormatting = attrs._originalFormatting?.runProperties;
|
|
146
|
+
const paragraphMarkFormatting = paragraphMarkLendsRuns(attrs.styleId) ? attrs._originalFormatting?.runProperties : void 0;
|
|
141
147
|
const characterStyleFormatting = paragraphMarkFormatting?.styleId ? styleResolver?.getRunStyleOwnProperties(paragraphMarkFormatting.styleId) : void 0;
|
|
142
148
|
const resolvedParagraphMarkFormatting = cascadeStyleTextFormatting([{
|
|
143
149
|
formatting: characterStyleFormatting,
|
|
@@ -154,8 +160,7 @@ const paragraphRunStyleContext = (paragraph, styleResolver) => {
|
|
|
154
160
|
styleResolver
|
|
155
161
|
}).defaultFormatting,
|
|
156
162
|
paragraphFormatting: attrs.defaultTextFormatting ?? void 0,
|
|
157
|
-
paragraphMarkFormatting: inheritableParagraphMarkFormatting
|
|
158
|
-
paragraphMarkPrecedesStyle: attrs.styleId !== void 0
|
|
163
|
+
paragraphMarkFormatting: inheritableParagraphMarkFormatting
|
|
159
164
|
};
|
|
160
165
|
};
|
|
161
166
|
const paragraphFormattingForRun = ({ context, directFormatting, marks }) => {
|
|
@@ -163,8 +168,7 @@ const paragraphFormattingForRun = ({ context, directFormatting, marks }) => {
|
|
|
163
168
|
return suppressParagraphMarkFormatting({
|
|
164
169
|
baseFormatting: context.baseParagraphFormatting,
|
|
165
170
|
directFormatting,
|
|
166
|
-
paragraphMarkFormatting: context.paragraphMarkFormatting
|
|
167
|
-
paragraphMarkPrecedesStyle: context.paragraphMarkPrecedesStyle
|
|
171
|
+
paragraphMarkFormatting: context.paragraphMarkFormatting
|
|
168
172
|
});
|
|
169
173
|
};
|
|
170
174
|
const paragraphRunStyleContextAt = ({ doc, pos, styleResolver }) => {
|
|
@@ -183,8 +187,7 @@ const paragraphRunStyleContextAt = ({ doc, pos, styleResolver }) => {
|
|
|
183
187
|
const nearestParagraphRunStyleContext = (paragraph, styleResolver) => paragraph ? paragraphRunStyleContext(paragraph, styleResolver) : {
|
|
184
188
|
baseParagraphFormatting: void 0,
|
|
185
189
|
paragraphFormatting: void 0,
|
|
186
|
-
paragraphMarkFormatting: void 0
|
|
187
|
-
paragraphMarkPrecedesStyle: false
|
|
190
|
+
paragraphMarkFormatting: void 0
|
|
188
191
|
};
|
|
189
192
|
/** Resolve the non-direct run cascade from shared document styles and the current paragraph. */
|
|
190
193
|
const resolveEffectiveRunStyleFormatting = ({ marks, paragraphFormatting, styleResolver }) => {
|
|
@@ -202,4 +205,4 @@ const resolveEffectiveRunStyleFormatting = ({ marks, paragraphFormatting, styleR
|
|
|
202
205
|
styleFormatting
|
|
203
206
|
});
|
|
204
207
|
};
|
|
205
|
-
export { getParagraphMarkSuppressionOverrides, hasDirectRunFormatting, isParagraphMarkSuppressionEligible, nearestParagraphRunStyleContext, paragraphFormattingForRun, paragraphRunStyleContext, paragraphRunStyleContextAt, resolveEffectiveRunStyleFormatting, resolveParagraphBodyRunFormatting, resolveParagraphInheritedRunFormatting, stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting, suppressParagraphMarkFormatting };
|
|
208
|
+
export { getParagraphMarkSuppressionOverrides, hasDirectRunFormatting, isParagraphMarkSuppressionEligible, nearestParagraphRunStyleContext, paragraphFormattingForRun, paragraphMarkLendsRuns, paragraphRunStyleContext, paragraphRunStyleContextAt, resolveEffectiveRunStyleFormatting, resolveParagraphBodyRunFormatting, resolveParagraphInheritedRunFormatting, stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting, suppressParagraphMarkFormatting };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ShadingProperties } from "../../types/colors.js";
|
|
2
1
|
import { document_d_exports } from "../../types/document.js";
|
|
2
|
+
import { ShadingProperties } from "../../types/colors.js";
|
|
3
3
|
import { TrackedCommentBoundary } from "../commentBoundaryOwnership.js";
|
|
4
4
|
/**
|
|
5
5
|
* Text color mark attributes
|
|
@@ -86,6 +86,18 @@ export type FootnoteRefAttrs = {
|
|
|
86
86
|
};
|
|
87
87
|
export type CommentAttrs = {
|
|
88
88
|
commentId: number;
|
|
89
|
+
/**
|
|
90
|
+
* The comment was authored at a point (a bare `w:commentReference`): this
|
|
91
|
+
* mark only shows it on the text before the reference. The comment lives
|
|
92
|
+
* as long as its reference does, and saves as a point again.
|
|
93
|
+
*/
|
|
94
|
+
point?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* The pending suggestion that proposed this comment. A proposed comment
|
|
97
|
+
* is never saved: it is accepted with its suggestion, which clears this,
|
|
98
|
+
* or removed when the suggestion is rejected.
|
|
99
|
+
*/
|
|
100
|
+
suggestionId?: string;
|
|
89
101
|
};
|
|
90
102
|
/**
|
|
91
103
|
* Provenance of a tracked change.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createNumberingIdAllocator } from "../docx/numberingIds.js";
|
|
1
|
+
import { createNumberingIdAllocator, numberingNumIdsTaken } from "../docx/numberingIds.js";
|
|
2
2
|
import { getCachedNumberingMap, isBulletLevel } from "../docx/numberingParser.js";
|
|
3
3
|
import { paragraphNumberingReference } from "../docx/numberingReference.js";
|
|
4
4
|
import { expectParagraphAttrs } from "./attrs/index.js";
|
|
@@ -57,7 +57,12 @@ const storyListNumbering = (state, numbering) => {
|
|
|
57
57
|
doc: state.doc,
|
|
58
58
|
numbering: completeNumberingForDoc(numbering, state.doc)
|
|
59
59
|
};
|
|
60
|
-
const existingNumIds = [
|
|
60
|
+
const existingNumIds = [
|
|
61
|
+
...defined,
|
|
62
|
+
...referenced,
|
|
63
|
+
...numberingNumIdsTaken(numbering),
|
|
64
|
+
...numberingNumIdsTaken(packageDefinitions)
|
|
65
|
+
];
|
|
61
66
|
const numIds = createNumberingIdAllocator("num", existingNumIds);
|
|
62
67
|
const remap = {
|
|
63
68
|
numIds: new Map([...colliding].map((numId) => [numId, numIds.next()])),
|
|
@@ -5,7 +5,7 @@ import { paragraphNumberingAttr } from "../numberingAttr.js";
|
|
|
5
5
|
import { directionFromBidi } from "../paragraphDirection.js";
|
|
6
6
|
import { styleResolvedParagraphFormatting } from "../paragraphFormattingProvenance.js";
|
|
7
7
|
import { lineSpacingProvenanceFromSpacing } from "../paragraphSpacing.js";
|
|
8
|
-
import { stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting } from "../runStyleFormatting.js";
|
|
8
|
+
import { paragraphMarkLendsRuns, stripParagraphMarkFormattingForBodyRuns, stripParagraphMarkOnlyFormatting } from "../runStyleFormatting.js";
|
|
9
9
|
import { cascadeStyleTextFormatting } from "./styleToggleCascade.js";
|
|
10
10
|
// src/prosemirror/styles/paragraphStyleCascade.ts
|
|
11
11
|
/**
|
|
@@ -36,7 +36,7 @@ function resolveRunFormattingWithoutDefaults(formatting, styleResolver) {
|
|
|
36
36
|
* document read and for a paragraph whose properties a review restores.
|
|
37
37
|
*/
|
|
38
38
|
const inheritableParagraphMarkFormatting = ({ runProperties, styleId, styleResolver }) => {
|
|
39
|
-
if (styleId
|
|
39
|
+
if (!paragraphMarkLendsRuns(styleId)) return void 0;
|
|
40
40
|
const formatting = resolveRunFormattingWithoutDefaults(runProperties, styleResolver);
|
|
41
41
|
return formatting ? stripParagraphMarkFormattingForBodyRuns(formatting) : void 0;
|
|
42
42
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Command } from "prosemirror-state";
|
|
1
2
|
import { EditorView } from "prosemirror-view";
|
|
2
3
|
/** 1px ≈ 15 twips at 96dpi (20 twips/pt × 72pt/in ÷ 96px/in). */
|
|
3
4
|
export declare const TWIPS_PER_PIXEL = 15;
|
|
@@ -24,23 +25,23 @@ export declare function readColumnWidths(view: EditorView, pmStart: number, colI
|
|
|
24
25
|
export declare function readRowHeight(view: EditorView, pmStart: number, rowIndex: number): number | null;
|
|
25
26
|
/** Read the last-column width (the one being resized from the table's right edge). */
|
|
26
27
|
export declare function readColumnWidthAt(view: EditorView, pmStart: number, colIndex: number): number | null;
|
|
27
|
-
/**
|
|
28
|
-
export declare
|
|
28
|
+
/** A column-pair resize, preserving each spanning cell's full grid width. */
|
|
29
|
+
export declare const columnResizeCommand: (opts: {
|
|
29
30
|
pmStart: number;
|
|
30
31
|
colIdx: number;
|
|
31
32
|
newLeft: number;
|
|
32
33
|
newRight: number;
|
|
33
|
-
})
|
|
34
|
-
/**
|
|
35
|
-
export declare
|
|
34
|
+
}) => Command;
|
|
35
|
+
/** A row resize: the row's `height`, at least that tall. */
|
|
36
|
+
export declare const rowResizeCommand: (opts: {
|
|
36
37
|
pmStart: number;
|
|
37
38
|
rowIdx: number;
|
|
38
39
|
newHeight: number;
|
|
39
|
-
})
|
|
40
|
-
/**
|
|
41
|
-
export declare
|
|
40
|
+
}) => Command;
|
|
41
|
+
/** A right-edge resize, including cells that span the resized column. */
|
|
42
|
+
export declare const rightEdgeResizeCommand: (opts: {
|
|
42
43
|
pmStart: number;
|
|
43
44
|
colIdx: number;
|
|
44
45
|
newWidth: number;
|
|
45
|
-
})
|
|
46
|
+
}) => Command;
|
|
46
47
|
export {};
|