@stll/folio-core 0.36.0 → 0.37.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 +59 -1
- package/dist/ai-edits/apply.js +545 -296
- package/dist/ai-edits/block-identity.d.ts +4 -1
- package/dist/ai-edits/block-identity.js +4 -1
- package/dist/ai-edits/blockRange.js +14 -14
- package/dist/ai-edits/clean-text.d.ts +40 -1
- package/dist/ai-edits/clean-text.js +52 -2
- package/dist/ai-edits/headless.d.ts +3 -1
- package/dist/ai-edits/headless.js +133 -71
- package/dist/ai-edits/index.d.ts +3 -3
- package/dist/ai-edits/index.js +2 -2
- package/dist/ai-edits/read.js +38 -20
- package/dist/ai-edits/snapshot.d.ts +14 -6
- package/dist/ai-edits/snapshot.js +99 -19
- package/dist/ai-edits/table-cell-mutations.js +1 -1
- package/dist/ai-edits/table-row-column-mutations.js +7 -0
- package/dist/ai-edits/table-template.d.ts +11 -1
- package/dist/ai-edits/table-template.js +49 -17
- package/dist/ai-edits/types.d.ts +45 -57
- package/dist/ai-suggestions/conflict.js +1 -4
- package/dist/ai-suggestions/text-positions.d.ts +8 -0
- package/dist/ai-suggestions/text-positions.js +27 -5
- package/dist/compare/__fixtures__/body-sequence.js +3 -4
- package/dist/compare/column-alignment.d.ts +13 -13
- package/dist/compare/column-alignment.js +78 -39
- package/dist/compare/compare.d.ts +4 -3
- package/dist/compare/compare.js +41 -5
- package/dist/compare/content-alignment.d.ts +95 -0
- package/dist/compare/content-alignment.js +1450 -0
- package/dist/compare/content-types.d.ts +100 -0
- package/dist/compare/content-types.js +0 -0
- package/dist/compare/content.d.ts +209 -0
- package/dist/compare/content.js +885 -0
- package/dist/compare/formatting.d.ts +5 -5
- package/dist/compare/formatting.js +6 -4
- package/dist/compare/plan.d.ts +6 -1
- package/dist/compare/plan.js +169 -567
- package/dist/compare/scenario.d.ts +2 -2
- package/dist/compare/types.d.ts +3 -3
- package/dist/compare/verification.d.ts +2 -2
- package/dist/compare/verification.js +25 -8
- package/dist/compat/eigenpal.d.ts +5 -3
- package/dist/compat/eigenpal.js +3 -2
- package/dist/controller/headerFooterEditorManager.js +14 -6
- package/dist/controller/hiddenEditorManager.d.ts +7 -2
- package/dist/controller/hiddenEditorManager.js +15 -6
- package/dist/controller/layoutPipeline.js +5 -3
- package/dist/controller/noteEditorManager.js +12 -7
- package/dist/display-list/build/headerFooterPrimitives.js +1 -0
- package/dist/display-list/build/storyPrimitives.d.ts +5 -2
- package/dist/display-list/build/storyPrimitives.js +60 -3
- package/dist/display-list/build/tablePrimitives.js +30 -0
- package/dist/display-list/primitives.d.ts +1 -1
- package/dist/document-operations.d.ts +6 -4
- package/dist/document-operations.js +77 -12
- package/dist/docx/blockContentParser.js +6 -27
- package/dist/docx/ensureParaIds.js +9 -4
- package/dist/docx/numberingParser.d.ts +3 -1
- package/dist/docx/numberingParser.js +4 -1
- package/dist/docx/paragraphParser.js +7 -6
- package/dist/docx/paragraphTraversal.js +30 -34
- package/dist/docx/rezip.d.ts +0 -8
- package/dist/docx/rezip.js +41 -16
- package/dist/docx/runParser.js +4 -2
- package/dist/docx/serializer/paragraphSerializer.js +2 -0
- package/dist/docx/serializer/runSerializer.js +5 -3
- package/dist/docx/serializer/trackedChangeAttributes.d.ts +3 -1
- package/dist/docx/serializer/trackedChangeAttributes.js +11 -1
- package/dist/docx/server/build.d.ts +1 -1
- package/dist/headless-layout.js +5 -4
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -2
- package/dist/internal/headlessRevisionResolution.d.ts +23 -0
- package/dist/internal/headlessRevisionResolution.js +155 -0
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +12 -0
- package/dist/internal/headlessRevisionResolutionGuard.js +28 -0
- package/dist/internal/pageBreakRunDescendantIndex.d.ts +9 -0
- package/dist/internal/pageBreakRunDescendantIndex.js +27 -0
- package/dist/internal/pageBreakRunPartition.d.ts +26 -0
- package/dist/internal/pageBreakRunPartition.js +35 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.d.ts +15 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +126 -0
- package/dist/internal/sectionEndpointResolution.d.ts +32 -0
- package/dist/internal/sectionEndpointResolution.js +38 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +16 -4
- package/dist/layout-bridge/convert/headerFooterLayout.js +48 -5
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +4 -0
- package/dist/layout-bridge/convert/toFlowBlocks.js +379 -75
- package/dist/layout-bridge/dom/clickToPositionDom.d.ts +8 -1
- package/dist/layout-bridge/dom/clickToPositionDom.js +114 -40
- package/dist/layout-bridge/dom/textStreamDom.d.ts +24 -0
- package/dist/layout-bridge/dom/textStreamDom.js +75 -0
- package/dist/layout-bridge/headerFooterLayout.js +16 -30
- package/dist/layout-engine/index.js +12 -3
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.d.ts +17 -0
- package/dist/layout-engine/measure/tableFragmentBorderGeometry.js +24 -0
- package/dist/layout-engine/renderedBreakReconciliation.js +1 -1
- package/dist/layout-engine/types.d.ts +7 -0
- package/dist/layout-painter/imageLayout.d.ts +1 -1
- package/dist/layout-painter/renderTable.js +20 -0
- package/dist/model.d.ts +1 -1
- package/dist/paged-layout/rangeProjection.js +6 -9
- package/dist/paged-layout/transactionDirtyRange.d.ts +3 -1
- package/dist/paged-layout/transactionDirtyRange.js +23 -1
- package/dist/prosemirror/attrs/index.d.ts +7 -3
- package/dist/prosemirror/attrs/index.js +113 -7
- package/dist/prosemirror/bookmarkBoundaryIntegrity.d.ts +9 -0
- package/dist/prosemirror/bookmarkBoundaryIntegrity.js +22 -0
- package/dist/prosemirror/commands/comments.d.ts +10 -1
- package/dist/prosemirror/commands/comments.js +190 -59
- package/dist/prosemirror/commands/formatPainter.d.ts +45 -10
- package/dist/prosemirror/commands/formatPainter.js +319 -63
- package/dist/prosemirror/commands/index.d.ts +2 -2
- package/dist/prosemirror/commands/pageBreak.d.ts +5 -2
- package/dist/prosemirror/commands/pageBreak.js +18 -36
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +7 -5
- package/dist/prosemirror/commands/propertyChangeScope.js +27 -18
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +7 -2
- package/dist/prosemirror/conversion/fromProseDoc.js +809 -209
- package/dist/prosemirror/conversion/runShadingMark.js +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +26 -1
- package/dist/prosemirror/conversion/toProseDoc.js +416 -283
- package/dist/prosemirror/extensions/StarterKit.js +4 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +12 -8
- package/dist/prosemirror/extensions/features/ListExtension.js +95 -123
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +27 -1
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +134 -30
- package/dist/prosemirror/extensions/features/pasteCleanup.js +9 -15
- package/dist/prosemirror/extensions/marks/BoldExtension.js +4 -3
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.d.ts +4 -7
- package/dist/prosemirror/extensions/marks/CharacterStyleExtension.js +5 -11
- package/dist/prosemirror/extensions/marks/FontSizeExtension.js +3 -3
- package/dist/prosemirror/extensions/marks/ItalicExtension.js +4 -3
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.d.ts +13 -0
- package/dist/prosemirror/extensions/marks/PageBreakRunOwnerExtension.js +39 -0
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.d.ts +7 -1
- package/dist/prosemirror/extensions/marks/RunFormattingOverrideExtension.js +67 -21
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +8 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +88 -2
- package/dist/prosemirror/extensions/nodes/BookmarkBoundaryExtension.js +44 -3
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +1 -1
- package/dist/prosemirror/extensions/nodes/HardBreakExtension.js +15 -4
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/nodes/PageBreakExtension.js +6 -0
- package/dist/prosemirror/extensions/nodes/PageBreakRunExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/nodes/PageBreakRunExtension.js +36 -0
- package/dist/prosemirror/findReplaceSelection.js +8 -3
- package/dist/prosemirror/index.d.ts +3 -3
- package/dist/prosemirror/listMarker.d.ts +26 -1
- package/dist/prosemirror/listMarker.js +108 -14
- package/dist/prosemirror/pageBreakRunProjection.d.ts +28 -0
- package/dist/prosemirror/pageBreakRunProjection.js +47 -0
- package/dist/prosemirror/paraText.js +6 -0
- package/dist/prosemirror/paragraphSpacing.d.ts +29 -0
- package/dist/prosemirror/paragraphSpacing.js +125 -0
- package/dist/prosemirror/plugins/documentNumbering.d.ts +8 -0
- package/dist/prosemirror/plugins/documentNumbering.js +18 -0
- package/dist/prosemirror/plugins/pmTextScan.d.ts +3 -2
- package/dist/prosemirror/plugins/pmTextScan.js +14 -4
- package/dist/prosemirror/plugins/suggestionMode.js +8 -10
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +16 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +61 -0
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +64 -0
- package/dist/prosemirror/runFormattingInlineCarriers.js +121 -0
- package/dist/prosemirror/runFormattingProvenance.d.ts +12 -0
- package/dist/prosemirror/runFormattingProvenance.js +48 -0
- package/dist/prosemirror/runFormattingReconciliation.d.ts +25 -0
- package/dist/prosemirror/runFormattingReconciliation.js +54 -0
- package/dist/prosemirror/runPropertyChangeResolution.d.ts +18 -0
- package/dist/prosemirror/runPropertyChangeResolution.js +18 -0
- package/dist/prosemirror/runStyleFormatting.d.ts +50 -0
- package/dist/prosemirror/runStyleFormatting.js +105 -0
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/marks.d.ts +82 -9
- package/dist/prosemirror/schema/marks.js +73 -1
- package/dist/prosemirror/schema/nodes.d.ts +18 -5
- package/dist/prosemirror/styles/resolvedStyleAttrs.d.ts +14 -2
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +44 -23
- package/dist/prosemirror/styles/styleResolver.d.ts +10 -13
- package/dist/prosemirror/styles/styleResolver.js +3 -3
- package/dist/prosemirror/styles/styleToggleCascade.d.ts +8 -1
- package/dist/prosemirror/styles/styleToggleCascade.js +24 -1
- package/dist/prosemirror/tableGridMutation.d.ts +20 -0
- package/dist/prosemirror/tableGridMutation.js +30 -0
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +31 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +39 -0
- package/dist/prosemirror/utils/visualLineNavigation.js +27 -31
- package/dist/prosemirror/validation.js +23 -4
- package/dist/render-dom/HeaderFooterSelectionOverlay.js +20 -20
- package/dist/render-dom/RenderedDomContext.js +17 -34
- package/dist/server.d.ts +4 -4
- package/dist/server.js +2 -2
- package/dist/style-engine/styleEngine.d.ts +1 -1
- package/dist/utils/clipboard.js +1 -1
- package/dist/utils/findReplace.js +38 -21
- package/dist/version-comparison.d.ts +38 -44
- package/dist/version-comparison.js +270 -401
- package/package.json +3 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mergeDirtyRanges } from "./incrementalMeasure.js";
|
|
1
2
|
import { AddMarkStep, RemoveMarkStep } from "prosemirror-transform";
|
|
2
3
|
//#region src/paged-layout/transactionDirtyRange.ts
|
|
3
4
|
function getTransactionDirtyRange(transaction) {
|
|
@@ -9,6 +10,27 @@ function getTransactionDirtyRange(transaction) {
|
|
|
9
10
|
if (!Number.isFinite(dirtyRange.from) || !Number.isFinite(dirtyRange.to)) return null;
|
|
10
11
|
return dirtyRange;
|
|
11
12
|
}
|
|
13
|
+
/** Collect every transaction in an applied batch in the final document's coordinates. */
|
|
14
|
+
function getTransactionsDirtyRange(transactions) {
|
|
15
|
+
let combinedRange = null;
|
|
16
|
+
for (let index = 0; index < transactions.length; index += 1) {
|
|
17
|
+
const transaction = transactions[index];
|
|
18
|
+
if (!transaction) continue;
|
|
19
|
+
const range = getTransactionDirtyRange(transaction);
|
|
20
|
+
if (!range) continue;
|
|
21
|
+
let from = range.from;
|
|
22
|
+
let to = range.to;
|
|
23
|
+
for (const followingTransaction of transactions.slice(index + 1)) {
|
|
24
|
+
from = followingTransaction.mapping.map(from, -1);
|
|
25
|
+
to = followingTransaction.mapping.map(to, 1);
|
|
26
|
+
}
|
|
27
|
+
combinedRange = mergeDirtyRanges(combinedRange, {
|
|
28
|
+
from,
|
|
29
|
+
to
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return combinedRange;
|
|
33
|
+
}
|
|
12
34
|
function includeStepDirtyRange(transaction, stepIndex, dirtyRange) {
|
|
13
35
|
const map = transaction.mapping.maps[stepIndex];
|
|
14
36
|
if (!map) return;
|
|
@@ -24,4 +46,4 @@ function includeStepDirtyRange(transaction, stepIndex, dirtyRange) {
|
|
|
24
46
|
if (step instanceof AddMarkStep || step instanceof RemoveMarkStep) extend(step.from, step.to);
|
|
25
47
|
}
|
|
26
48
|
//#endregion
|
|
27
|
-
export { getTransactionDirtyRange };
|
|
49
|
+
export { getTransactionDirtyRange, getTransactionsDirtyRange };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
|
|
2
|
-
import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, MathAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, SymbolAttrs, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "../schema/nodes.js";
|
|
1
|
+
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "../schema/marks.js";
|
|
2
|
+
import { BlockSdtAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, MathAttrs, PageBreakRunAttrs, ParagraphAttrs, SdtAttrs, ShapeAttrs, SymbolAttrs, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "../schema/nodes.js";
|
|
3
3
|
import "../schema/index.js";
|
|
4
4
|
import { Mark, Node } from "prosemirror-model";
|
|
5
5
|
//#region src/prosemirror/attrs/index.d.ts
|
|
@@ -18,6 +18,8 @@ declare const readParagraphAttrs: (node: Node) => ReadProseMirrorAttrsResult<Par
|
|
|
18
18
|
declare const expectParagraphAttrs: (node: Node) => ParagraphAttrs;
|
|
19
19
|
declare const readHardBreakAttrs: (node: Node) => ReadProseMirrorAttrsResult<HardBreakAttrs>;
|
|
20
20
|
declare const expectHardBreakAttrs: (node: Node) => HardBreakAttrs;
|
|
21
|
+
declare const readPageBreakRunAttrs: (node: Node) => ReadProseMirrorAttrsResult<PageBreakRunAttrs>;
|
|
22
|
+
declare const expectPageBreakRunAttrs: (node: Node) => PageBreakRunAttrs;
|
|
21
23
|
declare const readTabAttrs: (node: Node) => ReadProseMirrorAttrsResult<TabAttrs>;
|
|
22
24
|
declare const expectTabAttrs: (node: Node) => TabAttrs;
|
|
23
25
|
declare const readSymbolAttrs: (node: Node) => ReadProseMirrorAttrsResult<SymbolAttrs>;
|
|
@@ -74,6 +76,8 @@ declare const readTrackedChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsRe
|
|
|
74
76
|
declare const expectTrackedChangeMarkAttrs: (mark: Mark) => TrackedChangeMarkAttrs;
|
|
75
77
|
declare const readRunPropertyChangeMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunPropertyChangeMarkAttrs>;
|
|
76
78
|
declare const expectRunPropertyChangeMarkAttrs: (mark: Mark) => RunPropertyChangeMarkAttrs;
|
|
79
|
+
declare const readPageBreakRunOwnerMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<PageBreakRunOwnerMarkAttrs>;
|
|
80
|
+
declare const expectPageBreakRunOwnerMarkAttrs: (mark: Mark) => PageBreakRunOwnerMarkAttrs;
|
|
77
81
|
declare const readRunFormattingOverrideMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<RunFormattingOverrideAttrs>;
|
|
78
82
|
declare const expectRunFormattingOverrideMarkAttrs: (mark: Mark) => RunFormattingOverrideAttrs;
|
|
79
83
|
declare const readHyperlinkMarkAttrs: (mark: Mark) => ReadProseMirrorAttrsResult<HyperlinkAttrs>;
|
|
@@ -85,4 +89,4 @@ declare const mergeTableAttrs: (node: Node, patch: NodeAttrPatch<TableAttrs>) =>
|
|
|
85
89
|
declare const mergeTableRowAttrs: (node: Node, patch: NodeAttrPatch<TableRowAttrs>) => TableRowAttrs;
|
|
86
90
|
declare const mergeTableCellAttrs: (node: Node, patch: NodeAttrPatch<TableCellAttrs>) => TableCellAttrs;
|
|
87
91
|
//#endregion
|
|
88
|
-
export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectSymbolAttrs, expectTabAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
92
|
+
export { ProseMirrorAttrIssue, ReadProseMirrorAttrsResult, expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectPageBreakRunAttrs, expectPageBreakRunOwnerMarkAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectSymbolAttrs, expectTabAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readPageBreakRunOwnerMarkAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EMPHASIS_MARK_VALUES, FIELD_TYPE_VALUES, FONT_HINT_VALUES, FONT_THEME_VALUES, HIGHLIGHT_COLOR_VALUES, IMAGE_HORIZONTAL_ALIGNMENT_VALUES, IMAGE_HORIZONTAL_RELATIVE_TO_VALUES, IMAGE_VERTICAL_ALIGNMENT_VALUES, IMAGE_VERTICAL_RELATIVE_TO_VALUES, IMAGE_WRAP_TEXT_VALUES, IMAGE_WRAP_TYPE_VALUES, LINE_SPACING_RULE_VALUES, NUMBER_FORMAT_VALUES, OUTLINE_STYLE_ATTR_VALUES, PARAGRAPH_ALIGNMENT_VALUES, POSITIONAL_TAB_ALIGNMENT_VALUES, POSITIONAL_TAB_LEADER_VALUES, POSITIONAL_TAB_RELATIVE_TO_VALUES, SDT_LOCK_VALUES, SDT_TYPE_VALUES, SHADING_PATTERN_VALUES, TABLE_CELL_TEXT_DIRECTION_VALUES, TABLE_CELL_VERTICAL_ALIGNMENT_VALUES, TABLE_JUSTIFICATION_VALUES, TABLE_ROW_HEIGHT_RULE_VALUES, TABLE_WIDTH_TYPE_VALUES, TAB_LEADER_VALUES, TAB_STOP_ALIGNMENT_VALUES, TEXT_EFFECT_VALUES, THEME_COLOR_SLOT_VALUES, UNDERLINE_STYLE_VALUES } from "../../types/documentEnumValues.js";
|
|
2
2
|
import { normalizeHorizontalScalePercent } from "../../utils/horizontalScale.js";
|
|
3
3
|
import { isParagraphDirection } from "../paragraphDirection.js";
|
|
4
|
-
import { TRACKED_CHANGE_PROVENANCE_VALUES } from "../schema/marks.js";
|
|
4
|
+
import { COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_VALUE_PROPERTIES, TRACKED_CHANGE_PROVENANCE_VALUES } from "../schema/marks.js";
|
|
5
5
|
import { panic } from "better-result";
|
|
6
6
|
import { DRAWING_RAW_XML_MODES, isOoxmlSymbolCharacter } from "@stll/docx-core/model";
|
|
7
7
|
//#region src/prosemirror/attrs/index.ts
|
|
@@ -77,7 +77,13 @@ const TEXT_BOX_TRACKED_CHANGE_TYPES = [
|
|
|
77
77
|
"moveFrom",
|
|
78
78
|
"moveTo"
|
|
79
79
|
];
|
|
80
|
-
const HARD_BREAK_TYPES = ["column"];
|
|
80
|
+
const HARD_BREAK_TYPES = ["column", "textWrapping"];
|
|
81
|
+
const PAGE_BREAK_CLEAR_VALUES = [
|
|
82
|
+
"none",
|
|
83
|
+
"left",
|
|
84
|
+
"right",
|
|
85
|
+
"all"
|
|
86
|
+
];
|
|
81
87
|
const RUN_FORMATTING_OVERRIDE_BOOLEAN_KEYS = [
|
|
82
88
|
"bold",
|
|
83
89
|
"italic",
|
|
@@ -91,6 +97,20 @@ const RUN_FORMATTING_OVERRIDE_BOOLEAN_KEYS = [
|
|
|
91
97
|
"outline"
|
|
92
98
|
];
|
|
93
99
|
const RUN_FORMATTING_OVERRIDE_FALSE_KEYS = ["doubleStrike", "rtl"];
|
|
100
|
+
const RUN_FORMATTING_OVERRIDE_STRING_SENTINELS = {
|
|
101
|
+
color: ["auto"],
|
|
102
|
+
effect: ["none"],
|
|
103
|
+
emphasisMark: ["none"],
|
|
104
|
+
highlight: ["none"],
|
|
105
|
+
underline: ["none"],
|
|
106
|
+
vertAlign: ["baseline"]
|
|
107
|
+
};
|
|
108
|
+
const RUN_FORMATTING_OVERRIDE_NUMBER_SENTINELS = {
|
|
109
|
+
kerning: 0,
|
|
110
|
+
position: 0,
|
|
111
|
+
scale: 100,
|
|
112
|
+
spacing: 0
|
|
113
|
+
};
|
|
94
114
|
const RUN_FORMATTING_OVERRIDE_DIRECT_FONT_PROPERTIES = [
|
|
95
115
|
"fontFamily",
|
|
96
116
|
"fontSize",
|
|
@@ -112,6 +132,7 @@ const SECTION_VERTICAL_ALIGNMENTS = [
|
|
|
112
132
|
];
|
|
113
133
|
const paragraphAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
114
134
|
const hardBreakAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
135
|
+
const pageBreakRunAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
115
136
|
const tabAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
116
137
|
const symbolAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
117
138
|
const tableAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -139,6 +160,7 @@ const footnoteRefAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
|
139
160
|
const commentAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
140
161
|
const trackedChangeAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
141
162
|
const runPropertyChangeAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
163
|
+
const pageBreakRunOwnerAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
142
164
|
const runFormattingOverrideAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
143
165
|
const hyperlinkAttrsCache = /* @__PURE__ */ new WeakMap();
|
|
144
166
|
const readParagraphAttrs = (node) => {
|
|
@@ -158,7 +180,7 @@ const readParagraphAttrs = (node) => {
|
|
|
158
180
|
optionalNumber(attrs, "spaceBefore", "paragraph.attrs.spaceBefore", issues);
|
|
159
181
|
optionalNumber(attrs, "spaceAfter", "paragraph.attrs.spaceAfter", issues);
|
|
160
182
|
optionalNumber(attrs, "lineSpacing", "paragraph.attrs.lineSpacing", issues);
|
|
161
|
-
|
|
183
|
+
optionalLineSpacingProvenance(attrs, "lineSpacingExplicit", "paragraph.attrs.lineSpacingExplicit", issues);
|
|
162
184
|
optionalBoolean(attrs, "snapToGrid", "paragraph.attrs.snapToGrid", issues);
|
|
163
185
|
optionalOneOf(attrs, "lineSpacingRule", "paragraph.attrs.lineSpacingRule", issues, LINE_SPACING_RULE_VALUES);
|
|
164
186
|
optionalNumber(attrs, "indentLeft", "paragraph.attrs.indentLeft", issues);
|
|
@@ -170,6 +192,7 @@ const readParagraphAttrs = (node) => {
|
|
|
170
192
|
optionalBoolean(attrs, "listIsBullet", "paragraph.attrs.listIsBullet", issues);
|
|
171
193
|
optionalBoolean(attrs, "listIsLegal", "paragraph.attrs.listIsLegal", issues);
|
|
172
194
|
optionalString(attrs, "listMarker", "paragraph.attrs.listMarker", issues);
|
|
195
|
+
optionalString(attrs, "listMarkerTemplate", "paragraph.attrs.listMarkerTemplate", issues);
|
|
173
196
|
optionalBoolean(attrs, "listMarkerHidden", "paragraph.attrs.listMarkerHidden", issues);
|
|
174
197
|
optionalTextFormatting(attrs, "listMarkerFormatting", "paragraph.attrs.listMarkerFormatting", issues);
|
|
175
198
|
optionalOneOf(attrs, "listMarkerAlignment", "paragraph.attrs.listMarkerAlignment", issues, [
|
|
@@ -229,9 +252,18 @@ const readHardBreakAttrs = (node) => {
|
|
|
229
252
|
const issues = [];
|
|
230
253
|
expectNodeType(node, "hardBreak", issues);
|
|
231
254
|
optionalOneOf(attrs, "breakType", "hardBreak.attrs.breakType", issues, HARD_BREAK_TYPES);
|
|
255
|
+
optionalOneOf(attrs, "clear", "hardBreak.attrs.clear", issues, PAGE_BREAK_CLEAR_VALUES);
|
|
232
256
|
return attrsResult(attrs, issues);
|
|
233
257
|
};
|
|
234
258
|
const expectHardBreakAttrs = (node) => expectCachedNodeAttrs(node, hardBreakAttrsCache, readHardBreakAttrs, "hard break attrs");
|
|
259
|
+
const readPageBreakRunAttrs = (node) => {
|
|
260
|
+
const attrs = attrsRecord(node.attrs);
|
|
261
|
+
const issues = [];
|
|
262
|
+
expectNodeType(node, "pageBreakRun", issues);
|
|
263
|
+
optionalOneOf(attrs, "clear", "pageBreakRun.attrs.clear", issues, PAGE_BREAK_CLEAR_VALUES);
|
|
264
|
+
return attrsResult(attrs, issues);
|
|
265
|
+
};
|
|
266
|
+
const expectPageBreakRunAttrs = (node) => expectCachedNodeAttrs(node, pageBreakRunAttrsCache, readPageBreakRunAttrs, "page break run attrs");
|
|
235
267
|
const readTabAttrs = (node) => {
|
|
236
268
|
const attrs = attrsRecord(node.attrs);
|
|
237
269
|
const issues = [];
|
|
@@ -558,7 +590,6 @@ const readCharacterStyleMarkAttrs = (mark) => {
|
|
|
558
590
|
const issues = [];
|
|
559
591
|
expectMarkType(mark, "characterStyle", issues);
|
|
560
592
|
requiredString(attrs, "styleId", "characterStyle.attrs.styleId", issues);
|
|
561
|
-
optionalRecord(attrs, "_styleRPr", "characterStyle.attrs._styleRPr", issues);
|
|
562
593
|
return attrsResult(attrs, issues);
|
|
563
594
|
};
|
|
564
595
|
const expectCharacterStyleMarkAttrs = (mark) => expectCachedMarkAttrs(mark, characterStyleAttrsCache, readCharacterStyleMarkAttrs, "character style attrs");
|
|
@@ -674,6 +705,18 @@ const readRunPropertyChangeMarkAttrs = (mark) => {
|
|
|
674
705
|
return attrsResult(attrs, issues);
|
|
675
706
|
};
|
|
676
707
|
const expectRunPropertyChangeMarkAttrs = (mark) => expectCachedMarkAttrs(mark, runPropertyChangeAttrsCache, readRunPropertyChangeMarkAttrs, "run property change attrs");
|
|
708
|
+
const readPageBreakRunOwnerMarkAttrs = (mark) => {
|
|
709
|
+
const attrs = attrsRecord(mark.attrs);
|
|
710
|
+
const issues = [];
|
|
711
|
+
expectMarkType(mark, "pageBreakRunOwner", issues);
|
|
712
|
+
const id = attrs["id"];
|
|
713
|
+
if (typeof id !== "number" || !Number.isSafeInteger(id) || id < 0) issues.push({
|
|
714
|
+
path: "pageBreakRunOwner.attrs.id",
|
|
715
|
+
message: "Expected a non-negative safe integer."
|
|
716
|
+
});
|
|
717
|
+
return attrsResult(attrs, issues);
|
|
718
|
+
};
|
|
719
|
+
const expectPageBreakRunOwnerMarkAttrs = (mark) => expectCachedMarkAttrs(mark, pageBreakRunOwnerAttrsCache, readPageBreakRunOwnerMarkAttrs, "page break run owner attrs");
|
|
677
720
|
const readRunFormattingOverrideMarkAttrs = (mark) => {
|
|
678
721
|
const attrs = attrsRecord(mark.attrs);
|
|
679
722
|
const issues = [];
|
|
@@ -684,13 +727,65 @@ const readRunFormattingOverrideMarkAttrs = (mark) => {
|
|
|
684
727
|
optionalBoolean(attrs, "italicCs", "runFormattingOverride.attrs.italicCs", issues);
|
|
685
728
|
optionalNumber(attrs, "fontSizeCs", "runFormattingOverride.attrs.fontSizeCs", issues);
|
|
686
729
|
optionalBoolean(attrs, "cs", "runFormattingOverride.attrs.cs", issues);
|
|
687
|
-
|
|
730
|
+
optionalShading(attrs, "shading", "runFormattingOverride.attrs.shading", issues);
|
|
731
|
+
const shading = attrs["shading"];
|
|
732
|
+
if (isRecord(shading) && shading["pattern"] !== "nil") issues.push({
|
|
733
|
+
path: "runFormattingOverride.attrs.shading.pattern",
|
|
734
|
+
message: "Expected \"nil\"."
|
|
735
|
+
});
|
|
736
|
+
for (const [key, values] of Object.entries(RUN_FORMATTING_OVERRIDE_STRING_SENTINELS)) optionalOneOf(attrs, key, `runFormattingOverride.attrs.${key}`, issues, values);
|
|
737
|
+
for (const [key, expected] of Object.entries(RUN_FORMATTING_OVERRIDE_NUMBER_SENTINELS)) {
|
|
738
|
+
const value = attrs[key];
|
|
739
|
+
if (value !== void 0 && value !== null && value !== expected) issues.push({
|
|
740
|
+
path: `runFormattingOverride.attrs.${key}`,
|
|
741
|
+
message: `Expected ${expected}.`
|
|
742
|
+
});
|
|
743
|
+
}
|
|
688
744
|
optionalOneOfArray(attrs, "directFontProperties", "runFormattingOverride.attrs.directFontProperties", issues, RUN_FORMATTING_OVERRIDE_DIRECT_FONT_PROPERTIES);
|
|
745
|
+
optionalOneOfArray(attrs, "complexScriptPropertyAbsences", "runFormattingOverride.attrs.complexScriptPropertyAbsences", issues, COMPLEX_SCRIPT_RUN_PROPERTY_KEYS);
|
|
746
|
+
optionalOneOfArray(attrs, "_authoredOn", "runFormattingOverride.attrs._authoredOn", issues, RUN_FORMATTING_BOOLEAN_PROPERTIES);
|
|
747
|
+
optionalOneOfArray(attrs, "_authoredOff", "runFormattingOverride.attrs._authoredOff", issues, RUN_FORMATTING_BOOLEAN_PROPERTIES);
|
|
748
|
+
optionalTextFormatting(attrs, "_authoredValues", "runFormattingOverride.attrs._authoredValues", issues);
|
|
749
|
+
const authoredValues = attrs["_authoredValues"];
|
|
750
|
+
if (isRecord(authoredValues)) {
|
|
751
|
+
const allowed = new Set(RUN_FORMATTING_VALUE_PROPERTIES);
|
|
752
|
+
for (const property of Object.keys(authoredValues)) if (!allowed.has(property)) issues.push({
|
|
753
|
+
path: `runFormattingOverride.attrs._authoredValues.${property}`,
|
|
754
|
+
message: "Expected a non-boolean authored formatting property."
|
|
755
|
+
});
|
|
756
|
+
}
|
|
689
757
|
const directFontProperties = attrs["directFontProperties"];
|
|
690
758
|
if (Array.isArray(directFontProperties) && new Set(directFontProperties).size !== directFontProperties.length) issues.push({
|
|
691
759
|
path: "runFormattingOverride.attrs.directFontProperties",
|
|
692
760
|
message: "Expected unique direct font properties."
|
|
693
761
|
});
|
|
762
|
+
const complexScriptPropertyAbsences = attrs["complexScriptPropertyAbsences"];
|
|
763
|
+
if (Array.isArray(complexScriptPropertyAbsences) && new Set(complexScriptPropertyAbsences).size !== complexScriptPropertyAbsences.length) issues.push({
|
|
764
|
+
path: "runFormattingOverride.attrs.complexScriptPropertyAbsences",
|
|
765
|
+
message: "Expected unique complex-script property absences."
|
|
766
|
+
});
|
|
767
|
+
if (Array.isArray(complexScriptPropertyAbsences)) {
|
|
768
|
+
for (const property of complexScriptPropertyAbsences) if (attrs[property] !== void 0 && attrs[property] !== null) issues.push({
|
|
769
|
+
path: `runFormattingOverride.attrs.${property}`,
|
|
770
|
+
message: "Expected a property to be either present or explicitly absent, not both."
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
for (const provenanceKey of ["_authoredOn", "_authoredOff"]) {
|
|
774
|
+
const properties = attrs[provenanceKey];
|
|
775
|
+
if (Array.isArray(properties) && new Set(properties).size !== properties.length) issues.push({
|
|
776
|
+
path: `runFormattingOverride.attrs.${provenanceKey}`,
|
|
777
|
+
message: "Expected unique authored formatting properties."
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
const authoredOn = attrs["_authoredOn"];
|
|
781
|
+
const authoredOff = attrs["_authoredOff"];
|
|
782
|
+
if (Array.isArray(authoredOn) && Array.isArray(authoredOff)) {
|
|
783
|
+
const off = new Set(authoredOff);
|
|
784
|
+
for (const property of authoredOn) if (off.has(property)) issues.push({
|
|
785
|
+
path: "runFormattingOverride.attrs._authoredOff",
|
|
786
|
+
message: "Expected authored formatting to be either on or off, not both."
|
|
787
|
+
});
|
|
788
|
+
}
|
|
694
789
|
return attrsResult(attrs, issues);
|
|
695
790
|
};
|
|
696
791
|
const expectRunFormattingOverrideMarkAttrs = (mark) => expectCachedMarkAttrs(mark, runFormattingOverrideAttrsCache, readRunFormattingOverrideMarkAttrs, "run formatting override attrs");
|
|
@@ -920,6 +1015,16 @@ const optionalOneOf = (attrs, key, path, issues, allowed) => {
|
|
|
920
1015
|
message: `Expected one of ${allowed.join(", ")}.`
|
|
921
1016
|
});
|
|
922
1017
|
};
|
|
1018
|
+
const LINE_SPACING_PROVENANCE_VALUES = [
|
|
1019
|
+
"value",
|
|
1020
|
+
"rule",
|
|
1021
|
+
"both"
|
|
1022
|
+
];
|
|
1023
|
+
const optionalLineSpacingProvenance = (attrs, key, path, issues) => {
|
|
1024
|
+
const value = attrs[key];
|
|
1025
|
+
if (value === void 0 || value === null || typeof value === "boolean") return;
|
|
1026
|
+
optionalOneOf(attrs, key, path, issues, LINE_SPACING_PROVENANCE_VALUES);
|
|
1027
|
+
};
|
|
923
1028
|
const optionalShapeLineEnd = (attrs, key, path, issues) => {
|
|
924
1029
|
const value = attrs[key];
|
|
925
1030
|
if (value === void 0 || value === null) return;
|
|
@@ -1428,8 +1533,8 @@ const PARAGRAPH_FORMATTING_NUMBER_KEYS = [
|
|
|
1428
1533
|
const validateParagraphFormatting = (value, path, issues) => {
|
|
1429
1534
|
optionalOneOf(value, "alignment", `${path}.alignment`, issues, PARAGRAPH_ALIGNMENT_VALUES);
|
|
1430
1535
|
for (const key of PARAGRAPH_FORMATTING_BOOLEAN_KEYS) optionalBoolean(value, key, `${path}.${key}`, issues);
|
|
1536
|
+
optionalLineSpacingProvenance(value, "lineSpacingExplicit", `${path}.lineSpacingExplicit`, issues);
|
|
1431
1537
|
for (const key of [
|
|
1432
|
-
"lineSpacingExplicit",
|
|
1433
1538
|
"listIsBullet",
|
|
1434
1539
|
"listIsLegal",
|
|
1435
1540
|
"listMarkerHidden",
|
|
@@ -1446,6 +1551,7 @@ const validateParagraphFormatting = (value, path, issues) => {
|
|
|
1446
1551
|
optionalString(value, "styleId", `${path}.styleId`, issues);
|
|
1447
1552
|
optionalOneOf(value, "listNumFmt", `${path}.listNumFmt`, issues, NUMBER_FORMAT_VALUES);
|
|
1448
1553
|
optionalString(value, "listMarker", `${path}.listMarker`, issues);
|
|
1554
|
+
optionalString(value, "listMarkerTemplate", `${path}.listMarkerTemplate`, issues);
|
|
1449
1555
|
optionalTextFormatting(value, "listMarkerFormatting", `${path}.listMarkerFormatting`, issues);
|
|
1450
1556
|
optionalOneOf(value, "listMarkerAlignment", `${path}.listMarkerAlignment`, issues, [
|
|
1451
1557
|
"left",
|
|
@@ -1744,4 +1850,4 @@ const optionalEmptyHyperlinkArray = (value, issues) => {
|
|
|
1744
1850
|
}
|
|
1745
1851
|
};
|
|
1746
1852
|
//#endregion
|
|
1747
|
-
export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectSymbolAttrs, expectTabAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
1853
|
+
export { expectBlockSdtAttrs, expectCharacterSpacingMarkAttrs, expectCharacterStyleMarkAttrs, expectCommentMarkAttrs, expectEmphasisMarkAttrs, expectFieldAttrs, expectFontFamilyMarkAttrs, expectFontSizeMarkAttrs, expectFootnoteRefMarkAttrs, expectHardBreakAttrs, expectHighlightMarkAttrs, expectHyperlinkMarkAttrs, expectImageAttrs, expectLanguageMarkAttrs, expectMathAttrs, expectPageBreakRunAttrs, expectPageBreakRunOwnerMarkAttrs, expectParagraphAttrs, expectRunFormattingOverrideMarkAttrs, expectRunPropertyChangeMarkAttrs, expectRunShadingMarkAttrs, expectSdtAttrs, expectShapeAttrs, expectStrikeMarkAttrs, expectSymbolAttrs, expectTabAttrs, expectTableAttrs, expectTableCellAttrs, expectTableRowAttrs, expectTextBoxAttrs, expectTextColorMarkAttrs, expectTextEffectMarkAttrs, expectTrackedChangeMarkAttrs, expectUnderlineMarkAttrs, mergeImageAttrs, mergeParagraphAttrs, mergeTableAttrs, mergeTableCellAttrs, mergeTableRowAttrs, readBlockSdtAttrs, readCharacterSpacingMarkAttrs, readCharacterStyleMarkAttrs, readCommentMarkAttrs, readEmphasisMarkAttrs, readFieldAttrs, readFontFamilyMarkAttrs, readFontSizeMarkAttrs, readFootnoteRefMarkAttrs, readHardBreakAttrs, readHighlightMarkAttrs, readHyperlinkMarkAttrs, readImageAttrs, readLanguageMarkAttrs, readMathAttrs, readPageBreakRunAttrs, readPageBreakRunOwnerMarkAttrs, readParagraphAttrs, readRunFormattingOverrideMarkAttrs, readRunPropertyChangeMarkAttrs, readRunShadingMarkAttrs, readSdtAttrs, readShapeAttrs, readStrikeMarkAttrs, readSymbolAttrs, readTabAttrs, readTableAttrs, readTableCellAttrs, readTableRowAttrs, readTextBoxAttrs, readTextColorMarkAttrs, readTextEffectMarkAttrs, readTrackedChangeMarkAttrs, readUnderlineMarkAttrs };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/prosemirror/bookmarkBoundaryIntegrity.d.ts
|
|
2
|
+
type BookmarkBoundaryOccurrence = {
|
|
3
|
+
id: number;
|
|
4
|
+
type: "start" | "end";
|
|
5
|
+
position: number;
|
|
6
|
+
};
|
|
7
|
+
declare const findInvalidBookmarkBoundaryIds: (occurrences: readonly BookmarkBoundaryOccurrence[], reservedIds?: ReadonlySet<number>) => ReadonlySet<number>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { BookmarkBoundaryOccurrence, findInvalidBookmarkBoundaryIds };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/prosemirror/bookmarkBoundaryIntegrity.ts
|
|
2
|
+
const findInvalidBookmarkBoundaryIds = (occurrences, reservedIds = /* @__PURE__ */ new Set()) => {
|
|
3
|
+
const summaries = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const occurrence of occurrences) {
|
|
5
|
+
const summary = summaries.get(occurrence.id) ?? {
|
|
6
|
+
startPositions: [],
|
|
7
|
+
endPositions: []
|
|
8
|
+
};
|
|
9
|
+
if (occurrence.type === "start") summary.startPositions.push(occurrence.position);
|
|
10
|
+
else summary.endPositions.push(occurrence.position);
|
|
11
|
+
summaries.set(occurrence.id, summary);
|
|
12
|
+
}
|
|
13
|
+
const invalidIds = /* @__PURE__ */ new Set();
|
|
14
|
+
for (const [id, summary] of summaries) {
|
|
15
|
+
const start = summary.startPositions.at(0);
|
|
16
|
+
const end = summary.endPositions.at(0);
|
|
17
|
+
if (reservedIds.has(id) || summary.startPositions.length !== 1 || summary.endPositions.length !== 1 || start === void 0 || end === void 0 || start >= end) invalidIds.add(id);
|
|
18
|
+
}
|
|
19
|
+
return invalidIds;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { findInvalidBookmarkBoundaryIds };
|
|
@@ -8,6 +8,7 @@ declare function addCommentMark(commentId: number): Command;
|
|
|
8
8
|
* Remove a comment mark by ID from the entire document.
|
|
9
9
|
*/
|
|
10
10
|
declare function removeCommentMark(commentId: number): Command;
|
|
11
|
+
type ResolveMode = "accept" | "reject";
|
|
11
12
|
type ParagraphBoundaryChange = {
|
|
12
13
|
from: number;
|
|
13
14
|
to: number;
|
|
@@ -37,6 +38,14 @@ declare function acceptAllChanges(): Command;
|
|
|
37
38
|
* Reject all tracked changes in the document.
|
|
38
39
|
*/
|
|
39
40
|
declare function rejectAllChanges(): Command;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve a complete state synchronously for a headless reader or writer.
|
|
43
|
+
*
|
|
44
|
+
* @internal The replacement transaction is consumed here and never exposed:
|
|
45
|
+
* it is deliberately not an editor command and must not be transported or
|
|
46
|
+
* mapped through concurrent edits.
|
|
47
|
+
*/
|
|
48
|
+
declare function resolveAllChangesInHeadlessState(state: EditorState, mode: ResolveMode): EditorState;
|
|
40
49
|
/**
|
|
41
50
|
* Find the document range covered by all revision carriers with any of the
|
|
42
51
|
* given ids. Returns null when none are present (already accepted/rejected, or
|
|
@@ -165,4 +174,4 @@ declare function findNextChange(state: EditorState, startPos: number): ChangeRan
|
|
|
165
174
|
*/
|
|
166
175
|
declare function findPreviousChange(state: EditorState, startPos: number): ChangeRange | null;
|
|
167
176
|
//#endregion
|
|
168
|
-
export { AcceptSuggestionOptions, FolioSuggestion, ParagraphBoundaryChange, SuggestionAppliedAs, SuggestionKind, acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addCommentMark, findAIEditRevisionRange, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark };
|
|
177
|
+
export { AcceptSuggestionOptions, FolioSuggestion, ParagraphBoundaryChange, SuggestionAppliedAs, SuggestionKind, acceptAIEditRevision, acceptAllChanges, acceptAllSuggestions, acceptChange, acceptSuggestion, addCommentMark, findAIEditRevisionRange, findChangeAtPosition, findNextChange, findParagraphBoundaryChangeAtPosition, findPreviousChange, findSuggestionRange, getSuggestions, rejectAIEditRevision, rejectAllChanges, rejectAllSuggestions, rejectChange, rejectSuggestion, removeCommentMark, resolveAllChangesInHeadlessState };
|