@stll/folio-core 0.66.2 → 0.68.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 +138 -17
- package/dist/ai-edits/batch-claims.js +5 -3
- package/dist/ai-edits/clean-text.js +4 -1
- package/dist/ai-edits/headless.d.ts +36 -21
- package/dist/ai-edits/headless.js +104 -34
- package/dist/ai-edits/index.d.ts +2 -2
- package/dist/ai-edits/note-references.d.ts +6 -0
- package/dist/ai-edits/note-references.js +7 -1
- package/dist/ai-edits/read.d.ts +19 -0
- package/dist/ai-edits/read.js +6 -4
- package/dist/ai-edits/snapshot.d.ts +6 -0
- package/dist/ai-edits/snapshot.js +32 -17
- package/dist/ai-edits/table-cell-mutations.js +3 -2
- package/dist/ai-edits/table-row-column-mutations.js +20 -6
- 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 +29 -12
- package/dist/controller/canonicalComposition.d.ts +1 -1
- package/dist/controller/canonicalComposition.js +77 -19
- package/dist/controller/canonicalInlineProjection.d.ts +35 -10
- package/dist/controller/canonicalInlineProjection.js +192 -28
- package/dist/controller/canonicalInput.d.ts +2 -2
- package/dist/controller/canonicalInput.js +47 -2
- package/dist/controller/canonicalListRendering.d.ts +2 -1
- package/dist/controller/canonicalListRendering.js +1 -1
- package/dist/controller/canonicalLockGuard.d.ts +8 -0
- package/dist/controller/canonicalLockGuard.js +88 -0
- package/dist/controller/canonicalPublicOperations.d.ts +12 -4
- package/dist/controller/canonicalPublicOperations.js +274 -20
- package/dist/controller/canonicalSession.d.ts +87 -7
- package/dist/controller/canonicalSession.js +328 -75
- package/dist/controller/canonicalStoryEditor.d.ts +3 -2
- package/dist/controller/canonicalStoryEditor.js +4 -3
- 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 +1 -0
- package/dist/controller/headerFooterEditorManager.d.ts +2 -2
- package/dist/controller/headerFooterEditorManager.js +5 -5
- package/dist/controller/hiddenEditorApi.d.ts +6 -0
- package/dist/controller/hiddenEditorApi.js +1 -0
- package/dist/controller/hiddenEditorManager.d.ts +10 -3
- package/dist/controller/hiddenEditorManager.js +94 -38
- package/dist/controller/layoutPipeline.d.ts +2 -0
- package/dist/controller/layoutPipeline.js +55 -18
- package/dist/controller/layoutSession.d.ts +1 -0
- package/dist/controller/noteEditorManager.d.ts +2 -2
- package/dist/controller/noteEditorManager.js +5 -5
- package/dist/display-list/build/pageFurniture.js +41 -19
- package/dist/display-list/build/tablePrimitives.d.ts +3 -1
- package/dist/display-list/build/tablePrimitives.js +49 -14
- package/dist/display-list/dom/renderDisplayListToDom.js +4 -4
- package/dist/document-operations.d.ts +8 -0
- 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 +5 -1
- package/dist/docx/canonicalSessionInput.d.ts +5 -1
- package/dist/docx/canonicalSessionInput.js +7 -2
- package/dist/docx/chartPreview.d.ts +4 -1
- package/dist/docx/chartPreview.js +26 -15
- package/dist/docx/commentAnchorIndex.d.ts +21 -5
- package/dist/docx/commentAnchorIndex.js +39 -11
- 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/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 +17 -0
- package/dist/docx/hostCommentThreads.js +49 -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 +227 -96
- package/dist/docx/mainDocumentPart.d.ts +6 -0
- package/dist/docx/mainDocumentPart.js +65 -0
- 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/packageParts.d.ts +1 -1
- package/dist/docx/packageParts.js +10 -4
- package/dist/docx/paragraphParser.js +159 -48
- package/dist/docx/paragraphPropertySource.d.ts +7 -0
- package/dist/docx/paragraphPropertySource.js +22 -1
- 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 +6 -0
- package/dist/docx/previewBudget.d.ts +6 -0
- package/dist/docx/previewBudget.js +7 -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 +110 -25
- package/dist/docx/rezip.d.ts +6 -0
- package/dist/docx/rezip.js +42 -25
- 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 +3 -1
- 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/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/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/shapeAlternateContent.js +19 -0
- package/dist/docx/splitRevisionPieces.d.ts +10 -0
- package/dist/docx/splitRevisionPieces.js +14 -0
- package/dist/docx/storyBlockReplay.js +4 -0
- package/dist/docx/structuralXmlPatch.js +19 -7
- 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/unzip.js +2 -0
- package/dist/docx/verticalMergeProjection.js +1 -1
- 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/pageBreakRunSourceDescendantIndex.d.ts +5 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -0
- package/dist/internal/revisionResolutionInline.js +1 -2
- package/dist/internal/wholeStoryRevisionResolution.js +57 -12
- package/dist/layout-bridge/convert/altChunkPlaceholder.d.ts +10 -0
- package/dist/layout-bridge/convert/altChunkPlaceholder.js +70 -0
- package/dist/layout-bridge/convert/fixedTableColumnWidths.js +2 -1
- package/dist/layout-bridge/convert/flowConversionShared.d.ts +10 -0
- package/dist/layout-bridge/convert/flowConversionShared.js +11 -1
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +4 -1
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +6 -1
- package/dist/layout-bridge/convert/tableConversion.js +25 -10
- package/dist/layout-bridge/convert/toFlowBlocks.js +4 -0
- package/dist/layout-bridge/engine/blockIndex.d.ts +7 -0
- package/dist/layout-bridge/engine/blockIndex.js +12 -0
- package/dist/layout-bridge/engine/clickToPosition.js +5 -1
- package/dist/layout-bridge/engine/hitTest.js +9 -10
- package/dist/layout-bridge/engine/selectionRects.js +6 -6
- 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.js +10 -5
- package/dist/layout-engine/measure/measureParagraph.js +1 -1
- package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
- package/dist/layout-engine/measure/tableCellFloating.js +1 -0
- package/dist/layout-engine/measure/tableVisibleBand.d.ts +16 -0
- package/dist/layout-engine/measure/tableVisibleBand.js +28 -0
- package/dist/layout-engine/tableLayout.js +34 -7
- package/dist/layout-engine/tableRowBreak.d.ts +46 -0
- package/dist/layout-engine/tableRowBreak.js +193 -36
- package/dist/layout-engine/types.d.ts +43 -3
- package/dist/layout-painter/previewSvg.d.ts +8 -0
- package/dist/layout-painter/previewSvg.js +47 -0
- package/dist/layout-painter/renderImage.js +2 -1
- package/dist/layout-painter/renderPage.d.ts +5 -4
- package/dist/layout-painter/renderPage.js +52 -20
- package/dist/layout-painter/renderParagraph.js +3 -2
- package/dist/layout-painter/renderTable.d.ts +5 -2
- package/dist/layout-painter/renderTable.js +39 -22
- 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/pdf/images.d.ts +17 -1
- package/dist/pdf/images.js +22 -4
- package/dist/pdf/writePdf.js +4 -2
- package/dist/prosemirror/anchoredTextBoxes.d.ts +2 -1
- package/dist/prosemirror/attrs/index.js +1 -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 +25 -0
- package/dist/prosemirror/commands/comments.js +122 -18
- package/dist/prosemirror/commands/deleteBesideInlineAnchor.d.ts +9 -0
- package/dist/prosemirror/commands/deleteBesideInlineAnchor.js +36 -0
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/index.d.ts +1 -1
- package/dist/prosemirror/commands/pastePlainText.d.ts +6 -0
- package/dist/prosemirror/commands/pastePlainText.js +13 -3
- package/dist/prosemirror/commands/resolveAllTableChanges.js +30 -2
- 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/commentReferenceIntegrity.d.ts +8 -2
- package/dist/prosemirror/commentReferenceIntegrity.js +22 -8
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +115 -35
- package/dist/prosemirror/conversion/index.d.ts +1 -1
- package/dist/prosemirror/conversion/toProseDoc.d.ts +128 -1
- package/dist/prosemirror/conversion/toProseDoc.js +325 -55
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.d.ts +3 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +8 -9
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +46 -11
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -2
- package/dist/prosemirror/extensions/features/BidiShortcutExtension.js +2 -3
- package/dist/prosemirror/extensions/features/JoinedRunStyleExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ListExtension.js +22 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +5 -4
- package/dist/prosemirror/extensions/marks/CommentExtension.js +6 -3
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +5 -0
- package/dist/prosemirror/extensions/marks/TextColorExtension.js +1 -1
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +8 -4
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.d.ts +4 -0
- package/dist/prosemirror/extensions/nodes/BlockCommentRangeBoundaryExtension.js +49 -0
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +5 -1
- package/dist/prosemirror/extensions/nodes/CommentRangeBoundaryExtension.js +2 -1
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +4 -3
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +12 -3
- package/dist/prosemirror/extensions/nodes/MoveRangeBoundaryExtension.js +2 -1
- package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.js +2 -1
- package/dist/prosemirror/extensions/nodes/RangeAnchorExtension.js +2 -1
- package/dist/prosemirror/extensions/nodes/RenderedPageBreakExtension.js +2 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +119 -38
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +1 -1
- package/dist/prosemirror/extensions/nodes/inlineAnchorDom.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/inlineAnchorDom.js +21 -0
- package/dist/prosemirror/index.d.ts +2 -2
- 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/noteReferenceReview.js +2 -2
- package/dist/prosemirror/plugins/documentNumbering.js +4 -1
- package/dist/prosemirror/plugins/suggestionMode.d.ts +0 -8
- package/dist/prosemirror/plugins/suggestionMode.js +195 -30
- 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/rowGridOmissions.d.ts +11 -0
- package/dist/prosemirror/rowGridOmissions.js +21 -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/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 +6 -0
- package/dist/prosemirror/styles/paragraphStyleCascade.js +2 -2
- package/dist/prosemirror/tableGridMutation.d.ts +19 -2
- package/dist/prosemirror/tableGridMutation.js +118 -15
- package/dist/prosemirror/tablePositionedBookmarks.d.ts +2 -0
- package/dist/prosemirror/tablePositionedBookmarks.js +80 -0
- package/dist/prosemirror/validation.js +2 -1
- package/dist/redline.js +23 -9
- package/dist/server.d.ts +2 -2
- package/dist/style-sets/extract.js +2 -2
- package/dist/types/canonicalCapabilities.d.ts +29 -8
- package/dist/types/canonicalCapabilities.js +13 -9
- package/dist/utils/cssString.d.ts +7 -0
- package/dist/utils/cssString.js +9 -0
- package/dist/utils/fontResolver.js +4 -1
- 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 -2
|
@@ -27,9 +27,18 @@ function applySuggestions(options) {
|
|
|
27
27
|
applied,
|
|
28
28
|
stale
|
|
29
29
|
};
|
|
30
|
-
resolved.sort((a, b) => b.from - a.from);
|
|
30
|
+
resolved.sort((a, b) => b.from - a.from || b.to - a.to);
|
|
31
|
+
const accepted = [];
|
|
32
|
+
for (const entry of resolved) {
|
|
33
|
+
const following = accepted.at(-1);
|
|
34
|
+
if (following !== void 0 && entry.to > following.from) {
|
|
35
|
+
stale.push(entry.suggestion.id);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
accepted.push(entry);
|
|
39
|
+
}
|
|
31
40
|
const tr = view.state.tr;
|
|
32
|
-
if (mode === "direct") for (const { suggestion, from, to } of
|
|
41
|
+
if (mode === "direct") for (const { suggestion, from, to } of accepted) {
|
|
33
42
|
tr.insertText(suggestion.suggestedText, from, to);
|
|
34
43
|
applied.push(suggestion.id);
|
|
35
44
|
}
|
|
@@ -38,11 +47,11 @@ function applySuggestions(options) {
|
|
|
38
47
|
const deletionType = view.state.schema.marks["deletion"];
|
|
39
48
|
if (!insertionType || !deletionType) return {
|
|
40
49
|
applied,
|
|
41
|
-
stale: [...stale, ...
|
|
50
|
+
stale: [...stale, ...accepted.map((r) => r.suggestion.id)]
|
|
42
51
|
};
|
|
43
52
|
const date = (/* @__PURE__ */ new Date()).toISOString();
|
|
44
53
|
seedRevisionIdsFromDoc(view.state.doc);
|
|
45
|
-
for (const { suggestion, from, to } of
|
|
54
|
+
for (const { suggestion, from, to } of accepted) {
|
|
46
55
|
const attrs = {
|
|
47
56
|
revisionId: mintRevisionId(),
|
|
48
57
|
author,
|
package/dist/compare/compare.js
CHANGED
|
@@ -497,7 +497,8 @@ const COMPARE_SKIP_DISPOSITION = {
|
|
|
497
497
|
missingStyle: "fatal",
|
|
498
498
|
missingNumbering: "fatal",
|
|
499
499
|
invalidResult: "fatal",
|
|
500
|
-
pendingDeletion: "unwritable"
|
|
500
|
+
pendingDeletion: "unwritable",
|
|
501
|
+
contentControlLock: "fatal"
|
|
501
502
|
};
|
|
502
503
|
const getCompareSkipDisposition = (reason) => COMPARE_SKIP_DISPOSITION[reason];
|
|
503
504
|
/**
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { FolioAIBlock, FolioAIEditSnapshot } from "../ai-edits/types.js";
|
|
2
|
+
import { FolioContentAlignmentWorkSession } from "./content-alignment.js";
|
|
2
3
|
type CreateInsertedResourceProjectionOptions = {
|
|
3
4
|
base: FolioAIEditSnapshot;
|
|
4
5
|
revised: FolioAIEditSnapshot;
|
|
6
|
+
/** The comparison's alignment allowance; the projection's work is charged to it. */
|
|
7
|
+
alignmentSession: FolioContentAlignmentWorkSession;
|
|
5
8
|
};
|
|
6
9
|
/** Select resource nodes with their identities from the full revised snapshot. */
|
|
7
|
-
export declare const createInsertedResourceProjection: ({ base, revised }: CreateInsertedResourceProjectionOptions) => {
|
|
10
|
+
export declare const createInsertedResourceProjection: ({ base, revised, alignmentSession }: CreateInsertedResourceProjectionOptions) => {
|
|
8
11
|
snapshot: FolioAIEditSnapshot;
|
|
9
12
|
revisedBlockIds: string[];
|
|
10
13
|
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { createFolioAIEditSnapshotWithStyleResolver, sourceDocumentOf, styleResolverOf } from "../ai-edits/snapshot.js";
|
|
2
|
-
import {
|
|
2
|
+
import { alignFolioBlocksInSession } from "../version-comparison.js";
|
|
3
3
|
import { panic } from "better-result";
|
|
4
4
|
import { Fragment } from "prosemirror-model";
|
|
5
5
|
// src/compare/inserted-resource-snapshot.ts
|
|
6
6
|
/** Select resource nodes with their identities from the full revised snapshot. */
|
|
7
|
-
const createInsertedResourceProjection = ({ base, revised }) => {
|
|
7
|
+
const createInsertedResourceProjection = ({ base, revised, alignmentSession }) => {
|
|
8
8
|
const document = sourceDocumentOf(revised);
|
|
9
|
-
const insertions =
|
|
9
|
+
const insertions = alignFolioBlocksInSession({
|
|
10
|
+
baseBlocks: base.blocks,
|
|
11
|
+
revisedBlocks: revised.blocks,
|
|
12
|
+
workSession: alignmentSession
|
|
13
|
+
}).flatMap((event) => {
|
|
10
14
|
if (event.type === "pair" || event.type === "baseOnly") return [];
|
|
11
15
|
const anchor = revised.anchors[event.block.id] ?? panic("An inserted block lost its source anchor");
|
|
12
16
|
const node = document.nodeAt(anchor.from) ?? panic("An inserted block lost its source paragraph");
|
|
@@ -19,7 +19,7 @@ import { CellSelection } from "prosemirror-tables";
|
|
|
19
19
|
import { packageResourcesOpOf } from "@stll/docx-core/ops";
|
|
20
20
|
// src/controller/canonicalClipboard.ts
|
|
21
21
|
const refuse = (message) => Result.err(new CanonicalSessionError({
|
|
22
|
-
gap: CANONICAL_GAP.dispatch,
|
|
22
|
+
ground: { gap: CANONICAL_GAP.dispatch },
|
|
23
23
|
message,
|
|
24
24
|
reason: "refused"
|
|
25
25
|
}));
|
|
@@ -188,7 +188,7 @@ const canonicalClipboardStoryPartRefusal = (paragraph) => {
|
|
|
188
188
|
});
|
|
189
189
|
if (!requiresStory) return void 0;
|
|
190
190
|
return new CanonicalSessionError({
|
|
191
|
-
gap: CANONICAL_GAP.dispatch,
|
|
191
|
+
ground: { gap: CANONICAL_GAP.dispatch },
|
|
192
192
|
reason: "refused",
|
|
193
193
|
message: "Clipboard comments and note references require importing their source story parts."
|
|
194
194
|
});
|
|
@@ -196,7 +196,7 @@ const canonicalClipboardStoryPartRefusal = (paragraph) => {
|
|
|
196
196
|
const prepareCanonicalPaste = ({ session, state, slice, plain = false, moveTarget, pasteTarget, sourceDocument, moveSource }) => {
|
|
197
197
|
if (session.isComposing) return refuse("Composition must finish before using the clipboard.");
|
|
198
198
|
if (slice.content.size === 0) return Result.err(new CanonicalSessionError({
|
|
199
|
-
gap: CANONICAL_GAP.dispatch,
|
|
199
|
+
ground: { gap: CANONICAL_GAP.dispatch },
|
|
200
200
|
message: "The clipboard contains no content.",
|
|
201
201
|
reason: "noChange"
|
|
202
202
|
}));
|
|
@@ -214,7 +214,7 @@ const prepareCanonicalPaste = ({ session, state, slice, plain = false, moveTarge
|
|
|
214
214
|
const converted = Result.try({
|
|
215
215
|
try: () => proseDocToBlocks(state.schema.topNodeType.create(null, importedSlice.content), []),
|
|
216
216
|
catch: (cause) => new CanonicalSessionError({
|
|
217
|
-
gap: CANONICAL_GAP.dispatch,
|
|
217
|
+
ground: { gap: CANONICAL_GAP.dispatch },
|
|
218
218
|
reason: "refused",
|
|
219
219
|
message: `Clipboard normalization failed: ${cause instanceof Error ? cause.message : String(cause)}`
|
|
220
220
|
})
|
|
@@ -231,11 +231,15 @@ const prepareCanonicalPaste = ({ session, state, slice, plain = false, moveTarge
|
|
|
231
231
|
paragraphs.push(paragraph);
|
|
232
232
|
}
|
|
233
233
|
if (moveTarget === void 0 && (plain || sourceDocument === void 0)) flattenClipboardStyleReferences(paragraphs);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const
|
|
234
|
+
const overCells = state.selection instanceof CellSelection && pasteTarget === void 0 && moveSource === void 0 && moveTarget === void 0;
|
|
235
|
+
if (state.selection instanceof CellSelection && !overCells) return refuse("Pasting over selected cells requires a per-cell paste operation.");
|
|
236
|
+
const selectionRange = overCells ? {
|
|
237
|
+
from: state.selection.from,
|
|
238
|
+
to: state.selection.to
|
|
239
|
+
} : canonicalSelectionRange(state);
|
|
240
|
+
const from = overCells ? Result.ok(void 0) : session.projection.addressAt(pasteTarget ?? moveSource?.from ?? selectionRange.from);
|
|
237
241
|
if (from.isErr()) return from;
|
|
238
|
-
const to = session.projection.addressAt(pasteTarget ?? moveSource?.to ?? selectionRange.to);
|
|
242
|
+
const to = overCells ? Result.ok(void 0) : session.projection.addressAt(pasteTarget ?? moveSource?.to ?? selectionRange.to);
|
|
239
243
|
if (to.isErr()) return to;
|
|
240
244
|
let styles = session.document.package.styles;
|
|
241
245
|
let styleIds;
|
|
@@ -304,7 +308,7 @@ const prepareCanonicalPaste = ({ session, state, slice, plain = false, moveTarge
|
|
|
304
308
|
const parsed = Result.try({
|
|
305
309
|
try: () => parseXml(xml, OOXML_NAMESPACE_SCOPE),
|
|
306
310
|
catch: () => new CanonicalSessionError({
|
|
307
|
-
gap: CANONICAL_GAP.dispatch,
|
|
311
|
+
ground: { gap: CANONICAL_GAP.dispatch },
|
|
308
312
|
reason: "refused",
|
|
309
313
|
message: "The clipboard hyperlink metadata is malformed."
|
|
310
314
|
})
|
|
@@ -412,7 +416,7 @@ const prepareCanonicalPaste = ({ session, state, slice, plain = false, moveTarge
|
|
|
412
416
|
const decoded = Result.try({
|
|
413
417
|
try: () => base64ToBytes(payload),
|
|
414
418
|
catch: () => new CanonicalSessionError({
|
|
415
|
-
gap: CANONICAL_GAP.dispatch,
|
|
419
|
+
ground: { gap: CANONICAL_GAP.dispatch },
|
|
416
420
|
message: "The clipboard image data is malformed.",
|
|
417
421
|
reason: "refused"
|
|
418
422
|
})
|
|
@@ -466,12 +470,25 @@ const prepareCanonicalPaste = ({ session, state, slice, plain = false, moveTarge
|
|
|
466
470
|
after: imported
|
|
467
471
|
}));
|
|
468
472
|
}
|
|
473
|
+
const openStart = importedSlice.openStart === 0 ? 0 : 1;
|
|
474
|
+
const openEnd = importedSlice.openEnd === 0 ? 0 : 1;
|
|
475
|
+
if (from.value === void 0 || to.value === void 0) return session.prepareCellSelectionStructure(state, (at) => ({
|
|
476
|
+
type: "replaceFragment",
|
|
477
|
+
from: at,
|
|
478
|
+
to: at,
|
|
479
|
+
paragraphs,
|
|
480
|
+
openStart,
|
|
481
|
+
openEnd
|
|
482
|
+
}), {
|
|
483
|
+
resourceOps,
|
|
484
|
+
semantic: "paste"
|
|
485
|
+
});
|
|
469
486
|
const fragment = {
|
|
470
487
|
from: from.value,
|
|
471
488
|
to: to.value,
|
|
472
489
|
paragraphs,
|
|
473
|
-
openStart
|
|
474
|
-
openEnd
|
|
490
|
+
openStart,
|
|
491
|
+
openEnd
|
|
475
492
|
};
|
|
476
493
|
if (moveTarget === void 0) return session.prepareIntents(state, {
|
|
477
494
|
intents: [{
|
|
@@ -54,7 +54,7 @@ export declare const createCanonicalComposition: (options: CompositionOptions) =
|
|
|
54
54
|
forgetCompleted: () => void;
|
|
55
55
|
readonly pendingFinal: boolean;
|
|
56
56
|
authorizeLateFinal: (view: EditorView, text: string | null) => boolean;
|
|
57
|
-
authorizeNative: (view: EditorView, completion: CompositionCompletionEvidence) => void;
|
|
57
|
+
authorizeNative: (view: EditorView, completion: CompositionCompletionEvidence, finalText?: string | null) => void;
|
|
58
58
|
flushed: (view: EditorView) => void;
|
|
59
59
|
recover: (view: EditorView) => CompositionFinish;
|
|
60
60
|
cancel: (view: EditorView) => CompositionFinish;
|
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import { splitsSurrogatePair } from "../ai-edits/character-boundaries.js";
|
|
2
|
-
import { RUN_IDENTITY_MARK_NAME } from "../prosemirror/runIdentity.js";
|
|
3
2
|
import { CANONICAL_GAP } from "../types/canonicalCapabilities.js";
|
|
4
3
|
import { setCanonicalInputTimer } from "./canonicalInputTimer.js";
|
|
5
4
|
import { CanonicalSessionError } from "./canonicalSession.js";
|
|
6
5
|
import { Result } from "better-result";
|
|
7
6
|
import { EditorState, TextSelection } from "prosemirror-state";
|
|
8
7
|
// src/controller/canonicalComposition.ts
|
|
8
|
+
const REVIEW_MARK_NAMES = /* @__PURE__ */ new Set(["insertion", "deletion"]);
|
|
9
|
+
/**
|
|
10
|
+
* Whether a native proposal is one plain replacement. The commit is a text
|
|
11
|
+
* replacement over the captured model, so this only has to tell DOM noise from a
|
|
12
|
+
* real change. Reading the DOM back can lose a mark with no parse rule or, through
|
|
13
|
+
* `insertText`, a non-inclusive one. It rebuilds a review mark from fewer attributes,
|
|
14
|
+
* and composed text sits in the DOM wrapper of the tracked run beside it. Gaining
|
|
15
|
+
* any other mark, losing an inclusive one, or another revision is a real change.
|
|
16
|
+
* So is a selected paragraph boundary that does not disappear exactly.
|
|
17
|
+
*/
|
|
9
18
|
const matchesNativeReplacement = ({ baseline, proposed, from, to, text }) => {
|
|
10
19
|
const expected = baseline.tr.insertText(text, from, to);
|
|
11
20
|
if (expected.doc.eq(proposed.doc)) return true;
|
|
12
|
-
|
|
21
|
+
const $from = baseline.doc.resolve(from);
|
|
22
|
+
const $to = baseline.doc.resolve(to);
|
|
13
23
|
if (expected.doc.content.size !== proposed.doc.content.size) return false;
|
|
14
|
-
const markType = baseline.schema.marks[RUN_IDENTITY_MARK_NAME];
|
|
15
|
-
if (markType === void 0) return false;
|
|
16
24
|
const position = expected.doc.resolve(from);
|
|
17
25
|
const paragraph = position.parent;
|
|
18
26
|
const start = position.start();
|
|
19
27
|
const native = proposed.doc.nodeAt(start - 1);
|
|
20
28
|
if (native === null || native.type !== paragraph.type) return false;
|
|
29
|
+
if (!$from.sameParent($to) && native.sameMarkup($to.parent)) expected.setNodeMarkup(start - 1, void 0, native.attrs, native.marks);
|
|
30
|
+
const composedFrom = from;
|
|
31
|
+
const composedTo = from + text.length;
|
|
32
|
+
const types = Object.values(baseline.schema.marks);
|
|
33
|
+
const beside = [$from.nodeBefore, $to.nodeAfter];
|
|
34
|
+
const corrections = [];
|
|
21
35
|
let index = 0;
|
|
22
36
|
let offset = 0;
|
|
23
|
-
const missing = [];
|
|
24
37
|
native.forEach((node, nodeOffset) => {
|
|
25
38
|
const end = nodeOffset + node.nodeSize;
|
|
26
39
|
let cursor = nodeOffset;
|
|
@@ -28,14 +41,21 @@ const matchesNativeReplacement = ({ baseline, proposed, from, to, text }) => {
|
|
|
28
41
|
const authored = paragraph.child(index);
|
|
29
42
|
const authoredEnd = offset + authored.nodeSize;
|
|
30
43
|
const overlapEnd = Math.min(end, authoredEnd);
|
|
31
|
-
if (node.isText && authored.isText
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
if (node.isText && authored.isText) {
|
|
45
|
+
const rangeFrom = start + cursor;
|
|
46
|
+
const rangeTo = start + overlapEnd;
|
|
47
|
+
for (const type of types) {
|
|
48
|
+
const held = type.isInSet(authored.marks);
|
|
49
|
+
const read = type.isInSet(node.marks);
|
|
50
|
+
if (held && !read) {
|
|
51
|
+
if (type.spec.inclusive === false || (type.spec.parseDOM ?? []).length === 0) corrections.push(() => expected.removeMark(rangeFrom, rangeTo, type));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (!read || !REVIEW_MARK_NAMES.has(type.name)) continue;
|
|
55
|
+
const sameRevision = held?.attrs["revisionId"] === read.attrs["revisionId"];
|
|
56
|
+
const inWrapperBeside = rangeFrom >= composedFrom && rangeTo <= composedTo && beside.some((neighbour) => type.isInSet(neighbour?.marks ?? []));
|
|
57
|
+
if (held ? sameRevision : inWrapperBeside) corrections.push(() => expected.addMark(rangeFrom, rangeTo, read));
|
|
58
|
+
}
|
|
39
59
|
}
|
|
40
60
|
cursor = overlapEnd;
|
|
41
61
|
if (cursor === authoredEnd) {
|
|
@@ -44,7 +64,7 @@ const matchesNativeReplacement = ({ baseline, proposed, from, to, text }) => {
|
|
|
44
64
|
}
|
|
45
65
|
}
|
|
46
66
|
});
|
|
47
|
-
for (const
|
|
67
|
+
for (const correction of corrections) correction();
|
|
48
68
|
return expected.doc.eq(proposed.doc);
|
|
49
69
|
};
|
|
50
70
|
/** Native IME owns the provisional view; the captured canonical projection stays unchanged. */
|
|
@@ -53,6 +73,10 @@ const createCanonicalComposition = (options) => {
|
|
|
53
73
|
let authorizedNativeState = null;
|
|
54
74
|
let completed = { type: "idle" };
|
|
55
75
|
let timer;
|
|
76
|
+
/** The browser began again mid-composition; its proposals no longer say where. */
|
|
77
|
+
let restarted = false;
|
|
78
|
+
let acceptedUpdate = false;
|
|
79
|
+
let explicitFinal = null;
|
|
56
80
|
const clearTimer = () => {
|
|
57
81
|
if (timer !== void 0) clearTimeout(timer);
|
|
58
82
|
timer = void 0;
|
|
@@ -149,10 +173,31 @@ const createCanonicalComposition = (options) => {
|
|
|
149
173
|
semantic: "composition"
|
|
150
174
|
};
|
|
151
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* The browser can lose its composition range when the projection redraws a
|
|
178
|
+
* neighbouring node, and then starts again from a position it computes itself.
|
|
179
|
+
* Its final text still names what was composed, and the captured selection says
|
|
180
|
+
* where. A proposal that reaches the caret and holds that text is such a restart
|
|
181
|
+
* even when the restart event went unseen.
|
|
182
|
+
*/
|
|
183
|
+
const finalInput = (pending, native) => {
|
|
184
|
+
const { phase, baseline } = pending;
|
|
185
|
+
const final = explicitFinal ?? (phase.type === "ended" ? phase.data : null);
|
|
186
|
+
if (!final || native.text === final) return native;
|
|
187
|
+
const { from, to, empty } = baseline.selection;
|
|
188
|
+
const atCaret = empty && native.from <= from && native.to >= from && native.text.includes(final);
|
|
189
|
+
if (!restarted && !atCaret) return native;
|
|
190
|
+
return {
|
|
191
|
+
from,
|
|
192
|
+
to,
|
|
193
|
+
text: final,
|
|
194
|
+
semantic: "composition"
|
|
195
|
+
};
|
|
196
|
+
};
|
|
152
197
|
const applyNative = (view, transaction) => Result.try({
|
|
153
198
|
try: () => view.state.applyTransaction(transaction),
|
|
154
199
|
catch: (cause) => new CanonicalSessionError({
|
|
155
|
-
gap: CANONICAL_GAP.dispatch,
|
|
200
|
+
ground: { gap: CANONICAL_GAP.dispatch },
|
|
156
201
|
reason: "refused",
|
|
157
202
|
message: `Composition projection failed: ${String(cause)}`
|
|
158
203
|
})
|
|
@@ -162,8 +207,9 @@ const createCanonicalComposition = (options) => {
|
|
|
162
207
|
authorizedNativeState = null;
|
|
163
208
|
const pending = state;
|
|
164
209
|
if (pending.type === "committed") return { type: "idle" };
|
|
165
|
-
const
|
|
166
|
-
const
|
|
210
|
+
const native = commit && pending.type === "provisional" ? replacement(pending.baseline, view.state) : null;
|
|
211
|
+
const input = native && pending.type === "provisional" ? finalInput(pending, native) : native;
|
|
212
|
+
const committedText = input && input !== native ? input.text : selectedText(pending.baseline, view.state);
|
|
167
213
|
const proposed = view.state;
|
|
168
214
|
const from = pending.baseline.selection.from;
|
|
169
215
|
completed = { type: "idle" };
|
|
@@ -173,7 +219,7 @@ const createCanonicalComposition = (options) => {
|
|
|
173
219
|
view.updateState(pending.baseline);
|
|
174
220
|
}
|
|
175
221
|
options.end();
|
|
176
|
-
if (!commit || view.isDestroyed || pending.phase.type === "ended" && pending.phase.data === "" && pending.phase.completion === "provisional"
|
|
222
|
+
if (!commit || view.isDestroyed || pending.phase.type === "ended" && pending.phase.data === "" && pending.phase.completion === "provisional") return { type: "cancelled" };
|
|
177
223
|
if (pending.type === "refused") return {
|
|
178
224
|
type: "refused",
|
|
179
225
|
text: pending.text
|
|
@@ -215,6 +261,7 @@ const createCanonicalComposition = (options) => {
|
|
|
215
261
|
},
|
|
216
262
|
matchesCancellationRange: (view, range) => {
|
|
217
263
|
if (state.type === "committed" || state.view !== view) return false;
|
|
264
|
+
if (state.type === "refused") return true;
|
|
218
265
|
const text = selectedText(state.baseline, view.state);
|
|
219
266
|
if (text === null || text.length === 0) return false;
|
|
220
267
|
const from = state.baseline.selection.from;
|
|
@@ -226,8 +273,13 @@ const createCanonicalComposition = (options) => {
|
|
|
226
273
|
return view.posAtDOM(selected.startContainer, selected.startOffset) === range.from && view.posAtDOM(selected.endContainer, selected.endOffset) === range.to;
|
|
227
274
|
},
|
|
228
275
|
start: (view) => {
|
|
276
|
+
if (state.type === "provisional" && state.phase.type === "active" && acceptedUpdate) restarted = true;
|
|
229
277
|
if (state.type !== "committed") return;
|
|
230
278
|
if (!options.begin()) return;
|
|
279
|
+
restarted = false;
|
|
280
|
+
acceptedUpdate = false;
|
|
281
|
+
explicitFinal = null;
|
|
282
|
+
if (!view.state.selection.empty) authorizedNativeState = view.state;
|
|
231
283
|
state = {
|
|
232
284
|
type: "provisional",
|
|
233
285
|
baseline: view.state,
|
|
@@ -287,7 +339,8 @@ const createCanonicalComposition = (options) => {
|
|
|
287
339
|
};
|
|
288
340
|
return true;
|
|
289
341
|
},
|
|
290
|
-
authorizeNative: (view, completion) => {
|
|
342
|
+
authorizeNative: (view, completion, finalText) => {
|
|
343
|
+
if (completion === "explicitFinal" && typeof finalText === "string") explicitFinal = finalText;
|
|
291
344
|
authorizedNativeState = view.state;
|
|
292
345
|
if (state.type !== "committed" && completion === "explicitFinal") state.phase = state.phase.type === "active" ? {
|
|
293
346
|
type: "active",
|
|
@@ -359,6 +412,10 @@ const createCanonicalComposition = (options) => {
|
|
|
359
412
|
view.updateState(state.baseline);
|
|
360
413
|
return true;
|
|
361
414
|
}
|
|
415
|
+
if (restarted) {
|
|
416
|
+
view.updateState(state.baseline);
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
362
419
|
if (typeof transaction.getMeta("composition") !== "number" && authorizedNativeState !== view.state) {
|
|
363
420
|
options.refuse("Other edits must wait until composition finishes.");
|
|
364
421
|
return true;
|
|
@@ -389,6 +446,7 @@ const createCanonicalComposition = (options) => {
|
|
|
389
446
|
options.refuse("Composition changed unsupported content; the canonical document was restored.");
|
|
390
447
|
return true;
|
|
391
448
|
}
|
|
449
|
+
acceptedUpdate = true;
|
|
392
450
|
view.updateState(applied.value.state);
|
|
393
451
|
return true;
|
|
394
452
|
}
|
|
@@ -9,7 +9,7 @@ export declare const CANONICAL_SOURCE_INLINE_POLICIES: {
|
|
|
9
9
|
readonly moveFrom: "container";
|
|
10
10
|
readonly moveTo: "container";
|
|
11
11
|
readonly inlineWrapper: "container";
|
|
12
|
-
readonly inlineSdt: "
|
|
12
|
+
readonly inlineSdt: "container";
|
|
13
13
|
readonly simpleField: "leaf";
|
|
14
14
|
readonly complexField: "leaf";
|
|
15
15
|
readonly mathEquation: "leaf";
|
|
@@ -34,7 +34,7 @@ export declare const CANONICAL_SOURCE_INLINE_POLICIES: {
|
|
|
34
34
|
readonly instrText: "rawField";
|
|
35
35
|
readonly softHyphen: "leaf";
|
|
36
36
|
readonly noBreakHyphen: "leaf";
|
|
37
|
-
readonly renderedPageBreak: "
|
|
37
|
+
readonly renderedPageBreak: "leaf";
|
|
38
38
|
readonly preservedXml: "leaf";
|
|
39
39
|
readonly drawing: "leaf";
|
|
40
40
|
readonly shape: "leaf";
|
|
@@ -58,8 +58,8 @@ export declare const CANONICAL_NATIVE_INLINE_POLICIES: {
|
|
|
58
58
|
readonly tab: "unit";
|
|
59
59
|
readonly textBoxAnchor: "unit";
|
|
60
60
|
readonly commentReference: "unit";
|
|
61
|
-
readonly renderedPageBreak: "
|
|
62
|
-
readonly sdt: "
|
|
61
|
+
readonly renderedPageBreak: "markers";
|
|
62
|
+
readonly sdt: "control";
|
|
63
63
|
};
|
|
64
64
|
declare const InlineProjectionErrorBase: TaggedErrorClass<"InlineProjectionError">;
|
|
65
65
|
declare class InlineProjectionError extends InlineProjectionErrorBase<{
|
|
@@ -98,20 +98,45 @@ export type CanonicalInlineGap = {
|
|
|
98
98
|
position: number;
|
|
99
99
|
zeroWidthBefore: number;
|
|
100
100
|
};
|
|
101
|
+
/** The source ordinals one editor position stands for: from `first` to `last`. */
|
|
102
|
+
export type CanonicalSeamExtent = {
|
|
103
|
+
first: number;
|
|
104
|
+
last: number;
|
|
105
|
+
};
|
|
101
106
|
type InlineProjection = {
|
|
102
107
|
text: string;
|
|
103
108
|
boundaries: CanonicalInlineGap[][];
|
|
109
|
+
/** Parallel to `boundaries`: each gap's whole seam. */
|
|
110
|
+
seams: CanonicalSeamExtent[][];
|
|
111
|
+
};
|
|
112
|
+
/** Whether a story holds an id: all a paragraph's projection asks of a story id set. */
|
|
113
|
+
export type StoryIdMembership = Pick<ReadonlySet<number>, "has">;
|
|
114
|
+
/** The story's comments as one paragraph's projection reads them. */
|
|
115
|
+
export type CanonicalInlineCommentContext = {
|
|
116
|
+
rangedIds: StoryIdMembership;
|
|
117
|
+
pointIds: StoryIdMembership;
|
|
118
|
+
/** The comment ranges open where the paragraph starts. */
|
|
119
|
+
openIds: ReadonlySet<number>;
|
|
104
120
|
};
|
|
105
121
|
type CanonicalInlineProjectionArgs = {
|
|
106
122
|
source: document_d_exports.Paragraph;
|
|
107
123
|
paragraph: Node;
|
|
108
|
-
pairedBookmarkIds:
|
|
109
|
-
commentContext?:
|
|
110
|
-
rangedIds: ReadonlySet<number>;
|
|
111
|
-
pointIds: ReadonlySet<number>;
|
|
112
|
-
openIds: ReadonlySet<number>;
|
|
113
|
-
};
|
|
124
|
+
pairedBookmarkIds: StoryIdMembership;
|
|
125
|
+
commentContext?: CanonicalInlineCommentContext;
|
|
114
126
|
};
|
|
115
127
|
/** Bind rendered gaps to the operation owner's source leaf ordinals, including collapsed pairs. */
|
|
116
128
|
export declare const projectCanonicalInline: ({ source, paragraph, pairedBookmarkIds, commentContext }: CanonicalInlineProjectionArgs) => Result<InlineProjection, InlineProjectionError>;
|
|
129
|
+
/**
|
|
130
|
+
* Paragraph projections kept across projections of a story.
|
|
131
|
+
*
|
|
132
|
+
* A paragraph an edit left keeps its source records, and the block cache
|
|
133
|
+
* keeps its editor node, so its gaps can be reused where the story facts its
|
|
134
|
+
* projection read are the same: the comments open at its start and the
|
|
135
|
+
* comment and bookmark ids it asked about. Gap positions are relative to the
|
|
136
|
+
* paragraph, so a reused projection holds wherever the paragraph now starts.
|
|
137
|
+
*/
|
|
138
|
+
export declare class InlineProjectionCache {
|
|
139
|
+
private paragraphs;
|
|
140
|
+
project(args: CanonicalInlineProjectionArgs): Result<InlineProjection, InlineProjectionError>;
|
|
141
|
+
}
|
|
117
142
|
export {};
|