@stll/folio-core 0.74.0 → 0.76.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/clean-text.d.ts +4 -1
- package/dist/ai-edits/clean-text.js +21 -7
- package/dist/ai-edits/headless.d.ts +7 -3
- package/dist/ai-edits/headless.js +36 -21
- package/dist/ai-edits/note-references.d.ts +1 -1
- package/dist/ai-edits/note-references.js +1 -1
- package/dist/ai-edits/pending-suggestions.d.ts +9 -7
- package/dist/ai-edits/pending-suggestions.js +135 -90
- package/dist/ai-edits/pendingJoin.d.ts +5 -1
- package/dist/ai-edits/pendingJoin.js +6 -2
- package/dist/ai-edits/read.js +9 -3
- package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
- package/dist/ai-edits/retired-comment-receipts.js +3 -18
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
- package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
- package/dist/ai-edits/types.d.ts +9 -4
- package/dist/canonical/batchCommentReferences.js +2 -1
- package/dist/canonical/canonicalBatchReview.d.ts +4 -1
- package/dist/canonical/canonicalBatchReview.js +37 -22
- package/dist/canonical/canonicalComments.d.ts +6 -2
- package/dist/canonical/canonicalComments.js +16 -6
- package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
- package/dist/canonical/canonicalCompilerRefusal.js +20 -14
- package/dist/canonical/canonicalPublicOperations.js +231 -79
- package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
- package/dist/canonical/canonicalRefusalGrounds.js +56 -0
- package/dist/canonical/canonicalSession.d.ts +12 -6
- package/dist/canonical/canonicalSession.js +119 -122
- package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
- package/dist/compare/inline-atoms.d.ts +35 -41
- package/dist/compare/inline-atoms.js +2 -465
- package/dist/compare/section-boundary-properties.d.ts +3 -30
- package/dist/compare/section-boundary-properties.js +4 -72
- package/dist/controller/canonicalClipboard.d.ts +1 -1
- package/dist/controller/canonicalClipboard.js +110 -55
- package/dist/controller/canonicalComposition.d.ts +1 -1
- package/dist/controller/canonicalComposition.js +5 -5
- package/dist/controller/canonicalContentControlValue.js +7 -7
- package/dist/controller/canonicalInput.d.ts +4 -2
- package/dist/controller/canonicalInput.js +33 -16
- package/dist/controller/canonicalReview.d.ts +21 -0
- package/dist/controller/canonicalReview.js +44 -9
- package/dist/controller/canonicalStoryEditor.d.ts +2 -3
- package/dist/controller/canonicalStoryEditor.js +43 -25
- package/dist/controller/canonicalStructure.d.ts +19 -3
- package/dist/controller/canonicalStructure.js +182 -58
- package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
- package/dist/controller/deferredDisplayListPainter.js +34 -0
- package/dist/controller/folioEditor.js +4 -2
- package/dist/controller/fontReadiness.js +50 -23
- package/dist/controller/headerFooterEditorManager.js +3 -17
- package/dist/controller/hiddenEditorApi.d.ts +24 -3
- package/dist/controller/hiddenEditorApi.js +2 -0
- package/dist/controller/hiddenEditorManager.js +135 -207
- package/dist/controller/layoutPipeline.d.ts +4 -86
- package/dist/controller/layoutPipeline.js +8 -727
- package/dist/controller/layoutPipelineExecution.d.ts +94 -0
- package/dist/controller/layoutPipelineExecution.js +730 -0
- package/dist/controller/noteEditorManager.js +3 -16
- package/dist/docx/blockContentParser.d.ts +1 -3
- package/dist/docx/blockContentParser.js +3 -10
- package/dist/docx/bulletMarkers.d.ts +8 -0
- package/dist/docx/bulletMarkers.js +9 -1
- package/dist/docx/canonicalSave.d.ts +4 -3
- package/dist/docx/canonicalSave.js +4 -3
- package/dist/docx/canonicalSessionInput.js +25 -11
- package/dist/docx/ensureParaIds.d.ts +31 -0
- package/dist/docx/ensureParaIds.js +57 -32
- package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
- package/dist/docx/ensureUniqueControlIds.js +47 -29
- package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
- package/dist/docx/ensureUniqueRevisionIds.js +52 -29
- package/dist/docx/listMarkerComputation.d.ts +24 -17
- package/dist/docx/listMarkerComputation.js +31 -60
- package/dist/docx/listModelNormalization.js +8 -15
- package/dist/docx/rezip.d.ts +16 -3
- package/dist/docx/rezip.js +35 -9
- package/dist/docx/selectiveSave.js +13 -5
- package/dist/docx/server/templatePlan/apply.js +96 -7
- package/dist/docx/server/templatePlan/blocks.d.ts +70 -3
- package/dist/docx/server/templatePlan/blocks.js +272 -10
- package/dist/docx/server/templatePlan/builders.d.ts +52 -2
- package/dist/docx/server/templatePlan/builders.js +224 -5
- package/dist/docx/server/templatePlan/effects.d.ts +27 -0
- package/dist/docx/server/templatePlan/effects.js +188 -0
- package/dist/docx/server/templatePlan/emit.d.ts +4 -1
- package/dist/docx/server/templatePlan/emit.js +46 -2
- package/dist/docx/server/templatePlan/inspect.js +39 -52
- package/dist/docx/server/templatePlan/labels.d.ts +7 -2
- package/dist/docx/server/templatePlan/labels.js +120 -23
- package/dist/docx/server/templatePlan/plan.d.ts +24 -3
- package/dist/docx/server/templatePlan/plan.js +54 -15
- package/dist/docx/server/templatePlan/planShape.js +76 -22
- package/dist/docx/server/templatePlan/revisions.d.ts +46 -0
- package/dist/docx/server/templatePlan/revisions.js +407 -0
- package/dist/docx/server/templatePlan/story.d.ts +23 -1
- package/dist/docx/server/templatePlan/story.js +60 -2
- package/dist/docx/server/templatePlan/types.d.ts +354 -16
- package/dist/docx/server/templatePlan/verify.js +164 -14
- package/dist/docx/server/templatePlan/xml.d.ts +3 -0
- package/dist/docx/server/templatePlan/xml.js +4 -1
- package/dist/i18n/messages/ar.gen.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
- package/dist/i18n/messages/catalogs.gen.js +17 -0
- package/dist/i18n/messages/cs.gen.js +1 -0
- package/dist/i18n/messages/de.gen.js +1 -0
- package/dist/i18n/messages/en.gen.js +1 -0
- package/dist/i18n/messages/es.gen.js +1 -0
- package/dist/i18n/messages/et.gen.js +1 -0
- package/dist/i18n/messages/fr.gen.js +1 -0
- package/dist/i18n/messages/he.gen.js +1 -0
- package/dist/i18n/messages/hi.gen.js +1 -0
- package/dist/i18n/messages/hu.gen.js +1 -0
- package/dist/i18n/messages/lt.gen.js +1 -0
- package/dist/i18n/messages/lv.gen.js +1 -0
- package/dist/i18n/messages/messages.gen.d.ts +1 -0
- package/dist/i18n/messages/pl.gen.js +1 -0
- package/dist/i18n/messages/pt-BR.gen.js +1 -0
- package/dist/i18n/messages/sk.gen.js +1 -0
- package/dist/i18n/messages/tr.gen.js +1 -0
- package/dist/i18n/messages/zh-CN.gen.js +1 -0
- package/dist/internal/revisionResolutionStep.d.ts +2 -31
- package/dist/internal/revisionResolutionStep.js +2 -171
- package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
- package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
- package/dist/prosemirror/commands/comments.d.ts +6 -234
- package/dist/prosemirror/commands/comments.js +5 -2464
- package/dist/prosemirror/commands/index.d.ts +4 -2
- package/dist/prosemirror/commands/index.js +4 -2
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -11
- package/dist/prosemirror/commands/tableCellMergeResolution.js +3 -154
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
- package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
- package/dist/prosemirror/hyperlinkRemoval.js +24 -15
- package/dist/prosemirror/listMarker.d.ts +1 -6
- package/dist/prosemirror/listMarker.js +4 -56
- package/dist/prosemirror/paraIds.d.ts +1 -14
- package/dist/prosemirror/paraIds.js +1 -14
- package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
- package/dist/prosemirror/paragraphMarkJoin.js +3 -46
- package/dist/prosemirror/projectionReview.d.ts +49 -0
- package/dist/prosemirror/projectionReview.js +292 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
- package/dist/prosemirror/replacedAnnotations.d.ts +2 -5
- package/dist/prosemirror/replacedAnnotations.js +1 -10
- package/dist/prosemirror/revisionCarriers.d.ts +9 -1
- package/dist/prosemirror/revisionCarriers.js +15 -1
- package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
- package/dist/prosemirror/revisionRangeQueries.js +76 -0
- package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
- package/dist/prosemirror/runFormattingMarkNames.js +1 -1
- package/dist/prosemirror/suggestionQueries.d.ts +114 -0
- package/dist/prosemirror/suggestionQueries.js +320 -0
- package/dist/prosemirror/tableGridMutation.d.ts +1 -16
- package/dist/prosemirror/tableGridMutation.js +1 -78
- package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
- package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
- package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
- package/dist/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +40 -69
- package/dist/types/canonicalCapabilities.js +51 -65
- package/dist/types/canonicalComments.d.ts +2 -2
- package/dist/types/canonicalSections.d.ts +2 -2
- package/dist/utils/clipboard.d.ts +2 -28
- package/dist/utils/clipboard.js +1 -96
- package/dist/utils/clipboardFiles.d.ts +27 -0
- package/dist/utils/clipboardFiles.js +98 -0
- package/dist/utils/rulerControl.d.ts +1 -0
- package/dist/utils/rulerControl.js +2 -1
- package/package.json +2 -2
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
- package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
|
@@ -19,23 +19,22 @@ import { createEmptyDoc, toProseDoc } from "../prosemirror/conversion/toProseDoc
|
|
|
19
19
|
import { registerEditorCommandOwner } from "../prosemirror/executeEditorCommand.js";
|
|
20
20
|
import { ensureBaseDirectionInState } from "../prosemirror/extensions/features/AutoBidiDetectionExtension.js";
|
|
21
21
|
import { toggleMarkForAllScripts, toggleUnderlineMark } from "../prosemirror/extensions/marks/markUtils.js";
|
|
22
|
-
import { HyperlinkRemovalRefusal } from "../prosemirror/hyperlinkRemoval.js";
|
|
23
22
|
import { REVISION_MARK_NAMES } from "../prosemirror/keptRangeBoundaries.js";
|
|
24
23
|
import { adoptNativeSelection, createNativeNavigationPlugin, createNativeSelectionRefreshPlugin, isCompositionKeyDown } from "../prosemirror/nativeSelection.js";
|
|
25
|
-
import { noteReferenceTransactionIssue } from "../prosemirror/noteReferenceOccurrences.js";
|
|
24
|
+
import { NoteReferenceReplayDefect, noteReferenceTransactionIssue } from "../prosemirror/noteReferenceOccurrences.js";
|
|
26
25
|
import { ensureParaIdsInDoc } from "../prosemirror/paraIds.js";
|
|
27
26
|
import { createDocumentNumberingPlugin } from "../prosemirror/plugins/documentNumbering.js";
|
|
28
27
|
import { createDocumentStyleContextPlugin, createDocumentStylesPlugin } from "../prosemirror/plugins/documentStyles.js";
|
|
29
28
|
import { schema } from "../prosemirror/schema/index.js";
|
|
30
|
-
import {
|
|
29
|
+
import { CANONICAL_CONDITION, CANONICAL_RULE } from "../types/canonicalCapabilities.js";
|
|
31
30
|
import { readModel } from "../types/documentModel.js";
|
|
32
|
-
import { INTERNAL_CLIPBOARD_TYPE } from "../utils/
|
|
31
|
+
import { INTERNAL_CLIPBOARD_TYPE } from "../utils/clipboardFiles.js";
|
|
33
32
|
import { NO_ANONYMIZATION_TERMS, createAnonymizationHighlights } from "./anonymizationHighlights.js";
|
|
34
33
|
import { canTriggerAutocomplete, classifyAutocompleteEdit, createAutocompleteSuggestion, nextAutocompleteWord } from "./autocompleteSuggestion.js";
|
|
35
34
|
import { prepareCanonicalPaste } from "./canonicalClipboard.js";
|
|
36
35
|
import { createCanonicalInputBoundary, unclassifiedMutationMessage } from "./canonicalInput.js";
|
|
37
36
|
import { openCanonicalRoomEditor } from "./canonicalRoomEditor.js";
|
|
38
|
-
import {
|
|
37
|
+
import { prepareCanonicalAutoformat, prepareCanonicalCommands, prepareCanonicalStructure } from "./canonicalStructure.js";
|
|
39
38
|
import { createHiddenEditorApi } from "./hiddenEditorApi.js";
|
|
40
39
|
import { handleReadOnlySelectionKeyDown } from "./readOnlySelection.js";
|
|
41
40
|
import { Result, TaggedError } from "better-result";
|
|
@@ -186,7 +185,7 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
186
185
|
author: deps.getSuggestionAuthor?.() ?? "User"
|
|
187
186
|
} : { type: "editing" }));
|
|
188
187
|
};
|
|
189
|
-
const refuse = (reason, ground
|
|
188
|
+
const refuse = (reason, ground) => {
|
|
190
189
|
const message = reason;
|
|
191
190
|
if (deps.onSessionRefusal) deps.onSessionRefusal(message, ground);
|
|
192
191
|
else throw new CanonicalSessionRefusalError({
|
|
@@ -217,7 +216,7 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
217
216
|
reason,
|
|
218
217
|
documentIdentity
|
|
219
218
|
};
|
|
220
|
-
refuse(reason, {
|
|
219
|
+
refuse(reason, { condition: CANONICAL_CONDITION.notReady });
|
|
221
220
|
return false;
|
|
222
221
|
}
|
|
223
222
|
const result = createCanonicalSession(document, deps.getStyles());
|
|
@@ -335,7 +334,7 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
335
334
|
const { state } = view;
|
|
336
335
|
const { session } = editorSession;
|
|
337
336
|
if (state.selection instanceof CellSelection) {
|
|
338
|
-
refuse("A field goes in at a text selection, not over cells.");
|
|
337
|
+
refuse("A field goes in at a text selection, not over cells.", { condition: CANONICAL_CONDITION.invalidRequest });
|
|
339
338
|
return false;
|
|
340
339
|
}
|
|
341
340
|
const range = canonicalSelectionRange(state);
|
|
@@ -373,7 +372,7 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
373
372
|
*/
|
|
374
373
|
const publishRemote = (session, commit) => {
|
|
375
374
|
if (!view || isDestroying || editorSession.type !== "canonical" || editorSession.session !== session) return Result.err(new CanonicalSessionError({
|
|
376
|
-
ground: {
|
|
375
|
+
ground: { condition: CANONICAL_CONDITION.notReady },
|
|
377
376
|
message: "The editor showing the room is closed.",
|
|
378
377
|
reason: "refused"
|
|
379
378
|
}));
|
|
@@ -494,24 +493,10 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
494
493
|
const direction = getCanonicalHistoryDirection(command);
|
|
495
494
|
if (direction !== void 0) return history(direction);
|
|
496
495
|
if (editorSession.session.isComposing) {
|
|
497
|
-
refuse("Composition must finish before formatting.");
|
|
496
|
+
refuse("Composition must finish before formatting.", { condition: CANONICAL_CONDITION.composing });
|
|
498
497
|
return false;
|
|
499
498
|
}
|
|
500
|
-
const
|
|
501
|
-
const described = Result.try({
|
|
502
|
-
try: () => getCanonicalCommandIntents(command, commandState),
|
|
503
|
-
catch: (error) => error
|
|
504
|
-
});
|
|
505
|
-
if (described.isErr()) {
|
|
506
|
-
if (!(described.error instanceof HyperlinkRemovalRefusal)) throw described.error;
|
|
507
|
-
const refusal = new CanonicalSessionRefusalError({
|
|
508
|
-
ground: { gap: CANONICAL_GAP.commands },
|
|
509
|
-
message: described.error.message
|
|
510
|
-
});
|
|
511
|
-
refuse(refusal.message, refusal.ground);
|
|
512
|
-
return false;
|
|
513
|
-
}
|
|
514
|
-
const intents = described.value;
|
|
499
|
+
const intents = getCanonicalCommandIntents(command, view.state);
|
|
515
500
|
if (intents === void 0) return void 0;
|
|
516
501
|
if (intents.length > 0 && intents.every((intent) => intent.type === "selection")) return command(view.state, (transaction) => view?.dispatch(transaction), view);
|
|
517
502
|
syncCanonicalMode();
|
|
@@ -544,6 +529,58 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
544
529
|
token
|
|
545
530
|
};
|
|
546
531
|
};
|
|
532
|
+
/**
|
|
533
|
+
* Cut the selection of the editor showing `story`: the clipboard takes it
|
|
534
|
+
* first, and the story loses it only once the clipboard holds it.
|
|
535
|
+
*/
|
|
536
|
+
const cutCanonical = (pmView, event, story) => {
|
|
537
|
+
event.preventDefault();
|
|
538
|
+
if (deps.getReadOnly()) {
|
|
539
|
+
deps.onReadOnlyEditAttempt();
|
|
540
|
+
return true;
|
|
541
|
+
}
|
|
542
|
+
deps.onCut?.();
|
|
543
|
+
if (editorSession.type !== "canonical" || pmView.state.selection.empty) return true;
|
|
544
|
+
if (event.clipboardData === null) {
|
|
545
|
+
refuse("The clipboard cannot receive the cut content.", { condition: CANONICAL_CONDITION.invalidRequest });
|
|
546
|
+
return true;
|
|
547
|
+
}
|
|
548
|
+
syncCanonicalMode();
|
|
549
|
+
const source = readModel(editorSession.session.document);
|
|
550
|
+
const session = editorSession.session;
|
|
551
|
+
const { from, to } = pmView.state.selection;
|
|
552
|
+
const prepared = session.prepareReplace(pmView.state, {
|
|
553
|
+
from,
|
|
554
|
+
to,
|
|
555
|
+
text: "",
|
|
556
|
+
semantic: "replacement",
|
|
557
|
+
story
|
|
558
|
+
});
|
|
559
|
+
if (prepared.isErr()) {
|
|
560
|
+
refuse(prepared.error.message, prepared.error.ground);
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
const data = event.clipboardData;
|
|
564
|
+
const copied = Result.try({
|
|
565
|
+
try: () => writeClipboard(pmView, data),
|
|
566
|
+
catch: () => new CanonicalSessionRefusalError({
|
|
567
|
+
ground: { condition: CANONICAL_CONDITION.invalidRequest },
|
|
568
|
+
message: "The clipboard could not receive the cut content."
|
|
569
|
+
})
|
|
570
|
+
});
|
|
571
|
+
if (copied.isErr()) {
|
|
572
|
+
refuse(copied.error.message, copied.error.ground);
|
|
573
|
+
return true;
|
|
574
|
+
}
|
|
575
|
+
clipboardCopy = {
|
|
576
|
+
type: "copied",
|
|
577
|
+
document: source,
|
|
578
|
+
...copied.value
|
|
579
|
+
};
|
|
580
|
+
if (story === OP_STORIES.MAIN) publishCommit(prepared.value);
|
|
581
|
+
else publishStoryCommit(pmView, prepared.value);
|
|
582
|
+
return true;
|
|
583
|
+
};
|
|
547
584
|
/** The copied document, when the pasted clipboard is the editor's own copy. */
|
|
548
585
|
const copiedSource = (event) => {
|
|
549
586
|
const data = event.clipboardData;
|
|
@@ -564,7 +601,7 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
564
601
|
if (mark !== void 0) command = name === "toggleUnderline" ? toggleUnderlineMark(mark) : toggleMarkForAllScripts(mark, name === "toggleBold" ? "bold" : "italic");
|
|
565
602
|
}
|
|
566
603
|
if (command === void 0) {
|
|
567
|
-
refuse("The formatting command is unavailable.", {
|
|
604
|
+
refuse("The formatting command is unavailable.", { condition: CANONICAL_CONDITION.invalidRequest });
|
|
568
605
|
return;
|
|
569
606
|
}
|
|
570
607
|
if (executeCanonicalCommand(command) === void 0) command(view.state, (transaction) => view?.dispatch(transaction), view);
|
|
@@ -574,116 +611,18 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
574
611
|
syncCanonicalMode();
|
|
575
612
|
if (type === "deleteTable") {
|
|
576
613
|
const command = deps.getExtensionManager()?.getCommand("deleteTable")?.();
|
|
577
|
-
if (command === void 0) refuse("Deleting the table is unavailable.", {
|
|
614
|
+
if (command === void 0) refuse("Deleting the table is unavailable.", { condition: CANONICAL_CONDITION.invalidRequest });
|
|
578
615
|
else executeCanonicalCommand(command);
|
|
579
616
|
return;
|
|
580
617
|
}
|
|
581
618
|
const session = editorSession.session;
|
|
582
619
|
const state = view.state;
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
from: at,
|
|
587
|
-
to: at,
|
|
588
|
-
paragraphs: [{
|
|
589
|
-
type: "paragraph",
|
|
590
|
-
content: []
|
|
591
|
-
}, {
|
|
592
|
-
type: "paragraph",
|
|
593
|
-
content: []
|
|
594
|
-
}],
|
|
595
|
-
openStart: 1,
|
|
596
|
-
openEnd: 1
|
|
597
|
-
} : {
|
|
598
|
-
type: "insertAtom",
|
|
599
|
-
from: at,
|
|
600
|
-
to: at,
|
|
601
|
-
atom: type === "tab" ? { type: "tab" } : {
|
|
602
|
-
type: "break",
|
|
603
|
-
breakType: type === "pageBreak" ? "page" : "textWrapping"
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
if (overCells.isErr()) {
|
|
607
|
-
if (overCells.error.reason !== "noChange") refuse(overCells.error.message, overCells.error.ground);
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
publishCommit(overCells.value);
|
|
620
|
+
if (type === "joinBackward" && lastInputRule?.session === session && lastInputRule.version === session.version && lastInputRule.caret === state.selection.head) {
|
|
621
|
+
lastInputRule = void 0;
|
|
622
|
+
history("undo");
|
|
611
623
|
return;
|
|
612
624
|
}
|
|
613
|
-
const
|
|
614
|
-
if (selection.isErr()) {
|
|
615
|
-
refuse(selection.error.message, selection.error.ground);
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
let prepared;
|
|
619
|
-
switch (type) {
|
|
620
|
-
case "split": {
|
|
621
|
-
const source = session.projection.paragraph(selection.value.head.blockId)?.source;
|
|
622
|
-
prepared = isCanonicalListParagraph(source) && state.selection.$from.parent.content.size === 0 ? prepareCanonicalCommands(session, state, [{ type: "removeList" }]) : session.prepareSplit(state);
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
case "joinBackward": {
|
|
626
|
-
if (lastInputRule?.session === session && lastInputRule.version === session.version && lastInputRule.caret === state.selection.head) {
|
|
627
|
-
lastInputRule = void 0;
|
|
628
|
-
history("undo");
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
const paragraph = session.projection.paragraph(selection.value.head.blockId)?.source;
|
|
632
|
-
if (isCanonicalListParagraph(paragraph)) {
|
|
633
|
-
prepared = prepareCanonicalCommands(session, state, [{ type: "removeList" }]);
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
if ((paragraph?.formatting?.indentLeft ?? 0) > 0 || (paragraph?.formatting?.indentFirstLine ?? 0) > 0) {
|
|
637
|
-
prepared = session.prepareIntent(state, {
|
|
638
|
-
type: "formatParagraph",
|
|
639
|
-
at: selection.value.head,
|
|
640
|
-
patch: {
|
|
641
|
-
indentLeft: null,
|
|
642
|
-
indentFirstLine: null,
|
|
643
|
-
hangingIndent: null
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
prepared = session.prepareJoin(state, "backward");
|
|
649
|
-
break;
|
|
650
|
-
}
|
|
651
|
-
case "joinForward":
|
|
652
|
-
prepared = session.prepareJoin(state, "forward");
|
|
653
|
-
break;
|
|
654
|
-
case "indent":
|
|
655
|
-
case "outdent":
|
|
656
|
-
prepared = prepareCanonicalCommands(session, state, [{
|
|
657
|
-
type: "changeListLevel",
|
|
658
|
-
direction: type === "indent" ? "increase" : "decrease"
|
|
659
|
-
}]);
|
|
660
|
-
break;
|
|
661
|
-
case "tab":
|
|
662
|
-
case "lineBreak":
|
|
663
|
-
case "pageBreak": {
|
|
664
|
-
const from = session.projection.addressAt(state.selection.from);
|
|
665
|
-
const to = session.projection.addressAt(state.selection.to);
|
|
666
|
-
if (from.isErr()) {
|
|
667
|
-
refuse(from.error.message, from.error.ground);
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
if (to.isErr()) {
|
|
671
|
-
refuse(to.error.message, to.error.ground);
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
prepared = session.prepareIntent(state, {
|
|
675
|
-
type: "insertAtom",
|
|
676
|
-
from: from.value,
|
|
677
|
-
to: to.value,
|
|
678
|
-
atom: type === "tab" ? { type: "tab" } : {
|
|
679
|
-
type: "break",
|
|
680
|
-
breakType: type === "pageBreak" ? "page" : "textWrapping"
|
|
681
|
-
}
|
|
682
|
-
});
|
|
683
|
-
break;
|
|
684
|
-
}
|
|
685
|
-
default: return type;
|
|
686
|
-
}
|
|
625
|
+
const prepared = prepareCanonicalStructure(session, state, OP_STORIES.MAIN, type);
|
|
687
626
|
if (prepared.isErr()) {
|
|
688
627
|
if (prepared.error.reason !== "noChange") refuse(prepared.error.message, prepared.error.ground);
|
|
689
628
|
return;
|
|
@@ -722,52 +661,7 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
722
661
|
}
|
|
723
662
|
pasteWithoutFormatting(pmView.state, (transaction) => pmView.dispatch(transaction), pmView);
|
|
724
663
|
},
|
|
725
|
-
cut: (pmView, event) =>
|
|
726
|
-
event.preventDefault();
|
|
727
|
-
if (deps.getReadOnly()) {
|
|
728
|
-
deps.onReadOnlyEditAttempt();
|
|
729
|
-
return true;
|
|
730
|
-
}
|
|
731
|
-
deps.onCut?.();
|
|
732
|
-
if (editorSession.type !== "canonical" || pmView.state.selection.empty) return true;
|
|
733
|
-
if (event.clipboardData === null) {
|
|
734
|
-
refuse("The clipboard cannot receive the cut content.");
|
|
735
|
-
return true;
|
|
736
|
-
}
|
|
737
|
-
syncCanonicalMode();
|
|
738
|
-
const source = readModel(editorSession.session.document);
|
|
739
|
-
const session = editorSession.session;
|
|
740
|
-
const { from, to } = pmView.state.selection;
|
|
741
|
-
const prepared = session.prepareReplace(pmView.state, {
|
|
742
|
-
from,
|
|
743
|
-
to,
|
|
744
|
-
text: "",
|
|
745
|
-
semantic: "replacement"
|
|
746
|
-
});
|
|
747
|
-
if (prepared.isErr()) {
|
|
748
|
-
refuse(prepared.error.message, prepared.error.ground);
|
|
749
|
-
return true;
|
|
750
|
-
}
|
|
751
|
-
const data = event.clipboardData;
|
|
752
|
-
const copied = Result.try({
|
|
753
|
-
try: () => writeClipboard(pmView, data),
|
|
754
|
-
catch: () => new CanonicalSessionRefusalError({
|
|
755
|
-
ground: { gap: CANONICAL_GAP.dispatch },
|
|
756
|
-
message: "The clipboard could not receive the cut content."
|
|
757
|
-
})
|
|
758
|
-
});
|
|
759
|
-
if (copied.isErr()) {
|
|
760
|
-
refuse(copied.error.message, copied.error.ground);
|
|
761
|
-
return true;
|
|
762
|
-
}
|
|
763
|
-
clipboardCopy = {
|
|
764
|
-
type: "copied",
|
|
765
|
-
document: source,
|
|
766
|
-
...copied.value
|
|
767
|
-
};
|
|
768
|
-
publishCommit(prepared.value);
|
|
769
|
-
return true;
|
|
770
|
-
},
|
|
664
|
+
cut: (pmView, event) => cutCanonical(pmView, event, OP_STORIES.MAIN),
|
|
771
665
|
...canonicalInputLifecycle,
|
|
772
666
|
...canonicalStructuralInput,
|
|
773
667
|
replace: (intent) => {
|
|
@@ -832,9 +726,9 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
832
726
|
}
|
|
833
727
|
const applied = view.state.applyTransaction(transaction);
|
|
834
728
|
const noteIssue = noteReferenceTransactionIssue(transaction);
|
|
835
|
-
if (noteIssue) deps.onSessionRefusal?.(noteIssue.message, {
|
|
729
|
+
if (noteIssue) deps.onSessionRefusal?.(noteIssue.message, { condition: noteIssue instanceof NoteReferenceReplayDefect ? CANONICAL_CONDITION.internal : CANONICAL_CONDITION.invalidRequest }, noteIssue);
|
|
836
730
|
if (!applied.state.doc.eq(view.state.doc)) {
|
|
837
|
-
refuse(unclassifiedMutationMessage(applied.transactions, "A plugin attempted an unclassified canonical document mutation."));
|
|
731
|
+
refuse(unclassifiedMutationMessage(applied.transactions, "A plugin attempted an unclassified canonical document mutation."), { condition: CANONICAL_CONDITION.hostTransaction });
|
|
838
732
|
return;
|
|
839
733
|
}
|
|
840
734
|
const documentEdits = applied.transactions.filter((appliedTransaction) => appliedTransaction.docChanged && !isCommentRecordsSync(appliedTransaction));
|
|
@@ -890,13 +784,13 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
890
784
|
top: event.clientY
|
|
891
785
|
})?.pos;
|
|
892
786
|
if (target === void 0) {
|
|
893
|
-
refuse("The drop has no document destination.");
|
|
787
|
+
refuse("The drop has no document destination.", { condition: CANONICAL_CONDITION.invalidRequest });
|
|
894
788
|
return true;
|
|
895
789
|
}
|
|
896
790
|
const captured = clipboardDrag;
|
|
897
791
|
clipboardDrag = { type: "idle" };
|
|
898
792
|
if (moved && (captured.type !== "dragging" || captured.session !== editorSession.session || captured.version !== editorSession.session.version)) {
|
|
899
|
-
refuse("The dragged content changed or has no captured source.");
|
|
793
|
+
refuse("The dragged content changed or has no captured source.", { condition: CANONICAL_CONDITION.stale });
|
|
900
794
|
return true;
|
|
901
795
|
}
|
|
902
796
|
const source = captured.type === "dragging" ? {
|
|
@@ -1096,14 +990,14 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
1096
990
|
selection: commit.selection,
|
|
1097
991
|
unavailable: { type: "refuse" }
|
|
1098
992
|
})) {
|
|
1099
|
-
refuse("The canonical body history selection is unavailable.");
|
|
993
|
+
refuse("The canonical body history selection is unavailable.", { condition: CANONICAL_CONDITION.internal });
|
|
1100
994
|
return false;
|
|
1101
995
|
}
|
|
1102
996
|
}
|
|
1103
997
|
bodyTransaction.setMeta("addToHistory", false);
|
|
1104
998
|
const bodyStaged = Result.try(() => view?.state.applyTransaction(bodyTransaction));
|
|
1105
999
|
if (bodyStaged.isErr() || !bodyStaged.value || !bodyStaged.value.transactions.includes(bodyTransaction) || !bodyStaged.value.state.doc.eq(commit.bodyProjection.doc) || bodyStaged.value.transactions.some((transaction) => transaction !== bodyTransaction && transaction.docChanged)) {
|
|
1106
|
-
refuse("A plugin refused or changed the canonical body projection.");
|
|
1000
|
+
refuse("A plugin refused or changed the canonical body projection.", { condition: CANONICAL_CONDITION.hostTransaction });
|
|
1107
1001
|
return false;
|
|
1108
1002
|
}
|
|
1109
1003
|
const staged = publishCanonicalProjection({
|
|
@@ -1269,25 +1163,30 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
1269
1163
|
canonicalOperations: {
|
|
1270
1164
|
applyCanonicalSectionProperties: (patch) => {
|
|
1271
1165
|
ensureView();
|
|
1272
|
-
const fail = (message) => {
|
|
1273
|
-
refuse(message,
|
|
1166
|
+
const fail = (message, ground) => {
|
|
1167
|
+
refuse(message, ground);
|
|
1274
1168
|
return {
|
|
1275
1169
|
status: "refused",
|
|
1276
|
-
|
|
1170
|
+
ground,
|
|
1277
1171
|
message
|
|
1278
1172
|
};
|
|
1279
1173
|
};
|
|
1280
|
-
if (editorSession.type
|
|
1281
|
-
if (
|
|
1282
|
-
if (!view || deps.getReadOnly() || isDestroying) return fail("The document is not editable.");
|
|
1174
|
+
if (editorSession.type !== "canonical") return fail(editorSession.type === "refused" ? editorSession.reason : "The document is not ready for section changes.", { condition: CANONICAL_CONDITION.notReady });
|
|
1175
|
+
if (!view || deps.getReadOnly() || isDestroying) return fail("The document is not editable.", { condition: CANONICAL_CONDITION.notEditable });
|
|
1283
1176
|
const session = editorSession.session;
|
|
1284
|
-
if (session.isComposing) return fail("Section properties cannot change during composition.");
|
|
1177
|
+
if (session.isComposing) return fail("Section properties cannot change during composition.", { condition: CANONICAL_CONDITION.composing });
|
|
1285
1178
|
const prepared = session.prepareOperations(view.state, [createCanonicalSectionPropertiesOperation(readModel(session.document), patch)]);
|
|
1286
|
-
if (prepared.isErr()) return fail(prepared.error.message);
|
|
1287
|
-
let
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
}
|
|
1179
|
+
if (prepared.isErr()) return fail(prepared.error.message, prepared.error.ground);
|
|
1180
|
+
let failure = {
|
|
1181
|
+
message: "The section projection could not publish.",
|
|
1182
|
+
ground: { condition: CANONICAL_CONDITION.notReady }
|
|
1183
|
+
};
|
|
1184
|
+
if (!publishCommit(prepared.value, (message, ground) => {
|
|
1185
|
+
failure = {
|
|
1186
|
+
message,
|
|
1187
|
+
ground: ground ?? failure.ground
|
|
1188
|
+
};
|
|
1189
|
+
})) return fail(failure.message, failure.ground);
|
|
1291
1190
|
return {
|
|
1292
1191
|
status: "applied",
|
|
1293
1192
|
version: session.version
|
|
@@ -1295,29 +1194,28 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
1295
1194
|
},
|
|
1296
1195
|
applyCanonicalComment: (request) => {
|
|
1297
1196
|
ensureView();
|
|
1298
|
-
const fail = (message, retry = "never") => {
|
|
1299
|
-
if (retry === "never") refuse(message,
|
|
1197
|
+
const fail = (message, ground, retry = "never") => {
|
|
1198
|
+
if (retry === "never") refuse(message, ground);
|
|
1300
1199
|
return {
|
|
1301
1200
|
status: "refused",
|
|
1302
|
-
|
|
1201
|
+
ground,
|
|
1303
1202
|
message,
|
|
1304
1203
|
retry
|
|
1305
1204
|
};
|
|
1306
1205
|
};
|
|
1307
|
-
if (editorSession.type
|
|
1308
|
-
if (
|
|
1309
|
-
if (!view || deps.getReadOnly()) return fail("The document is not editable.");
|
|
1206
|
+
if (editorSession.type !== "canonical") return fail(editorSession.type === "refused" ? editorSession.reason : "The document is not ready for comment changes.", { condition: CANONICAL_CONDITION.notReady });
|
|
1207
|
+
if (!view || deps.getReadOnly()) return fail("The document is not editable.", { condition: CANONICAL_CONDITION.notEditable });
|
|
1310
1208
|
const session = editorSession.session;
|
|
1311
|
-
if (session.isComposing) return fail("Comments cannot change during composition.", "afterComposition");
|
|
1209
|
+
if (session.isComposing) return fail("Comments cannot change during composition.", { condition: CANONICAL_CONDITION.composing }, "afterComposition");
|
|
1312
1210
|
let command;
|
|
1313
1211
|
if (request.type === "create") {
|
|
1314
1212
|
const id = freshCommentId(readModel(session.document), session.idLease);
|
|
1315
|
-
if (id.isErr()) return fail(id.
|
|
1213
|
+
if (id.isErr()) return fail("No comment id is free.", { condition: CANONICAL_CONDITION.idSpace });
|
|
1316
1214
|
let anchor;
|
|
1317
1215
|
switch (request.anchor.kind) {
|
|
1318
1216
|
case "selection": {
|
|
1319
1217
|
const projection = session.projectStory(request.anchor.story);
|
|
1320
|
-
if (projection.isErr()) return fail(projection.error.message);
|
|
1218
|
+
if (projection.isErr()) return fail(projection.error.message, projection.error.ground);
|
|
1321
1219
|
const { doc } = projection.value;
|
|
1322
1220
|
const textEdge = (position, bias) => {
|
|
1323
1221
|
if (position < 0 || position > doc.content.size) return position;
|
|
@@ -1330,8 +1228,8 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
1330
1228
|
const collapsed = request.anchor.from === request.anchor.to;
|
|
1331
1229
|
const from = projection.value.addressAt(collapsed ? request.anchor.from : textEdge(request.anchor.from, 1));
|
|
1332
1230
|
const to = projection.value.addressAt(collapsed ? request.anchor.to : textEdge(request.anchor.to, -1));
|
|
1333
|
-
if (from.isErr()) return fail(from.error.message);
|
|
1334
|
-
if (to.isErr()) return fail(to.error.message);
|
|
1231
|
+
if (from.isErr()) return fail(from.error.message, from.error.ground);
|
|
1232
|
+
if (to.isErr()) return fail(to.error.message, to.error.ground);
|
|
1335
1233
|
anchor = request.anchor.from === request.anchor.to ? {
|
|
1336
1234
|
kind: "point",
|
|
1337
1235
|
at: from.value
|
|
@@ -1374,11 +1272,20 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
1374
1272
|
command,
|
|
1375
1273
|
idLease: session.idLease
|
|
1376
1274
|
});
|
|
1377
|
-
if (compiled.isErr()) return fail(compiled.error.message);
|
|
1275
|
+
if (compiled.isErr()) return fail(compiled.error.message, compiled.error.ground);
|
|
1378
1276
|
if (compiled.value.ops.length > 0) {
|
|
1379
1277
|
const prepared = session.prepareOperations(view.state, compiled.value.ops);
|
|
1380
|
-
if (prepared.isErr()) return fail(prepared.error.message);
|
|
1381
|
-
|
|
1278
|
+
if (prepared.isErr()) return fail(prepared.error.message, prepared.error.ground);
|
|
1279
|
+
let failure = {
|
|
1280
|
+
message: "The comment projection could not publish.",
|
|
1281
|
+
ground: { condition: CANONICAL_CONDITION.notReady }
|
|
1282
|
+
};
|
|
1283
|
+
if (!publishCommit(prepared.value, (message, ground) => {
|
|
1284
|
+
failure = {
|
|
1285
|
+
message,
|
|
1286
|
+
ground: ground ?? failure.ground
|
|
1287
|
+
};
|
|
1288
|
+
})) return fail(failure.message, failure.ground);
|
|
1382
1289
|
}
|
|
1383
1290
|
return {
|
|
1384
1291
|
status: "applied",
|
|
@@ -1460,6 +1367,27 @@ const createHiddenEditorManager = (hostDeps) => {
|
|
|
1460
1367
|
});
|
|
1461
1368
|
if (editorSession.type === "canonical") editorSession.session.recordStorySelection(storyView.state, story);
|
|
1462
1369
|
},
|
|
1370
|
+
applyCanonicalStoryStructure: ({ view: storyView, story, type }) => {
|
|
1371
|
+
if (!view || editorSession.type !== "canonical" || deps.getReadOnly()) return false;
|
|
1372
|
+
syncCanonicalMode();
|
|
1373
|
+
const session = editorSession.session;
|
|
1374
|
+
let prepared;
|
|
1375
|
+
if (type === "deleteTable") {
|
|
1376
|
+
const command = deps.getExtensionManager()?.getCommand("deleteTable")?.();
|
|
1377
|
+
const intents = command === void 0 ? void 0 : getCanonicalCommandIntents(command, storyView.state);
|
|
1378
|
+
if (intents === void 0) {
|
|
1379
|
+
refuse("Deleting the table is unavailable.", { condition: CANONICAL_CONDITION.invalidRequest });
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
prepared = prepareCanonicalCommands(session, storyView.state, intents, story);
|
|
1383
|
+
} else prepared = prepareCanonicalStructure(session, storyView.state, story, type);
|
|
1384
|
+
if (prepared.isErr()) {
|
|
1385
|
+
if (prepared.error.reason !== "noChange") refuse(prepared.error.message, prepared.error.ground);
|
|
1386
|
+
return false;
|
|
1387
|
+
}
|
|
1388
|
+
return publishStoryCommit(storyView, prepared.value);
|
|
1389
|
+
},
|
|
1390
|
+
cutCanonicalStory: ({ view: storyView, story, event }) => cutCanonical(storyView, event, story),
|
|
1463
1391
|
replaceCanonicalStoryText: ({ view: storyView, story, intent }) => {
|
|
1464
1392
|
if (!view || editorSession.type !== "canonical" || deps.getReadOnly()) return false;
|
|
1465
1393
|
syncCanonicalMode();
|
|
@@ -1,88 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ConvertHeaderFooterOptions, HeaderFooterMetrics } from "../layout-bridge/convert/headerFooterLayout.js";
|
|
3
|
-
import "../layout-engine/index.js";
|
|
4
|
-
import { ColumnLayout, FlowBlock, FootnoteContent, HeaderFooterContent, Layout, Measure, PageHeaderFooterRefs, PageMargins } from "../layout-engine/types.js";
|
|
5
|
-
import { BlockLookup, LayoutPainter } from "../layout-painter/index.js";
|
|
6
|
-
import { FootnoteRenderItem } from "../layout-painter/renderPage.js";
|
|
7
|
-
import { DisplayMode } from "../managers/EditorModeManager.js";
|
|
8
|
-
import { LayoutSelectionGate } from "../paged-layout/LayoutSelectionGate.js";
|
|
9
|
-
import { TemplatePreviewEntry, TemplatePreviewHiddenRange } from "../prosemirror/plugins/templatePreviewValues.js";
|
|
10
|
-
import { document_d_exports } from "../types/document.js";
|
|
11
|
-
import { DeepReadonly, ReadonlyDocument } from "../types/documentModel.js";
|
|
12
|
-
import { HyphenationReadiness } from "./hyphenationReadiness.js";
|
|
1
|
+
import { LayoutOutcome, LayoutPipelineDeps } from "./layoutPipelineExecution.js";
|
|
13
2
|
import { LayoutRunOptions } from "./layoutRunOptions.js";
|
|
14
|
-
import { LayoutSession } from "./layoutSession.js";
|
|
15
3
|
import { EditorState } from "prosemirror-state";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
layout?: Layout;
|
|
20
|
-
blockLookup?: BlockLookup;
|
|
21
|
-
};
|
|
22
|
-
export type LayoutPipelineDeps<THfPMs> = {
|
|
23
|
-
contentWidth: number;
|
|
24
|
-
columns: ColumnLayout | undefined;
|
|
25
|
-
pageSize: {
|
|
26
|
-
w: number;
|
|
27
|
-
h: number;
|
|
28
|
-
};
|
|
29
|
-
margins: PageMargins;
|
|
30
|
-
pageGap: number;
|
|
31
|
-
showMarginGuides: boolean;
|
|
32
|
-
marginGuideColor: string | undefined;
|
|
33
|
-
syncCoordinator: LayoutSelectionGate;
|
|
34
|
-
headerContent: document_d_exports.HeaderFooter | null | undefined;
|
|
35
|
-
footerContent: document_d_exports.HeaderFooter | null | undefined;
|
|
36
|
-
firstPageHeaderContent: document_d_exports.HeaderFooter | null | undefined;
|
|
37
|
-
firstPageFooterContent: document_d_exports.HeaderFooter | null | undefined;
|
|
38
|
-
headerContentRId: string | null | undefined;
|
|
39
|
-
footerContentRId: string | null | undefined;
|
|
40
|
-
firstPageHeaderContentRId: string | null | undefined;
|
|
41
|
-
firstPageFooterContentRId: string | null | undefined;
|
|
42
|
-
sectionHeaderFooterRefs: PageHeaderFooterRefs[] | undefined;
|
|
43
|
-
theme: DeepReadonly<document_d_exports.Theme> | null | undefined;
|
|
44
|
-
sectionProperties: document_d_exports.SectionProperties | null | undefined;
|
|
45
|
-
/** The model; the pipeline reads it through `readModel`. */
|
|
46
|
-
document: ReadonlyDocument | null;
|
|
47
|
-
defaultTabStop: number | undefined;
|
|
48
|
-
mirrorMargins: boolean;
|
|
49
|
-
styles: DeepReadonly<document_d_exports.StyleDefinitions> | null | undefined;
|
|
50
|
-
layout: Layout | null;
|
|
51
|
-
hfPMs: THfPMs;
|
|
52
|
-
painter: LayoutPainter | null;
|
|
53
|
-
pagesContainer: HTMLDivElement | null;
|
|
54
|
-
session: LayoutSession;
|
|
55
|
-
renderHfFromContentOrPm: (hf: document_d_exports.HeaderFooter | null | undefined, rId: string | null | undefined, hfPMs: THfPMs, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions) => HeaderFooterContent | undefined;
|
|
56
|
-
renderHeaderFooterContentByRId: (source: Map<string, document_d_exports.HeaderFooter> | undefined, hfPMs: THfPMs, contentWidth: number, metrics: HeaderFooterMetrics, options: ConvertHeaderFooterOptions) => Map<string, HeaderFooterContent> | undefined;
|
|
57
|
-
/** Names the faces measurement can use now (`fontReadiness.readFontSetSignature`). */
|
|
58
|
-
readFontSetSignature: () => string;
|
|
59
|
-
buildFootnoteRenderItems: (pageFootnoteMap: Map<number, number[]>, footnoteContentMap: Map<number, FootnoteContent>, doc: document_d_exports.Document | null) => Map<number, FootnoteRenderItem[]>;
|
|
60
|
-
describeInvalidHighlightMarks: (doc: EditorState["doc"]) => string;
|
|
61
|
-
/**
|
|
62
|
-
* Which renderer paints the pages. `"legacy"` is the painter that has always
|
|
63
|
-
* painted them; `"display-list"` builds the painter-neutral paint IR from
|
|
64
|
-
* this layout and paints the pages from it, so the editor and an export draw
|
|
65
|
-
* from one structure.
|
|
66
|
-
*
|
|
67
|
-
* Only the *painting* is swapped. Page shells, virtualization, the
|
|
68
|
-
* fingerprint comparison that skips an unchanged page and the painted event
|
|
69
|
-
* are page-container concerns and stay shared, because a second copy of them
|
|
70
|
-
* is how incremental repaint would quietly stop working on long documents.
|
|
71
|
-
*/
|
|
72
|
-
pageRenderer?: PageRendererName;
|
|
73
|
-
emptyTemplatePreviewEntries: readonly TemplatePreviewEntry[];
|
|
74
|
-
emptyTemplatePreviewHidden: readonly TemplatePreviewHiddenRange[];
|
|
75
|
-
/** Follows up on the hyphenation dictionaries a run lacked (relayout or error). */
|
|
76
|
-
hyphenationReadiness: HyphenationReadiness;
|
|
77
|
-
/**
|
|
78
|
-
* The review view the body is laid out for. A view other than All Markup
|
|
79
|
-
* lays out the text it shows (every revision accepted or rejected), not the
|
|
80
|
-
* authored text with runs hidden afterwards.
|
|
81
|
-
*/
|
|
82
|
-
markupView: DisplayMode;
|
|
83
|
-
/** Independent highlight visibility in All Markup; resolved views always hide comments. */
|
|
84
|
-
showCommentHighlights?: boolean;
|
|
85
|
-
/** Localised text for a `w:altChunk` that has no text of its own to show. */
|
|
86
|
-
altChunkMarkerText?: string;
|
|
87
|
-
};
|
|
88
|
-
export declare function runLayoutPipeline<THfPMs>(deps: LayoutPipelineDeps<THfPMs>, state: EditorState, options?: LayoutRunOptions): LayoutOutcome;
|
|
4
|
+
/** Run a synchronous layout pass for consumers of the core pipeline. */
|
|
5
|
+
export declare function runLayoutPipeline<THfPMs>(deps: LayoutPipelineDeps<THfPMs>, state: EditorState, options?: LayoutRunOptions): LayoutOutcome;
|
|
6
|
+
export type { LayoutOutcome, LayoutPipelineDeps };
|