@stll/folio-core 0.71.1 → 0.73.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/README.md +14 -8
- package/dist/ai-edits/apply.d.ts +6 -114
- package/dist/ai-edits/apply.js +9 -131
- package/dist/ai-edits/applyTypes.d.ts +85 -0
- package/dist/ai-edits/applyTypes.js +24 -0
- package/dist/ai-edits/clean-text.d.ts +7 -1
- package/dist/ai-edits/clean-text.js +23 -2
- package/dist/ai-edits/finalSectionReview.d.ts +1 -1
- package/dist/ai-edits/headless.d.ts +29 -147
- package/dist/ai-edits/headless.js +213 -1634
- package/dist/ai-edits/index.d.ts +3 -3
- package/dist/ai-edits/index.js +2 -3
- package/dist/ai-edits/pending-suggestions.d.ts +14 -4
- package/dist/ai-edits/pending-suggestions.js +183 -90
- package/dist/ai-edits/result-validation.js +1 -1
- package/dist/ai-edits/retired-comment-receipts.d.ts +1 -1
- package/dist/ai-edits/snapshot.js +8 -3
- package/dist/ai-edits/table-cell-mutations.d.ts +1 -1
- package/dist/ai-edits/table-cell-mutations.js +1 -1
- package/dist/ai-edits/table-geometry.d.ts +1 -1
- package/dist/ai-edits/table-geometry.js +1 -1
- package/dist/ai-edits/table-row-column-mutations.d.ts +1 -1
- package/dist/ai-edits/table-row-column-mutations.js +1 -1
- package/dist/ai-edits/tableNodes.d.ts +38 -0
- package/dist/ai-edits/tableNodes.js +86 -0
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +1 -1
- package/dist/ai-edits/undefinedReferences.d.ts +7 -0
- package/dist/canonical/batchCommentReferences.js +1 -0
- package/dist/canonical/canonicalInlineProjection.js +1 -1
- package/dist/canonical/canonicalPublicOperations.js +228 -64
- package/dist/canonical/canonicalSession.d.ts +9 -1
- package/dist/canonical/canonicalSession.js +95 -15
- package/dist/compare/compare.d.ts +1 -1
- package/dist/compare/inline-atoms-model.d.ts +1 -1
- package/dist/compare/inline-atoms.d.ts +2 -2
- package/dist/compare/inline-provenance-model.d.ts +1 -1
- package/dist/compare/inline-provenance.d.ts +2 -2
- package/dist/compat/eigenpal.d.ts +3 -4
- package/dist/compat/eigenpal.js +2 -4
- package/dist/controller/canonicalClipboard.d.ts +13 -3
- package/dist/controller/canonicalClipboard.js +185 -49
- package/dist/controller/canonicalClipboardResources.d.ts +9 -1
- package/dist/controller/canonicalClipboardResources.js +22 -2
- package/dist/controller/canonicalReview.d.ts +1 -1
- package/dist/controller/canonicalReview.js +1 -1
- package/dist/controller/canonicalStructure.js +1 -1
- package/dist/controller/canonicalWatermark.d.ts +10 -0
- package/dist/controller/canonicalWatermark.js +37 -0
- package/dist/controller/canonicalYjsRoom.d.ts +1 -1
- package/dist/controller/headerFooterEditorManager.d.ts +11 -7
- package/dist/controller/headerFooterEditorManager.js +39 -151
- package/dist/controller/hiddenEditorApi.d.ts +1 -1
- package/dist/controller/hiddenEditorManager.d.ts +6 -40
- package/dist/controller/hiddenEditorManager.js +173 -306
- package/dist/controller/noteEditorManager.d.ts +3 -10
- package/dist/controller/noteEditorManager.js +33 -206
- package/dist/document-operations-apply.d.ts +15 -0
- package/dist/document-operations-apply.js +280 -0
- package/dist/document-operations.d.ts +1 -14
- package/dist/document-operations.js +2 -279
- package/dist/docx/modelValidation.js +1 -1
- package/dist/docx/paragraphParser.js +2 -2
- package/dist/docx/paragraphPropertySource.d.ts +1 -1
- package/dist/docx/reviewResolutionProvenance.d.ts +3 -2
- package/dist/docx/reviewResolutionProvenance.js +32 -9
- package/dist/docx/revisionIdNormalization.js +30 -7
- package/dist/docx/rezip.js +1 -1
- package/dist/docx/serializer/borderSerializer.js +1 -1
- package/dist/docx/serializer/commentSerializer.js +1 -1
- package/dist/docx/serializer/documentSerializer.js +1 -1
- package/dist/docx/serializer/paragraphSerializer.js +3 -3
- package/dist/docx/serializer/runSerializer.js +1 -1
- package/dist/docx/serializer/sectionPropertiesSerializer.js +1 -1
- package/dist/docx/serializer/tableSerializer.js +5 -37
- package/dist/docx/serializer/textFormattingSerializer.js +1 -1
- package/dist/docx/serializer/trackedChangeAttributes.js +1 -1
- package/dist/docx/server/templatePlan/apply.d.ts +15 -0
- package/dist/docx/server/templatePlan/apply.js +600 -0
- package/dist/docx/server/templatePlan/blocks.d.ts +97 -0
- package/dist/docx/server/templatePlan/blocks.js +355 -0
- package/dist/docx/server/templatePlan/builders.d.ts +72 -0
- package/dist/docx/server/templatePlan/builders.js +237 -0
- package/dist/docx/server/templatePlan/emit.d.ts +118 -0
- package/dist/docx/server/templatePlan/emit.js +466 -0
- package/dist/docx/server/templatePlan/emphasis.d.ts +62 -0
- package/dist/docx/server/templatePlan/emphasis.js +173 -0
- package/dist/docx/server/templatePlan/inspect.d.ts +22 -0
- package/dist/docx/server/templatePlan/inspect.js +177 -0
- package/dist/docx/server/templatePlan/labels.d.ts +36 -0
- package/dist/docx/server/templatePlan/labels.js +126 -0
- package/dist/docx/server/templatePlan/package.d.ts +34 -0
- package/dist/docx/server/templatePlan/package.js +99 -0
- package/dist/docx/server/templatePlan/plan.d.ts +143 -0
- package/dist/docx/server/templatePlan/plan.js +841 -0
- package/dist/docx/server/templatePlan/planShape.d.ts +9 -0
- package/dist/docx/server/templatePlan/planShape.js +161 -0
- package/dist/docx/server/templatePlan/resources.d.ts +41 -0
- package/dist/docx/server/templatePlan/resources.js +136 -0
- package/dist/docx/server/templatePlan/story.d.ts +128 -0
- package/dist/docx/server/templatePlan/story.js +440 -0
- package/dist/docx/server/templatePlan/types.d.ts +406 -0
- package/dist/docx/server/templatePlan/types.js +28 -0
- package/dist/docx/server/templatePlan/verify.d.ts +40 -0
- package/dist/docx/server/templatePlan/verify.js +968 -0
- package/dist/docx/server/templatePlan/xml.d.ts +69 -0
- package/dist/docx/server/templatePlan/xml.js +119 -0
- package/dist/docx/settingsHeaderFooterUpdate.d.ts +9 -0
- package/dist/docx/settingsHeaderFooterUpdate.js +45 -10
- package/dist/docx/storyBlockReplay.js +1 -1
- package/dist/docx/structuralXmlPatch.js +9 -1
- package/dist/docx/tableGridXml.d.ts +30 -0
- package/dist/docx/tableGridXml.js +54 -0
- package/dist/docx/tableParser.js +7 -0
- package/dist/docx/xmlParser.js +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -4
- package/dist/internal/paragraphFormattingSerialization.js +1 -1
- package/dist/internal/wholeStoryRevisionResolution.js +1 -1
- package/dist/managers/ContextMenuManager.js +2 -1
- package/dist/managers/DocumentLoaderManager.d.ts +0 -4
- package/dist/managers/DocumentLoaderManager.js +4 -12
- package/dist/managers/editorShortcuts.d.ts +1 -1
- package/dist/prosemirror/anchoredTextBoxes.d.ts +1 -1
- package/dist/prosemirror/canonicalCommands.d.ts +1 -1
- package/dist/prosemirror/canonicalSelectionRange.d.ts +1 -1
- package/dist/prosemirror/canonicalTableCommands.js +2 -2
- package/dist/prosemirror/commands/comments.js +3 -3
- package/dist/prosemirror/commands/contentControls.d.ts +1 -1
- package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
- package/dist/prosemirror/commands/sectionBreak.js +1 -1
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -1
- package/dist/prosemirror/commands/tableMergeFoldDecisions.d.ts +1 -1
- package/dist/prosemirror/commentRecords.d.ts +1 -1
- package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +1 -1
- package/dist/prosemirror/documentStructureCounts.d.ts +24 -0
- package/dist/prosemirror/documentStructureCounts.js +76 -0
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
- package/dist/prosemirror/extensions/StarterKit.d.ts +1 -1
- package/dist/prosemirror/extensions/core/HistoryExtension.d.ts +1 -7
- package/dist/prosemirror/extensions/core/HistoryExtension.js +5 -13
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +1 -1
- package/dist/prosemirror/extensions/core/historyCommands.d.ts +16 -0
- package/dist/prosemirror/extensions/core/historyCommands.js +19 -0
- package/dist/prosemirror/extensions/features/AutoBidiDetectionExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +2 -35
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +4 -142
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +3 -87
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +7 -162
- package/dist/prosemirror/extensions/features/pastedCellSections.d.ts +1 -1
- package/dist/prosemirror/extensions/features/pastedHeadingStyles.js +1 -1
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +2 -2
- package/dist/prosemirror/extensions/types.d.ts +1 -1
- package/dist/prosemirror/findReplaceSelection.d.ts +1 -1
- package/dist/prosemirror/hyperlinkRemoval.d.ts +1 -1
- package/dist/prosemirror/index.d.ts +1 -1
- package/dist/prosemirror/index.js +1 -1
- package/dist/prosemirror/insertionGaps.d.ts +1 -1
- package/dist/prosemirror/keptRangeBoundaries.d.ts +1 -1
- package/dist/prosemirror/listNumbering.d.ts +1 -1
- package/dist/prosemirror/lockedControls.d.ts +1 -1
- package/dist/prosemirror/markupViewProjection.d.ts +1 -1
- package/dist/prosemirror/noteReferenceOccurrences.d.ts +1 -1
- package/dist/prosemirror/noteReferenceReview.js +1 -1
- package/dist/prosemirror/numberingAttr.d.ts +1 -2
- package/dist/prosemirror/numberingAttr.js +1 -2
- package/dist/prosemirror/outlineLevelAttr.d.ts +1 -2
- package/dist/prosemirror/outlineLevelAttr.js +1 -2
- package/dist/prosemirror/paraIds.d.ts +46 -0
- package/dist/prosemirror/paraIds.js +152 -0
- package/dist/prosemirror/paragraphChangeTrackerMeta.d.ts +97 -0
- package/dist/prosemirror/paragraphChangeTrackerMeta.js +87 -0
- package/dist/prosemirror/paragraphMarkJoin.d.ts +1 -1
- package/dist/prosemirror/paragraphPropertyCarry.d.ts +1 -1
- package/dist/prosemirror/pastedCommentCopies.d.ts +1 -1
- package/dist/prosemirror/pastedCommentCopies.js +1 -1
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
- package/dist/prosemirror/plugins/documentNumbering.d.ts +1 -1
- package/dist/prosemirror/plugins/suggestionMode.d.ts +1 -1
- package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -1
- package/dist/prosemirror/rebaseParagraphRuns.d.ts +1 -1
- package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.js +16 -1
- package/dist/prosemirror/revisionCarriers.d.ts +1 -1
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
- package/dist/prosemirror/sectionMarkEdits.d.ts +1 -1
- package/dist/prosemirror/selectionBounds.d.ts +10 -0
- package/dist/prosemirror/selectionBounds.js +22 -0
- package/dist/prosemirror/storyListNumbering.d.ts +1 -1
- package/dist/prosemirror/tableCellPaste.d.ts +1 -1
- package/dist/prosemirror/tableGridMutation.d.ts +1 -1
- package/dist/prosemirror/textInput.d.ts +1 -1
- package/dist/server.d.ts +7 -5
- package/dist/server.js +6 -4
- package/dist/types/canonicalCapabilities.d.ts +8 -41
- package/dist/types/canonicalCapabilities.js +6 -34
- package/package.json +4 -6
- package/dist/controller/collaborationModules.d.ts +0 -3
- package/dist/controller/collaborationModules.js +0 -14
- package/dist/docx/server/materializeYjsDocx.d.ts +0 -30
- package/dist/docx/server/materializeYjsDocx.js +0 -96
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +0 -53
- package/dist/docx/server/migrateYjsAttrSchema.js +0 -111
- package/dist/prosemirror/plugins/derivedFields.d.ts +0 -8
- package/dist/prosemirror/plugins/derivedFields.js +0 -52
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +0 -89
- package/dist/prosemirror/yjsDocumentMetadata.js +0 -697
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DocxCompatibility } from "../docx/compatibility.js";
|
|
2
|
-
import { EditorSession } from "../types/canonicalCapabilities.js";
|
|
3
2
|
import { document_d_exports } from "../types/document.js";
|
|
4
3
|
import { ReadonlyDocument } from "../types/documentModel.js";
|
|
5
4
|
import { DocxInput } from "../utils/docxInput.js";
|
|
@@ -24,7 +23,6 @@ export type DocumentLoaderHistory = {
|
|
|
24
23
|
export type DocumentLoaderCallbacks = {
|
|
25
24
|
/** Editor history to reset/seed with the loaded document. */
|
|
26
25
|
history: DocumentLoaderHistory;
|
|
27
|
-
getExperimentalSession?: () => EditorSession | undefined;
|
|
28
26
|
/**
|
|
29
27
|
* Receives the identity of the document that just landed in history. Every
|
|
30
28
|
* load allocates a fresh identity, so the adapter can tell an external load
|
|
@@ -48,8 +46,6 @@ export declare class DocumentLoaderManager {
|
|
|
48
46
|
constructor(callbacks: DocumentLoaderCallbacks);
|
|
49
47
|
/** Re-bind the host callbacks (the adapter refreshes these every render). */
|
|
50
48
|
setCallbacks(callbacks: DocumentLoaderCallbacks): void;
|
|
51
|
-
/** Whether loads open in a canonical session. */
|
|
52
|
-
private opensCanonicalSession;
|
|
53
49
|
/** Reset color/UI state coupled to the previous document. */
|
|
54
50
|
resetForNewDocument(): void;
|
|
55
51
|
/**
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { CANONICAL_DOCX_PARSE_OPTIONS, holdsUniqueSeedIds, openCanonicalDocx, prepareCanonicalDocumentInput } from "../docx/canonicalSessionInput.js";
|
|
2
2
|
import { inspectDocxCompatibility } from "../docx/compatibility.js";
|
|
3
|
-
import { parseDocx } from "../docx/parser.js";
|
|
4
3
|
import { recordDocumentLoadPhase } from "../layout-engine/layoutInstrumentation.js";
|
|
5
4
|
import { heldUnreferencedNotes } from "../prosemirror/noteReferenceReview.js";
|
|
6
|
-
import { CANONICAL_GAP, usesCanonicalSession } from "../types/canonicalCapabilities.js";
|
|
7
5
|
import { resetAuthorColors } from "../utils/authorColors.js";
|
|
8
6
|
import { loadFontsWithMapping } from "../utils/fontLoader.js";
|
|
9
7
|
// src/managers/DocumentLoaderManager.ts
|
|
@@ -29,10 +27,6 @@ var DocumentLoaderManager = class {
|
|
|
29
27
|
setCallbacks(callbacks) {
|
|
30
28
|
this.callbacks = callbacks;
|
|
31
29
|
}
|
|
32
|
-
/** Whether loads open in a canonical session. */
|
|
33
|
-
opensCanonicalSession() {
|
|
34
|
-
return usesCanonicalSession(this.callbacks.getExperimentalSession?.(), CANONICAL_GAP.authorityRouting);
|
|
35
|
-
}
|
|
36
30
|
/** Reset color/UI state coupled to the previous document. */
|
|
37
31
|
resetForNewDocument() {
|
|
38
32
|
resetAuthorColors();
|
|
@@ -48,7 +42,7 @@ var DocumentLoaderManager = class {
|
|
|
48
42
|
*/
|
|
49
43
|
loadParsedDocument(doc) {
|
|
50
44
|
const generation = ++this.loadGeneration;
|
|
51
|
-
if (
|
|
45
|
+
if (holdsUniqueSeedIds(doc)) {
|
|
52
46
|
this.commitParsedDocument(doc, generation);
|
|
53
47
|
return;
|
|
54
48
|
}
|
|
@@ -103,11 +97,9 @@ var DocumentLoaderManager = class {
|
|
|
103
97
|
...CANONICAL_DOCX_PARSE_OPTIONS,
|
|
104
98
|
password: options.password
|
|
105
99
|
};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
doc = opened.value.document;
|
|
110
|
-
} else doc = await parseDocx(buffer, parseOptions);
|
|
100
|
+
const opened = await openCanonicalDocx(buffer, parseOptions);
|
|
101
|
+
if (opened.isErr()) throw opened.error;
|
|
102
|
+
doc = opened.value.document;
|
|
111
103
|
} finally {
|
|
112
104
|
recordDocumentLoadPhase("docx-parse", performance.now() - parseStartedAt);
|
|
113
105
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* whole-table deletion check against ProseMirror state. The adapter keeps only
|
|
11
11
|
* the listener lifecycle and the host-callback dispatch.
|
|
12
12
|
*/
|
|
13
|
-
import { HistoryShortcutOwner } from "../prosemirror/extensions/core/
|
|
13
|
+
import { HistoryShortcutOwner } from "../prosemirror/extensions/core/historyCommands.js";
|
|
14
14
|
import { EditorView } from "prosemirror-view";
|
|
15
15
|
export declare const DEFAULT_KEYBOARD_SHORTCUT_SCOPE = "editor";
|
|
16
16
|
export declare function isMacPlatform(): boolean;
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* Only a box placed `inlineWithPrevious` has an anchor: a `standalone` one
|
|
19
19
|
* stands in for a paragraph that held nothing else.
|
|
20
20
|
*/
|
|
21
|
-
import { Node } from "prosemirror-model";
|
|
22
21
|
import { Transaction } from "prosemirror-state";
|
|
22
|
+
import { Node } from "prosemirror-model";
|
|
23
23
|
import { Transform } from "prosemirror-transform";
|
|
24
24
|
/** The id a text box anchor names, or `undefined` for anything else. */
|
|
25
25
|
export declare const textBoxAnchorIdOf: (node: Node) => string | undefined;
|
|
@@ -2,8 +2,8 @@ import "../content-controls/index.js";
|
|
|
2
2
|
import { SetContentControlValueInput } from "../content-controls/mutateContentControls.js";
|
|
3
3
|
import { document_d_exports } from "../types/document.js";
|
|
4
4
|
import { TableCellFormatting, TableFormatting, TableRowFormatting } from "../types/formatting.js";
|
|
5
|
-
import { Node } from "prosemirror-model";
|
|
6
5
|
import { Command, EditorState } from "prosemirror-state";
|
|
6
|
+
import { Node } from "prosemirror-model";
|
|
7
7
|
import { FormattingPatch, ParagraphPropsPatch, RunPropsPatch, TableBlockIntentOperation, TableIntentOperation, TableRowIntentOperation } from "@stll/docx-core/ops";
|
|
8
8
|
/** One table, row or cell, addressed by a position inside its first paragraph. */
|
|
9
9
|
export type CanonicalTableFormatTarget = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
1
|
import { EditorState } from "prosemirror-state";
|
|
2
|
+
import { Node } from "prosemirror-model";
|
|
3
3
|
import { CellSelection } from "prosemirror-tables";
|
|
4
4
|
/** Document edges denote the first and last editable content gaps. */
|
|
5
5
|
export declare const canonicalContentPosition: (doc: Node, position: number) => number;
|
|
@@ -130,13 +130,13 @@ const gridEdit = (before, after, at) => {
|
|
|
130
130
|
const was = expectTableAttrs(before).columnWidths;
|
|
131
131
|
const is = expectTableAttrs(after).columnWidths;
|
|
132
132
|
if (JSON.stringify(was) === JSON.stringify(is)) return void 0;
|
|
133
|
-
if (at === void 0
|
|
133
|
+
if (at === void 0) return null;
|
|
134
134
|
return {
|
|
135
135
|
type: "editTable",
|
|
136
136
|
at,
|
|
137
137
|
edit: {
|
|
138
138
|
type: DOCUMENT_OP_TYPES.SET_TABLE_GRID,
|
|
139
|
-
columnWidths: [...is]
|
|
139
|
+
columnWidths: [...is ?? []]
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
};
|
|
@@ -10,13 +10,13 @@ import { enclosingRevisionIds, resolutionRemovesControl, withoutResolvedEnclosur
|
|
|
10
10
|
import { copyOriginBoundaryAttrsAfterResolution } from "../copyOriginResolution.js";
|
|
11
11
|
import { resolveEmptyFieldResultRuns } from "../emptyFieldResultRuns.js";
|
|
12
12
|
import { JOINED_RUNS_RESTYLED_META } from "../extensions/features/JoinedRunStyleExtension.js";
|
|
13
|
-
import { requestDeterministicParaIds } from "../extensions/features/ParaIdAllocatorExtension.js";
|
|
14
|
-
import { markChangedParagraphRanges, markStructuralChange, markTrackedSectionEndpointRemoval } from "../extensions/features/ParagraphChangeTrackerExtension.js";
|
|
15
13
|
import "../extensions/nodes/SdtExtension.js";
|
|
16
14
|
import { canonicalFieldNode } from "../fieldRepresentation.js";
|
|
17
15
|
import { isBlockBoundaryNode, normalizeKeptRangeBoundaries, paragraphRemainsOf, removeResolvedSubtree, revisionLayerRemovesContent } from "../keptRangeBoundaries.js";
|
|
18
16
|
import { lockedControlSpans, lockedControlViolationOfTransform } from "../lockedControls.js";
|
|
19
17
|
import { resolveStateStory } from "../markupViewProjection.js";
|
|
18
|
+
import { requestDeterministicParaIds } from "../paraIds.js";
|
|
19
|
+
import { markChangedParagraphRanges, markStructuralChange, markTrackedSectionEndpointRemoval } from "../paragraphChangeTrackerMeta.js";
|
|
20
20
|
import { joinAtParagraphMark } from "../paragraphMarkJoin.js";
|
|
21
21
|
import { carryParagraphProperties, paragraphLeftAfter } from "../paragraphPropertyCarry.js";
|
|
22
22
|
import { getDocumentNumbering } from "../plugins/documentNumbering.js";
|
|
@@ -42,10 +42,10 @@ import { resolveNodePropertyChangeAttrs } from "./resolveNodePropertyChangeAttrs
|
|
|
42
42
|
import { resolveParagraphChangeAttrs } from "./resolveParagraphProperties.js";
|
|
43
43
|
import { hasMatchingCollapsedTableCellMerge, resolveCollapsedTableCellMerge, resolveVisibleTableCellMerge } from "./tableCellMergeResolution.js";
|
|
44
44
|
import { panic } from "better-result";
|
|
45
|
-
import { PARAGRAPH_MARK_CHANGE_KINDS, REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
46
45
|
import { Fragment } from "prosemirror-model";
|
|
47
46
|
import { TableMap } from "prosemirror-tables";
|
|
48
47
|
import { Mapping } from "prosemirror-transform";
|
|
48
|
+
import { PARAGRAPH_MARK_CHANGE_KINDS, REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
49
49
|
import { paragraphMarkOutcome } from "@stll/docx-core/ops";
|
|
50
50
|
import { closeHistory } from "prosemirror-history";
|
|
51
51
|
// src/prosemirror/commands/comments.ts
|
|
@@ -12,8 +12,8 @@ import { ContentControlFilter } from "../../content-controls/findContentControls
|
|
|
12
12
|
import "../../content-controls/index.js";
|
|
13
13
|
import { SetContentControlContentInput, SetContentControlValueInput } from "../../content-controls/mutateContentControls.js";
|
|
14
14
|
import { document_d_exports } from "../../types/document.js";
|
|
15
|
-
import { Node } from "prosemirror-model";
|
|
16
15
|
import { Command, EditorState, Transaction } from "prosemirror-state";
|
|
16
|
+
import { Node } from "prosemirror-model";
|
|
17
17
|
type ForceOption = {
|
|
18
18
|
force?: boolean;
|
|
19
19
|
};
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* logic is here so it can be unit-tested without a DOM.
|
|
10
10
|
*/
|
|
11
11
|
import { document_d_exports } from "../../types/document.js";
|
|
12
|
-
import { Mark } from "prosemirror-model";
|
|
13
12
|
import { Command, EditorState } from "prosemirror-state";
|
|
13
|
+
import { Mark } from "prosemirror-model";
|
|
14
14
|
/**
|
|
15
15
|
* Character-formatting marks the painter copies. Structural marks — comments,
|
|
16
16
|
* hyperlinks, tracked changes (insertion/deletion), footnote references — are
|
|
@@ -10,8 +10,8 @@ import { getHyperlinkAttrs, getSelectedText, isHyperlinkActive } from "../extens
|
|
|
10
10
|
import { clearFormatting, createRemoveMarkCommand, createSetMarkCommand, getMarkAttr, isMarkActive } from "../extensions/marks/markUtils.js";
|
|
11
11
|
import "../schema/index.js";
|
|
12
12
|
import { TextColorAttrs } from "../schema/marks.js";
|
|
13
|
-
import { Mark } from "prosemirror-model";
|
|
14
13
|
import { Command } from "prosemirror-state";
|
|
14
|
+
import { Mark } from "prosemirror-model";
|
|
15
15
|
/**
|
|
16
16
|
* textFormattingToMarks — wraps markUtils version to use singleton schema
|
|
17
17
|
*/
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* paragraph's own style. This is the "paste without formatting" escape hatch,
|
|
7
7
|
* distinct from the default rich paste that preserves source formatting.
|
|
8
8
|
*/
|
|
9
|
-
import { Schema, Slice } from "prosemirror-model";
|
|
10
9
|
import { Command } from "prosemirror-state";
|
|
10
|
+
import { Schema, Slice } from "prosemirror-model";
|
|
11
11
|
import { EditorView } from "prosemirror-view";
|
|
12
12
|
/**
|
|
13
13
|
* Dispatched on the editor view DOM when the clipboard read behind a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { markSectionBreakRemoval } from "../
|
|
1
|
+
import { markSectionBreakRemoval } from "../paragraphChangeTrackerMeta.js";
|
|
2
2
|
import { mintSectionProperties, sectionPropertiesOf } from "../sectionCarrier.js";
|
|
3
3
|
import { TextSelection } from "prosemirror-state";
|
|
4
4
|
// src/prosemirror/commands/sectionBreak.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DecodedTableCellParagraphSourcePayload } from "../../docx/paragraphPropertySource.js";
|
|
2
2
|
import { document_d_exports } from "../../types/document.js";
|
|
3
|
-
import { Node } from "prosemirror-model";
|
|
4
3
|
import { Transaction } from "prosemirror-state";
|
|
4
|
+
import { Node } from "prosemirror-model";
|
|
5
5
|
export declare const tableCellContinuationPayload: (node: Node) => DecodedTableCellParagraphSourcePayload | null;
|
|
6
6
|
export declare const hasMatchingCollapsedTableCellMerge: (node: Node, revisionSet: Set<number> | null) => boolean;
|
|
7
7
|
type ResolveVisibleTableCellMergeOptions = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Node } from "prosemirror-model";
|
|
2
1
|
import { CellMargins, ConditionalFormatStyle, PreservedMarkup, ShadingProperties, TableCellBorders, TableMeasurement, TextDirection } from "@stll/docx-core/model";
|
|
2
|
+
import { Node } from "prosemirror-model";
|
|
3
3
|
type TableMergeFoldDecisionsOptions = {
|
|
4
4
|
table: Node;
|
|
5
5
|
mode: "accept" | "reject";
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
* controlled `comments` prop and document operations read the same records.
|
|
17
17
|
*/
|
|
18
18
|
import { Comment } from "../types/content.js";
|
|
19
|
-
import { Node, Schema } from "prosemirror-model";
|
|
20
19
|
import { EditorState, Plugin, Transaction } from "prosemirror-state";
|
|
20
|
+
import { Node, Schema } from "prosemirror-model";
|
|
21
21
|
import { EditorView } from "prosemirror-view";
|
|
22
22
|
import { Step, StepMap, StepResult } from "prosemirror-transform";
|
|
23
23
|
export type CommentRecords = readonly Comment[];
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* A revision encloses the control while it still covers everything the control
|
|
13
13
|
* holds, which is also when the save leg can write it around the control.
|
|
14
14
|
*/
|
|
15
|
-
import { MarkType, Node } from "prosemirror-model";
|
|
16
15
|
import { Transaction } from "prosemirror-state";
|
|
16
|
+
import { MarkType, Node } from "prosemirror-model";
|
|
17
17
|
export declare const ENCLOSING_REVISION_IDS_ATTR = "_docxEnclosingRevisionIds";
|
|
18
18
|
/** The revisions whose element encloses `control`. */
|
|
19
19
|
export declare const enclosingRevisionIds: (control: Node) => readonly number[];
|
|
@@ -68,8 +68,8 @@ import { hyphenElementRunContent } from "./hyphenTextCarriers.js";
|
|
|
68
68
|
import { hasSinkChildren } from "./preservedSinkCarriers.js";
|
|
69
69
|
import { decodeSdtListItems, sdtPropertiesFromAttrs, sdtPropertiesMatchAttrs } from "./sdtAttrs.js";
|
|
70
70
|
import { TaggedError, panic } from "better-result";
|
|
71
|
-
import { DRAWING_RAW_XML_MODES, finalizeParagraphFormatting, relationshipIdOf, setDocumentBodyComments } from "@stll/docx-core/model";
|
|
72
71
|
import { Fragment } from "prosemirror-model";
|
|
72
|
+
import { DRAWING_RAW_XML_MODES, finalizeParagraphFormatting, relationshipIdOf, setDocumentBodyComments } from "@stll/docx-core/model";
|
|
73
73
|
import { registerStatedParagraphFormatting, survivingComments } from "@stll/docx-core/ops";
|
|
74
74
|
// src/prosemirror/conversion/fromProseDoc.ts
|
|
75
75
|
/**
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { Node } from "prosemirror-model";
|
|
3
|
+
export type DocumentStructureCounts = {
|
|
4
|
+
blockStructureFingerprint: string;
|
|
5
|
+
sectionRecords: ReadonlySet<document_d_exports.SectionProperties>;
|
|
6
|
+
paragraphs: number;
|
|
7
|
+
/**
|
|
8
|
+
* Distinct section records the paragraphs carry, which is the number of
|
|
9
|
+
* `w:sectPr` the package states for them. A split copies a node's attrs, so
|
|
10
|
+
* both halves of a split section-ending paragraph hold one record until the
|
|
11
|
+
* from-leg keeps it on the trailing half: one section, not two.
|
|
12
|
+
*/
|
|
13
|
+
sectionEndpoints: number;
|
|
14
|
+
sectionEndpointFingerprint: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Count the structural values the tracker compares for every transaction.
|
|
18
|
+
*
|
|
19
|
+
* Each top-level block's records are kept for the block node, so a keystroke
|
|
20
|
+
* recomputes only the block it changed. The fingerprint joins the blocks'
|
|
21
|
+
* records in order: two documents' fingerprints are equal exactly when their
|
|
22
|
+
* full record lists (every block and nested block with its path) are.
|
|
23
|
+
*/
|
|
24
|
+
export declare function countDocumentStructure(doc: Node): DocumentStructureCounts;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { canonicalJson } from "../utils/canonicalJson.js";
|
|
2
|
+
import { sectionPropertiesOf } from "./sectionCarrier.js";
|
|
3
|
+
// src/prosemirror/documentStructureCounts.ts
|
|
4
|
+
const blockStructures = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
const relativePath = (parentPath, index) => parentPath.length === 0 ? `${index}` : `${parentPath}.${index}`;
|
|
6
|
+
const blockStructureOf = (block) => {
|
|
7
|
+
const cached = blockStructures.get(block);
|
|
8
|
+
if (cached) return cached;
|
|
9
|
+
const records = [];
|
|
10
|
+
const endpoints = [];
|
|
11
|
+
let paragraphs = 0;
|
|
12
|
+
const visit = (node, path) => {
|
|
13
|
+
records.push(node.type.name === "paragraph" ? [
|
|
14
|
+
path,
|
|
15
|
+
node.type.name,
|
|
16
|
+
node.attrs["paraId"] ?? null
|
|
17
|
+
] : [
|
|
18
|
+
path,
|
|
19
|
+
node.type.name,
|
|
20
|
+
canonicalJson(node.attrs)
|
|
21
|
+
]);
|
|
22
|
+
if (node.type.name === "paragraph") {
|
|
23
|
+
paragraphs++;
|
|
24
|
+
const sectionProperties = sectionPropertiesOf(node);
|
|
25
|
+
if (sectionProperties !== null) endpoints.push({
|
|
26
|
+
path,
|
|
27
|
+
paraId: node.attrs["paraId"] ?? null,
|
|
28
|
+
sectionProperties
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
node.forEach((child, _offset, index) => visit(child, relativePath(path, index)));
|
|
33
|
+
};
|
|
34
|
+
visit(block, "");
|
|
35
|
+
const structure = {
|
|
36
|
+
records: JSON.stringify(records),
|
|
37
|
+
paragraphs,
|
|
38
|
+
endpoints
|
|
39
|
+
};
|
|
40
|
+
blockStructures.set(block, structure);
|
|
41
|
+
return structure;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Count the structural values the tracker compares for every transaction.
|
|
45
|
+
*
|
|
46
|
+
* Each top-level block's records are kept for the block node, so a keystroke
|
|
47
|
+
* recomputes only the block it changed. The fingerprint joins the blocks'
|
|
48
|
+
* records in order: two documents' fingerprints are equal exactly when their
|
|
49
|
+
* full record lists (every block and nested block with its path) are.
|
|
50
|
+
*/
|
|
51
|
+
function countDocumentStructure(doc) {
|
|
52
|
+
let paragraphs = 0;
|
|
53
|
+
const sectionRecords = /* @__PURE__ */ new Set();
|
|
54
|
+
const blockRecords = [];
|
|
55
|
+
const endpointRecords = [];
|
|
56
|
+
doc.forEach((block, _offset, index) => {
|
|
57
|
+
const structure = blockStructureOf(block);
|
|
58
|
+
blockRecords.push(structure.records);
|
|
59
|
+
paragraphs += structure.paragraphs;
|
|
60
|
+
for (const endpoint of structure.endpoints) {
|
|
61
|
+
sectionRecords.add(endpoint.sectionProperties);
|
|
62
|
+
endpointRecords.push({
|
|
63
|
+
...endpoint,
|
|
64
|
+
path: endpoint.path.length === 0 ? `${index}` : `${index}.${endpoint.path}`
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
blockStructureFingerprint: blockRecords.join(""),
|
|
70
|
+
sectionRecords,
|
|
71
|
+
paragraphs,
|
|
72
|
+
sectionEndpoints: sectionRecords.size,
|
|
73
|
+
sectionEndpointFingerprint: canonicalJson(endpointRecords)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export { countDocumentStructure };
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* 2. initializeRuntime() — calls onSchemaReady() on each extension, collects plugins/commands/keymaps
|
|
7
7
|
*/
|
|
8
8
|
import { AnyExtension, CommandFactory, CommandMap, FolioCommandArguments, FolioCommandName } from "./types.js";
|
|
9
|
-
import { Schema } from "prosemirror-model";
|
|
10
9
|
import { Plugin } from "prosemirror-state";
|
|
10
|
+
import { Schema } from "prosemirror-model";
|
|
11
11
|
export declare class ExtensionManager {
|
|
12
12
|
private readonly extensions;
|
|
13
13
|
private schema;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* manager.initializeRuntime();
|
|
9
9
|
*/
|
|
10
10
|
import { SelectionChangeCallback } from "../plugins/selectionTracker.js";
|
|
11
|
-
import { HistoryShortcutOwner } from "./core/
|
|
11
|
+
import { HistoryShortcutOwner } from "./core/historyCommands.js";
|
|
12
12
|
import { AnyExtension } from "./types.js";
|
|
13
13
|
export type StarterKitOptions = {
|
|
14
14
|
/** Extensions to disable by name */
|
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
* History Extension — undo/redo via prosemirror-history
|
|
3
3
|
*/
|
|
4
4
|
import { Extension } from "../types.js";
|
|
5
|
-
|
|
6
|
-
* Who answers the undo and redo keys (Mod-z, Mod-y, Mod-Shift-z).
|
|
7
|
-
* - `"editor"`: the extension binds them. Default.
|
|
8
|
-
* - `"host"`: nothing binds them. The host keeps its own undo stack and runs
|
|
9
|
-
* the `undo` / `redo` commands itself, so one press never undoes twice.
|
|
10
|
-
*/
|
|
11
|
-
export type HistoryShortcutOwner = "editor" | "host";
|
|
5
|
+
import { HistoryShortcutOwner } from "./historyCommands.js";
|
|
12
6
|
type HistoryOptions = {
|
|
13
7
|
depth: number;
|
|
14
8
|
newGroupDelay: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { withCanonicalHistory } from "../../canonicalCommands.js";
|
|
2
1
|
import { createExtension } from "../create.js";
|
|
2
|
+
import { historyKeyboardShortcuts, redoCommand, undoCommand } from "./historyCommands.js";
|
|
3
3
|
import { Plugin } from "prosemirror-state";
|
|
4
|
-
import { closeHistory, history, isHistoryTransaction
|
|
4
|
+
import { closeHistory, history, isHistoryTransaction } from "prosemirror-history";
|
|
5
5
|
// src/prosemirror/extensions/core/HistoryExtension.ts
|
|
6
6
|
/**
|
|
7
7
|
* History Extension — undo/redo via prosemirror-history
|
|
@@ -90,10 +90,6 @@ const inputBoundaryPlugin = (newGroupDelay) => {
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
-
const consumeHistoryShortcut = (command) => (state, dispatch, view) => {
|
|
94
|
-
command(state, dispatch, view);
|
|
95
|
-
return true;
|
|
96
|
-
};
|
|
97
93
|
const HistoryExtension = createExtension({
|
|
98
94
|
name: "history",
|
|
99
95
|
defaultOptions: {
|
|
@@ -108,14 +104,10 @@ const HistoryExtension = createExtension({
|
|
|
108
104
|
newGroupDelay: options.newGroupDelay
|
|
109
105
|
}), inputBoundaryPlugin(options.newGroupDelay)],
|
|
110
106
|
commands: {
|
|
111
|
-
undo:
|
|
112
|
-
redo:
|
|
107
|
+
undo: undoCommand,
|
|
108
|
+
redo: redoCommand
|
|
113
109
|
},
|
|
114
|
-
...options.shortcuts === "editor" && { keyboardShortcuts:
|
|
115
|
-
"Mod-z": consumeHistoryShortcut(undo),
|
|
116
|
-
"Mod-y": consumeHistoryShortcut(redo),
|
|
117
|
-
"Mod-Shift-z": consumeHistoryShortcut(redo)
|
|
118
|
-
} }
|
|
110
|
+
...options.shortcuts === "editor" && { keyboardShortcuts: historyKeyboardShortcuts }
|
|
119
111
|
};
|
|
120
112
|
}
|
|
121
113
|
});
|
|
@@ -25,8 +25,8 @@ import { rebaseParagraphRuns } from "../../rebaseParagraphRuns.js";
|
|
|
25
25
|
import { mintSectionProperties, parseSectionBreakType, sectionBreakTypeOf } from "../../sectionCarrier.js";
|
|
26
26
|
import { listAttrsFromResolvedStyle, listIndentationProvenancePatch, paragraphAttrsFromResolvedStyle } from "../../styles/resolvedStyleAttrs.js";
|
|
27
27
|
import { createNodeExtension } from "../create.js";
|
|
28
|
-
import { headingOutlineLevel } from "@stll/docx-core/model";
|
|
29
28
|
import { Fragment } from "prosemirror-model";
|
|
29
|
+
import { headingOutlineLevel } from "@stll/docx-core/model";
|
|
30
30
|
// src/prosemirror/extensions/core/ParagraphExtension.ts
|
|
31
31
|
/**
|
|
32
32
|
* Paragraph Extension — paragraph node with alignment, spacing, indent, style commands
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Undo and redo: the commands and the keys that run them, apart from the
|
|
3
|
+
* `prosemirror-history` plugin that keeps the stack.
|
|
4
|
+
*/
|
|
5
|
+
import { KeyboardShortcutMap } from "../types.js";
|
|
6
|
+
import { Command } from "prosemirror-state";
|
|
7
|
+
/**
|
|
8
|
+
* Who answers the undo and redo keys (Mod-z, Mod-y, Mod-Shift-z).
|
|
9
|
+
* - `"editor"`: the extension binds them. Default.
|
|
10
|
+
* - `"host"`: nothing binds them. The host keeps its own undo stack and runs
|
|
11
|
+
* the `undo` / `redo` commands itself, so one press never undoes twice.
|
|
12
|
+
*/
|
|
13
|
+
export type HistoryShortcutOwner = "editor" | "host";
|
|
14
|
+
export declare const undoCommand: () => Command;
|
|
15
|
+
export declare const redoCommand: () => Command;
|
|
16
|
+
export declare const historyKeyboardShortcuts: KeyboardShortcutMap;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { withCanonicalHistory } from "../../canonicalCommands.js";
|
|
2
|
+
import { redo, undo } from "prosemirror-history";
|
|
3
|
+
// src/prosemirror/extensions/core/historyCommands.ts
|
|
4
|
+
/**
|
|
5
|
+
* Undo and redo: the commands and the keys that run them, apart from the
|
|
6
|
+
* `prosemirror-history` plugin that keeps the stack.
|
|
7
|
+
*/
|
|
8
|
+
const undoCommand = () => withCanonicalHistory(undo, "undo");
|
|
9
|
+
const redoCommand = () => withCanonicalHistory(redo, "redo");
|
|
10
|
+
const consumeHistoryShortcut = (command) => (state, dispatch, view) => {
|
|
11
|
+
command(state, dispatch, view);
|
|
12
|
+
return true;
|
|
13
|
+
};
|
|
14
|
+
const historyKeyboardShortcuts = {
|
|
15
|
+
"Mod-z": consumeHistoryShortcut(undo),
|
|
16
|
+
"Mod-y": consumeHistoryShortcut(redo),
|
|
17
|
+
"Mod-Shift-z": consumeHistoryShortcut(redo)
|
|
18
|
+
};
|
|
19
|
+
export { historyKeyboardShortcuts, redoCommand, undoCommand };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { setProseParagraphMarkupWithPropertySource } from "../../../docx/paragraphPropertySource.js";
|
|
2
2
|
import { getTransactionDirtyRange } from "../../../paged-layout/transactionDirtyRange.js";
|
|
3
3
|
import { detectBaseDirection } from "../../../utils/baseDirection.js";
|
|
4
|
+
import { ignoreTrackedChanges } from "../../paragraphChangeTrackerMeta.js";
|
|
4
5
|
import { directionIsAutoManaged } from "../../paragraphDirection.js";
|
|
5
6
|
import { createPluginKeyOwner } from "../../pluginKeyOwner.js";
|
|
6
7
|
import { afterNativeCompositionFlush } from "../../textInput.js";
|
|
7
8
|
import { createExtension } from "../create.js";
|
|
8
|
-
import { ignoreTrackedChanges } from "./ParagraphChangeTrackerExtension.js";
|
|
9
9
|
import { Plugin } from "prosemirror-state";
|
|
10
10
|
// src/prosemirror/extensions/features/AutoBidiDetectionExtension.ts
|
|
11
11
|
/**
|
|
@@ -1,30 +1,7 @@
|
|
|
1
|
+
import { ParagraphPropertySourceSeed } from "../../paraIds.js";
|
|
1
2
|
import { Extension } from "../types.js";
|
|
3
|
+
import { Transaction } from "prosemirror-state";
|
|
2
4
|
import { Node } from "prosemirror-model";
|
|
3
|
-
import { EditorState, Plugin, PluginKey, Transaction } from "prosemirror-state";
|
|
4
|
-
type ParagraphPropertySourceSeed = {
|
|
5
|
-
contract: string | null;
|
|
6
|
-
tokens: ReadonlySet<string>;
|
|
7
|
-
};
|
|
8
|
-
export declare const paraIdAllocatorKey: Readonly<{
|
|
9
|
-
key: string;
|
|
10
|
-
createKey: () => PluginKey<ParagraphPropertySourceSeed>;
|
|
11
|
-
owns: (plugin: Plugin<ParagraphPropertySourceSeed>) => boolean;
|
|
12
|
-
get: (state: EditorState) => Plugin<ParagraphPropertySourceSeed> | undefined;
|
|
13
|
-
getState: (state: EditorState) => ParagraphPropertySourceSeed | undefined;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Transaction meta asking this plugin to derive the ids it mints from a
|
|
17
|
-
* caller-supplied seed instead of `Math.random()`.
|
|
18
|
-
*
|
|
19
|
-
* A live editor wants random ids: two people typing must not collide. A
|
|
20
|
-
* generator whose whole output has to be reproducible — the document compare —
|
|
21
|
-
* cannot afford them, and it is the only party that knows its run is meant to
|
|
22
|
-
* be deterministic, so it says so on its own transaction rather than leaving
|
|
23
|
-
* the plugin to guess.
|
|
24
|
-
*/
|
|
25
|
-
export declare const deterministicParaIdSeedKey = "stll.folio.meta.deterministicParaIdSeed";
|
|
26
|
-
/** Ask the allocator to mint reproducible ids for the paragraphs `tr` creates. */
|
|
27
|
-
export declare const requestDeterministicParaIds: (tr: Transaction, seed: string) => Transaction;
|
|
28
5
|
type ParagraphPropertySourceKeeper = {
|
|
29
6
|
status: "ambiguous";
|
|
30
7
|
} | {
|
|
@@ -42,15 +19,5 @@ type MappedParagraphKeepers = {
|
|
|
42
19
|
* @internal Exported for the per-step equivalence test.
|
|
43
20
|
*/
|
|
44
21
|
export declare const mapParagraphKeepers: (oldDoc: Node, transactions: readonly Transaction[], sourceSeed: ParagraphPropertySourceSeed) => MappedParagraphKeepers;
|
|
45
|
-
/**
|
|
46
|
-
* Allocate initial paragraph IDs before constructing editor state.
|
|
47
|
-
*
|
|
48
|
-
* Rebuilding only changed branches avoids applying one ProseMirror transaction
|
|
49
|
-
* step per missing paragraph. Live edits still use the transaction-based plugin
|
|
50
|
-
* below so history, mappings, and duplicate ownership retain their semantics.
|
|
51
|
-
*/
|
|
52
|
-
export declare const ensureParaIdsInDoc: (doc: Node) => Node;
|
|
53
|
-
/** {@link ensureParaIdsInDoc} for a state that already exists. */
|
|
54
|
-
export declare const ensureParaIdsInState: (state: EditorState) => EditorState;
|
|
55
22
|
export declare const ParaIdAllocatorExtension: (options?: Partial<Record<never, never>> | undefined) => Extension;
|
|
56
23
|
export {};
|