@stll/folio-core 0.44.0 → 0.46.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/__fixtures__/paragraphs.js +2 -2
- package/dist/ai-edits/apply.js +59 -19
- package/dist/ai-edits/headless.js +2 -1
- package/dist/compare/compare.js +2 -5
- package/dist/compare/content-alignment.js +78 -53
- package/dist/compare/inline-atoms.js +34 -20
- package/dist/compare/scenario.js +2 -5
- package/dist/compare/types.d.ts +9 -1
- package/dist/compare/types.js +12 -1
- package/dist/compat/eigenpal.d.ts +2 -1
- package/dist/compat/eigenpal.js +2 -1
- package/dist/content-controls/checkboxDisplay.d.ts +11 -0
- package/dist/content-controls/checkboxDisplay.js +40 -0
- package/dist/content-controls/findContentControls.js +3 -1
- package/dist/content-controls/mutateContentControls.js +21 -4
- package/dist/controller/contentControlWidgetController.d.ts +1 -0
- package/dist/controller/contentControlWidgetController.js +3 -0
- package/dist/controller/hiddenEditorApi.js +3 -1
- package/dist/controller/hiddenEditorManager.d.ts +1 -1
- package/dist/controller/hiddenEditorManager.js +6 -3
- package/dist/display-list/build/buildDisplayList.js +20 -1
- package/dist/display-list/build/imagePrimitives.d.ts +1 -1
- package/dist/display-list/build/imagePrimitives.js +3 -1
- package/dist/display-list/build/paragraphPrimitives.js +21 -2
- package/dist/display-list/dom/renderDisplayListToDom.js +18 -10
- package/dist/display-list/types.d.ts +17 -0
- package/dist/document-operations.js +14 -3
- package/dist/docx/attributeRemainder.d.ts +43 -0
- package/dist/docx/attributeRemainder.js +65 -0
- package/dist/docx/blockContentParser.d.ts +1 -1
- package/dist/docx/blockContentParser.js +87 -63
- package/dist/docx/blockPlainText.d.ts +3 -4
- package/dist/docx/blockPlainText.js +1 -0
- package/dist/docx/bookmarkPlacement.js +2 -0
- package/dist/docx/borderParser.js +5 -5
- package/dist/docx/commentAnchorIndex.d.ts +30 -0
- package/dist/docx/commentAnchorIndex.js +50 -0
- package/dist/docx/commentParser.d.ts +1 -1
- package/dist/docx/commentParser.js +78 -50
- package/dist/docx/commentRangeIntegrity.d.ts +16 -1
- package/dist/docx/commentRangeIntegrity.js +42 -1
- package/dist/docx/commentRangeJoin.d.ts +9 -0
- package/dist/docx/commentRangeJoin.js +33 -0
- package/dist/docx/commentReferenceCompletion.d.ts +9 -0
- package/dist/docx/commentReferenceCompletion.js +47 -0
- package/dist/docx/commentReferenceNormalization.js +1 -0
- package/dist/docx/commentReplyMarkers.js +11 -19
- package/dist/docx/commentThreadKey.d.ts +18 -0
- package/dist/docx/commentThreadKey.js +22 -0
- package/dist/docx/compatibility.js +1 -0
- package/dist/docx/containerChildren.d.ts +111 -0
- package/dist/docx/containerChildren.gen.d.ts +28 -0
- package/dist/docx/containerChildren.gen.js +246 -0
- package/dist/docx/containerChildren.js +103 -0
- package/dist/docx/diagramPreview.js +87 -27
- package/dist/docx/documentParser.d.ts +1 -1
- package/dist/docx/documentParser.js +3 -3
- package/dist/docx/ensureParaIds.js +17 -7
- package/dist/docx/fieldParser.d.ts +1 -1
- package/dist/docx/fieldParser.js +4 -4
- package/dist/docx/fieldState.d.ts +26 -0
- package/dist/docx/fieldState.js +53 -0
- package/dist/docx/footnoteParser.d.ts +1 -1
- package/dist/docx/graphicFrameLocks.d.ts +16 -4
- package/dist/docx/graphicFrameLocks.js +19 -6
- package/dist/docx/groupDrawingParser.js +3 -3
- package/dist/docx/headerFooterParser.js +1 -1
- package/dist/docx/headerFooterReferenceNormalization.js +1 -0
- package/dist/docx/hyperlinkParser.d.ts +27 -8
- package/dist/docx/hyperlinkParser.js +78 -20
- package/dist/docx/imageParser.d.ts +9 -1
- package/dist/docx/imageParser.js +91 -20
- package/dist/docx/imageRawXml.d.ts +14 -1
- package/dist/docx/imageRawXml.js +30 -6
- package/dist/docx/inlineWrapperContent.d.ts +85 -0
- package/dist/docx/inlineWrapperContent.js +84 -0
- package/dist/docx/mathToMathml.js +12 -14
- package/dist/docx/nonVisualDrawingProps.d.ts +34 -0
- package/dist/docx/nonVisualDrawingProps.js +46 -0
- package/dist/docx/normalizeBaseDirection.js +10 -1
- package/dist/docx/paraIdAttribute.d.ts +21 -0
- package/dist/docx/paraIdAttribute.js +64 -0
- package/dist/docx/paragraphParser.d.ts +1 -1
- package/dist/docx/paragraphParser.js +277 -168
- package/dist/docx/paragraphPropertySource.js +5 -1
- package/dist/docx/paragraphTextBoxEnrichment.d.ts +1 -1
- package/dist/docx/paragraphTextBoxEnrichment.js +9 -52
- package/dist/docx/paragraphTraversal.js +7 -4
- package/dist/docx/parseWarningMessage.js +2 -1
- package/dist/docx/parser.js +2 -2
- package/dist/docx/preservedRunContent.d.ts +32 -0
- package/dist/docx/preservedRunContent.js +86 -0
- package/dist/docx/previewBudget.d.ts +64 -0
- package/dist/docx/previewBudget.js +88 -0
- package/dist/docx/renderedPageBreakNormalization.js +2 -4
- package/dist/docx/revisionIdNormalization.js +17 -5
- package/dist/docx/rezip.js +91 -36
- package/dist/docx/runParser.d.ts +1 -1
- package/dist/docx/runParser.js +16 -12
- package/dist/docx/sdtPropertiesPatch.js +24 -18
- package/dist/docx/sectionParser.js +8 -1
- package/dist/docx/sectionReferenceHistory.js +2 -2
- package/dist/docx/selectiveSave.js +6 -6
- package/dist/docx/selectiveXmlPatch.d.ts +46 -2
- package/dist/docx/selectiveXmlPatch.js +86 -39
- package/dist/docx/serializer/blockSdtSerializer.js +38 -26
- package/dist/docx/serializer/borderSerializer.d.ts +1 -1
- package/dist/docx/serializer/borderSerializer.js +15 -14
- package/dist/docx/serializer/commentSerializer.d.ts +41 -16
- package/dist/docx/serializer/commentSerializer.js +87 -92
- package/dist/docx/serializer/documentSerializer.js +8 -11
- package/dist/docx/serializer/fontTableSerializer.js +6 -6
- package/dist/docx/serializer/headerFooterSerializer.js +12 -14
- package/dist/docx/serializer/markupRangeAttributes.js +2 -2
- package/dist/docx/serializer/noteSerializer.js +8 -8
- package/dist/docx/serializer/numberingSerializer.js +7 -6
- package/dist/docx/serializer/paragraphSerializer.js +93 -72
- package/dist/docx/serializer/partNamespaces.js +2 -2
- package/dist/docx/serializer/runSerializer.js +73 -44
- package/dist/docx/serializer/sectionPropertiesSerializer.js +19 -14
- package/dist/docx/serializer/settingsSerializer.js +4 -3
- package/dist/docx/serializer/stylesSerializer.js +6 -6
- package/dist/docx/serializer/tableSerializer.js +28 -17
- package/dist/docx/serializer/textFormattingSerializer.js +29 -28
- package/dist/docx/serializer/themeSerializer.js +6 -6
- package/dist/docx/serializer/trackedChangeAttributes.js +2 -2
- package/dist/docx/serializer/xmlUtils.d.ts +1 -2
- package/dist/docx/serializer/xmlUtils.js +1 -13
- package/dist/docx/server/boundedArchive.d.ts +12 -0
- package/dist/docx/server/boundedArchive.js +20 -1
- package/dist/docx/server/createBilingualDocument.js +3 -1
- package/dist/docx/server/materializeYjsDocx.d.ts +1 -1
- package/dist/docx/server/materializeYjsDocx.js +9 -1
- package/dist/docx/server/migrateYjsAttrSchema.d.ts +55 -0
- package/dist/docx/server/migrateYjsAttrSchema.js +95 -0
- package/dist/docx/server/validateDocxConformance.js +22 -1
- package/dist/docx/shapeParser.js +12 -10
- package/dist/docx/tableParser.d.ts +1 -1
- package/dist/docx/tableParser.js +206 -85
- package/dist/docx/textBoxParser.d.ts +25 -2
- package/dist/docx/textBoxParser.js +59 -4
- package/dist/docx/unzip.d.ts +23 -0
- package/dist/docx/unzip.js +37 -26
- package/dist/docx/verbatimCapture.js +1 -1
- package/dist/docx/vmlImageParser.d.ts +17 -1
- package/dist/docx/vmlImageParser.js +20 -3
- package/dist/docx/vmlPreview.d.ts +1 -3
- package/dist/docx/vmlPreview.js +2 -30
- package/dist/docx/xmlEncoding.d.ts +5 -0
- package/dist/docx/xmlEncoding.js +12 -0
- package/dist/docx/xmlParser.d.ts +26 -2
- package/dist/docx/xmlParser.js +70 -27
- package/dist/docx/xmlResourceLimits.d.ts +89 -9
- package/dist/docx/xmlResourceLimits.js +105 -24
- package/dist/headless-layout.js +10 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +5 -2
- package/dist/internal/paragraphFormattingSerialization.js +3 -2
- package/dist/layout-bridge/convert/toFlowBlocks.js +102 -12
- package/dist/layout-engine/measure/tableCellFloating.d.ts +2 -0
- package/dist/layout-engine/measure/tableCellFloating.js +2 -0
- package/dist/layout-engine/types.d.ts +23 -1
- package/dist/layout-painter/renderImage.d.ts +5 -1
- package/dist/layout-painter/renderImage.js +14 -6
- package/dist/layout-painter/renderPage.d.ts +2 -0
- package/dist/layout-painter/renderPage.js +4 -0
- package/dist/layout-painter/renderParagraph.d.ts +13 -1
- package/dist/layout-painter/renderParagraph.js +26 -6
- package/dist/managers/autoSaveCodec.d.ts +9 -1
- package/dist/managers/autoSaveCodec.js +14 -12
- package/dist/markdown/images.js +1 -4
- package/dist/markdown/renderBlock.js +1 -0
- package/dist/markdown/renderRuns.d.ts +1 -1
- package/dist/markdown/renderRuns.js +28 -5
- package/dist/markdown/renderTable.js +22 -5
- package/dist/markdown/trailers.js +4 -1
- package/dist/pdf/images.js +142 -6
- package/dist/prosemirror/attrs/index.d.ts +14 -3
- package/dist/prosemirror/attrs/index.js +224 -2
- package/dist/prosemirror/authoredTransformAttrs.d.ts +28 -0
- package/dist/prosemirror/authoredTransformAttrs.js +64 -0
- package/dist/prosemirror/commands/contentControls.js +10 -2
- package/dist/prosemirror/commands/image.d.ts +9 -2
- package/dist/prosemirror/commands/image.js +43 -28
- package/dist/prosemirror/commands/pageBreak.js +1 -1
- package/dist/prosemirror/commentReferenceAttrs.d.ts +8 -0
- package/dist/prosemirror/commentReferenceAttrs.js +33 -0
- package/dist/prosemirror/commentReferenceIntegrity.d.ts +47 -0
- package/dist/prosemirror/commentReferenceIntegrity.js +43 -0
- package/dist/prosemirror/conversion/fromProseDoc.d.ts +2 -13
- package/dist/prosemirror/conversion/fromProseDoc.js +338 -99
- package/dist/prosemirror/conversion/index.d.ts +2 -2
- package/dist/prosemirror/conversion/toProseDoc.d.ts +7 -9
- package/dist/prosemirror/conversion/toProseDoc.js +551 -327
- package/dist/prosemirror/extensions/StarterKit.js +8 -58
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -1
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +45 -27
- package/dist/prosemirror/extensions/features/EmptyParagraphFormatExtension.js +3 -1
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +5 -3
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +1 -0
- package/dist/prosemirror/extensions/markRegistry.d.ts +41 -0
- package/dist/prosemirror/extensions/markRegistry.js +75 -0
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +2 -3
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.d.ts +18 -0
- package/dist/prosemirror/extensions/marks/InlineWrapperExtension.js +63 -0
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +2 -1
- package/dist/prosemirror/extensions/marks/markUtils.js +47 -4
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.d.ts +11 -0
- package/dist/prosemirror/extensions/nodes/CommentReferenceExtension.js +87 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +9 -7
- package/dist/prosemirror/extensions/nodes/ImageExtension.js +20 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.d.ts +32 -0
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +67 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.d.ts +16 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +60 -0
- package/dist/prosemirror/extensions/nodes/ShapeExtension.js +10 -2
- package/dist/prosemirror/extensions/nodes/TableExtension.js +3 -2
- package/dist/prosemirror/extensions/nodes/TextBoxExtension.js +13 -5
- package/dist/prosemirror/inlineWrapperStack.d.ts +39 -0
- package/dist/prosemirror/inlineWrapperStack.js +75 -0
- package/dist/prosemirror/pageBreakRunProjection.d.ts +17 -7
- package/dist/prosemirror/pageBreakRunProjection.js +19 -9
- package/dist/prosemirror/paragraphFormattingProvenance.d.ts +6 -3
- package/dist/prosemirror/paragraphFormattingProvenance.js +12 -3
- package/dist/prosemirror/replacedAnnotations.d.ts +59 -0
- package/dist/prosemirror/replacedAnnotations.js +165 -0
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +3 -1
- package/dist/prosemirror/runFormattingInlineCarriers.js +5 -1
- package/dist/prosemirror/schema/index.d.ts +3 -3
- package/dist/prosemirror/schema/marks.d.ts +25 -1
- package/dist/prosemirror/schema/nodes.d.ts +139 -3
- package/dist/prosemirror/schema/nodes.js +16 -1
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +2 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +2 -0
- package/dist/prosemirror/validation.js +16 -2
- package/dist/prosemirror/yjsDocumentMetadata.d.ts +73 -0
- package/dist/prosemirror/yjsDocumentMetadata.js +171 -0
- package/dist/prosemirror/zeroWidthAnchors.js +2 -0
- package/dist/render-dom/commentAnchorAttributes.d.ts +37 -0
- package/dist/render-dom/commentAnchorAttributes.js +54 -0
- package/dist/server.d.ts +3 -1
- package/dist/server.js +3 -1
- package/dist/types/content.d.ts +2 -2
- package/dist/utils/base64.d.ts +36 -0
- package/dist/utils/base64.js +40 -0
- package/dist/utils/clipboard.d.ts +9 -1
- package/dist/utils/clipboard.js +29 -2
- package/dist/utils/findReplace.js +1 -1
- package/dist/utils/imageLuminance.d.ts +15 -0
- package/dist/utils/imageLuminance.js +32 -0
- package/dist/utils/mergeDocumentContent.js +7 -17
- package/dist/utils/replaceText.js +1 -0
- package/dist/utils/units.d.ts +10 -1
- package/dist/utils/units.js +12 -1
- package/dist/utils/urlSecurity.d.ts +8 -2
- package/dist/utils/urlSecurity.js +21 -3
- package/package.json +2 -2
- package/dist/docx/blockRangeMarkers.d.ts +0 -36
- package/dist/docx/blockRangeMarkers.js +0 -59
- package/dist/prosemirror/yjsParagraphSourceContract.d.ts +0 -9
- package/dist/prosemirror/yjsParagraphSourceContract.js +0 -26
|
@@ -1,34 +1,44 @@
|
|
|
1
1
|
import { expectParagraphAttrs } from "./attrs/index.js";
|
|
2
2
|
//#region src/prosemirror/pageBreakRunProjection.ts
|
|
3
|
+
/**
|
|
4
|
+
* Paragraph shapes whose explicit page-break run the editor lays out
|
|
5
|
+
* approximately.
|
|
6
|
+
*
|
|
7
|
+
* Layout splits a paragraph into fragments at its breaks, and a paragraph
|
|
8
|
+
* property that describes the paragraph as a whole then applies to each
|
|
9
|
+
* fragment. That is an approximation, not a loss: the run is projected, it is
|
|
10
|
+
* saved, and the document opens. Folio used to refuse these instead, which
|
|
11
|
+
* meant a file Word opens could not be opened, laid out or exported at all.
|
|
12
|
+
*/
|
|
3
13
|
const PAGE_BREAK_RUN_PARAGRAPH_PROJECTION_MESSAGES = {
|
|
4
|
-
borders: "A bordered paragraph
|
|
5
|
-
frame: "A framed paragraph
|
|
6
|
-
outline: "An outline paragraph
|
|
7
|
-
textBoxAnchor: "A
|
|
14
|
+
borders: "A bordered paragraph is split at its explicit page-break run, so its border is drawn around each part",
|
|
15
|
+
frame: "A framed paragraph is split at its explicit page-break run, so its frame applies to each part",
|
|
16
|
+
outline: "An outline paragraph is split at its explicit page-break run, so each part carries the outline level",
|
|
17
|
+
textBoxAnchor: "A text-box anchor following an explicit page-break run is hosted by the paragraph's first part"
|
|
8
18
|
};
|
|
9
19
|
/** Keep source-import and ProseMirror-layout ownership decisions on one predicate. */
|
|
10
20
|
const pageBreakRunParagraphProjectionDispositionForFeatures = ({ attrs, effectiveFrame, textBoxAnchorAfterPageBreak }) => {
|
|
11
21
|
if (effectiveFrame !== void 0 && effectiveFrame.dropCap !== "drop" && effectiveFrame.dropCap !== "margin") return {
|
|
12
|
-
status: "
|
|
22
|
+
status: "approximate",
|
|
13
23
|
reason: "frame",
|
|
14
24
|
message: PAGE_BREAK_RUN_PARAGRAPH_PROJECTION_MESSAGES.frame
|
|
15
25
|
};
|
|
16
26
|
if (attrs.outlineLevel !== void 0) return {
|
|
17
|
-
status: "
|
|
27
|
+
status: "approximate",
|
|
18
28
|
reason: "outline",
|
|
19
29
|
message: PAGE_BREAK_RUN_PARAGRAPH_PROJECTION_MESSAGES.outline
|
|
20
30
|
};
|
|
21
31
|
if (attrs.borders !== void 0 && Object.values(attrs.borders).some((border) => border !== void 0)) return {
|
|
22
|
-
status: "
|
|
32
|
+
status: "approximate",
|
|
23
33
|
reason: "borders",
|
|
24
34
|
message: PAGE_BREAK_RUN_PARAGRAPH_PROJECTION_MESSAGES.borders
|
|
25
35
|
};
|
|
26
36
|
if (textBoxAnchorAfterPageBreak) return {
|
|
27
|
-
status: "
|
|
37
|
+
status: "approximate",
|
|
28
38
|
reason: "textBoxAnchor",
|
|
29
39
|
message: PAGE_BREAK_RUN_PARAGRAPH_PROJECTION_MESSAGES.textBoxAnchor
|
|
30
40
|
};
|
|
31
|
-
return { status: "
|
|
41
|
+
return { status: "exact" };
|
|
32
42
|
};
|
|
33
43
|
const pageBreakRunParagraphProjectionDisposition = (paragraph) => {
|
|
34
44
|
const attrs = expectParagraphAttrs(paragraph);
|
|
@@ -95,10 +95,12 @@ declare const PARAGRAPH_FORMATTING_WRITE_BACK: {
|
|
|
95
95
|
readonly attr: "tabs";
|
|
96
96
|
};
|
|
97
97
|
readonly keepNext: {
|
|
98
|
-
readonly kind: "
|
|
98
|
+
readonly kind: "style-resolved-attr";
|
|
99
|
+
readonly attr: "keepNext";
|
|
99
100
|
};
|
|
100
101
|
readonly keepLines: {
|
|
101
|
-
readonly kind: "
|
|
102
|
+
readonly kind: "style-resolved-attr";
|
|
103
|
+
readonly attr: "keepLines";
|
|
102
104
|
};
|
|
103
105
|
readonly widowControl: {
|
|
104
106
|
readonly kind: "style-resolved-attr";
|
|
@@ -142,7 +144,8 @@ declare const PARAGRAPH_FORMATTING_WRITE_BACK: {
|
|
|
142
144
|
readonly kind: "original-only";
|
|
143
145
|
};
|
|
144
146
|
readonly runInWithNext: {
|
|
145
|
-
readonly kind: "
|
|
147
|
+
readonly kind: "style-resolved-attr";
|
|
148
|
+
readonly attr: "runInWithNext";
|
|
146
149
|
};
|
|
147
150
|
};
|
|
148
151
|
type StyleResolvedParagraphField = { [Field in keyof typeof PARAGRAPH_FORMATTING_WRITE_BACK]: (typeof PARAGRAPH_FORMATTING_WRITE_BACK)[Field] extends {
|
|
@@ -53,8 +53,14 @@ const PARAGRAPH_FORMATTING_WRITE_BACK = {
|
|
|
53
53
|
kind: "style-resolved-attr",
|
|
54
54
|
attr: "tabs"
|
|
55
55
|
},
|
|
56
|
-
keepNext: {
|
|
57
|
-
|
|
56
|
+
keepNext: {
|
|
57
|
+
kind: "style-resolved-attr",
|
|
58
|
+
attr: "keepNext"
|
|
59
|
+
},
|
|
60
|
+
keepLines: {
|
|
61
|
+
kind: "style-resolved-attr",
|
|
62
|
+
attr: "keepLines"
|
|
63
|
+
},
|
|
58
64
|
widowControl: {
|
|
59
65
|
kind: "style-resolved-attr",
|
|
60
66
|
attr: "widowControl"
|
|
@@ -82,7 +88,10 @@ const PARAGRAPH_FORMATTING_WRITE_BACK = {
|
|
|
82
88
|
attr: "suppressAutoHyphens"
|
|
83
89
|
},
|
|
84
90
|
runProperties: { kind: "original-only" },
|
|
85
|
-
runInWithNext: {
|
|
91
|
+
runInWithNext: {
|
|
92
|
+
kind: "style-resolved-attr",
|
|
93
|
+
attr: "runInWithNext"
|
|
94
|
+
}
|
|
86
95
|
};
|
|
87
96
|
const STYLE_RESOLVED_PARAGRAPH_FIELDS = Object.keys(PARAGRAPH_FORMATTING_WRITE_BACK).filter((field) => PARAGRAPH_FORMATTING_WRITE_BACK[field].kind === "style-resolved-attr");
|
|
88
97
|
/**
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Fragment, Mark, Node, Schema } from "prosemirror-model";
|
|
2
|
+
//#region src/prosemirror/replacedAnnotations.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* What a replacement does with each mark the schema declares
|
|
5
|
+
* `inclusive: false`. Boundary inheritance already handles every other mark,
|
|
6
|
+
* so this table is exactly the set that needs a decision; a new
|
|
7
|
+
* non-inclusive mark that is missing from it fails
|
|
8
|
+
* `replacedAnnotations.test.ts` rather than silently following the text.
|
|
9
|
+
*/
|
|
10
|
+
declare const NON_INCLUSIVE_MARK_DISPOSITION: {
|
|
11
|
+
readonly comment: "carry";
|
|
12
|
+
readonly hyperlink: "carry";
|
|
13
|
+
readonly footnoteRef: "followsTheText";
|
|
14
|
+
readonly pageBreakRunOwner: "followsTheText";
|
|
15
|
+
readonly insertion: "followsTheText";
|
|
16
|
+
readonly deletion: "followsTheText";
|
|
17
|
+
readonly runPropertyChange: "followsTheText";
|
|
18
|
+
readonly inlineWrapper: "followsTheText";
|
|
19
|
+
};
|
|
20
|
+
/** The mark names in the schema that a replacement must not silently drop. */
|
|
21
|
+
declare const nonInclusiveMarkNames: (schema: Schema) => string[];
|
|
22
|
+
type ReplacedAnnotations = {
|
|
23
|
+
/** Marks the replacement must carry, in document order. */
|
|
24
|
+
carried: readonly Mark[];
|
|
25
|
+
/** Anchors restored before the replacement, in their original order. */
|
|
26
|
+
leading: readonly Node[];
|
|
27
|
+
/** Anchors restored after the replacement, in their original order. */
|
|
28
|
+
trailing: readonly Node[];
|
|
29
|
+
};
|
|
30
|
+
declare const hasReplacedAnnotations: ({ carried, leading, trailing }: ReplacedAnnotations) => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The annotations carried by `[from, to)`. An anchor counts only when the
|
|
33
|
+
* range covers it whole: a partially covered atom is not deleted by the
|
|
34
|
+
* replacement either.
|
|
35
|
+
*/
|
|
36
|
+
declare const surveyReplacedAnnotations: (doc: Node, from: number, to: number) => ReplacedAnnotations;
|
|
37
|
+
type AnnotatedReplacementOptions = {
|
|
38
|
+
annotations: ReplacedAnnotations;
|
|
39
|
+
/** The replacement's own inline content, already carrying its formatting. */
|
|
40
|
+
content: Fragment;
|
|
41
|
+
};
|
|
42
|
+
type AnnotatedReplacement = {
|
|
43
|
+
fragment: Fragment;
|
|
44
|
+
/** Size of the anchors restored before the replacement's own content. */
|
|
45
|
+
leadingSize: number;
|
|
46
|
+
/** Size of the replacement's own content, once the marks are on it. */
|
|
47
|
+
contentSize: number;
|
|
48
|
+
};
|
|
49
|
+
/** `marks` with the carried marks added, each type's exclusions respected. */
|
|
50
|
+
declare const addCarriedMarks: (marks: readonly Mark[], carried: readonly Mark[]) => readonly Mark[];
|
|
51
|
+
/** `content` with the surveyed marks on it and the surveyed anchors around it. */
|
|
52
|
+
declare const annotatedReplacement: ({ annotations: { carried, leading, trailing }, content }: AnnotatedReplacementOptions) => AnnotatedReplacement;
|
|
53
|
+
/**
|
|
54
|
+
* The marks a replacement inherits at `[from, to)`, exactly as
|
|
55
|
+
* `Transaction.insertText` would compute them.
|
|
56
|
+
*/
|
|
57
|
+
declare const inheritedReplacementMarks: (doc: Node, from: number, to: number) => readonly Mark[];
|
|
58
|
+
//#endregion
|
|
59
|
+
export { NON_INCLUSIVE_MARK_DISPOSITION, ReplacedAnnotations, addCarriedMarks, annotatedReplacement, hasReplacedAnnotations, inheritedReplacementMarks, nonInclusiveMarkNames, surveyReplacedAnnotations };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { BOOKMARK_BOUNDARY_NODE_NAME } from "./extensions/nodes/BookmarkBoundaryExtension.js";
|
|
2
|
+
import { COMMENT_REFERENCE_NODE_NAME } from "./extensions/nodes/CommentReferenceExtension.js";
|
|
3
|
+
import { TEXT_BOX_ANCHOR_NODE_NAME } from "./extensions/nodes/TextBoxAnchorExtension.js";
|
|
4
|
+
import { Fragment, Mark } from "prosemirror-model";
|
|
5
|
+
//#region src/prosemirror/replacedAnnotations.ts
|
|
6
|
+
/**
|
|
7
|
+
* What survives when an edit replaces a span of inline content.
|
|
8
|
+
*
|
|
9
|
+
* ProseMirror gives a replacement the marks it inherits at the boundary, and
|
|
10
|
+
* drops any mark declared `inclusive: false` once the span reaches the end of
|
|
11
|
+
* what that mark covers. For formatting that is right. For a mark that names
|
|
12
|
+
* something outside itself — the comment this text is commented by, the
|
|
13
|
+
* address this text links to — it is not: the target survives the edit, and
|
|
14
|
+
* only the mark saying so is lost. A comment loses the range start that lived
|
|
15
|
+
* on the replaced text, so the save emits a `commentRangeEnd` with no
|
|
16
|
+
* `commentRangeStart`, invalid OOXML and a comment anchored to nothing; a
|
|
17
|
+
* hyperlink simply stops being a link. Zero-width anchors fare worse still: a
|
|
18
|
+
* plain replace deletes them outright.
|
|
19
|
+
*
|
|
20
|
+
* Word moves a range start that sits inside a replaced span to the beginning
|
|
21
|
+
* of the replacement and lets the range keep covering the new text; it keeps
|
|
22
|
+
* a link across a replacement of its display text. A range wholly inside the
|
|
23
|
+
* span collapses onto the replacement, and disappears only when every
|
|
24
|
+
* character it covered is gone. One rule per marker kind, and that is the
|
|
25
|
+
* whole contract:
|
|
26
|
+
*
|
|
27
|
+
* - `comment` mark: the replacement carries every comment the span covered, so
|
|
28
|
+
* a range that started inside it starts at the replacement instead.
|
|
29
|
+
* - `hyperlink` mark: the replacement carries the first link the span held, so
|
|
30
|
+
* replacing a link's display text leaves the link on the new text. A span
|
|
31
|
+
* crossing two links keeps the one it opens in, because the mark excludes
|
|
32
|
+
* itself and a replacement is one run of text with one address.
|
|
33
|
+
* - `footnoteRef` mark (footnotes and endnotes alike): not carried. It marks
|
|
34
|
+
* the reference's own number, not prose around it, and it serializes as a
|
|
35
|
+
* bare `w:footnoteReference` run, so carrying it onto a replacement would
|
|
36
|
+
* discard the new text. Replacing a reference's text deletes the reference,
|
|
37
|
+
* as deleting that text does.
|
|
38
|
+
* - `pageBreakRunOwner` mark: not carried. It is editor-only identity for one
|
|
39
|
+
* authored run, not a target, and carrying it would fuse the replacement
|
|
40
|
+
* into a run it was never part of.
|
|
41
|
+
* - tracked-change marks (`insertion`, `deletion`, `runPropertyChange`): not
|
|
42
|
+
* carried. The applier decides them per edit mode and writes them itself.
|
|
43
|
+
* - `inlineWrapper` mark: not carried. Every wrapper kind states something
|
|
44
|
+
* about the text under it and names nothing outside itself, so boundary
|
|
45
|
+
* inheritance is the right rule: a replacement inside a bidirectional
|
|
46
|
+
* override is still inside it, and one that replaces the whole of it is not.
|
|
47
|
+
* - `commentReference` node: kept after the replacement, where the comment's
|
|
48
|
+
* last covered position now is.
|
|
49
|
+
* - `bookmarkBoundary` node: a start kept before the replacement, an end after
|
|
50
|
+
* it, so the bookmark still covers the new text.
|
|
51
|
+
* - `textBoxAnchor` node: kept after the replacement; the shape it anchors
|
|
52
|
+
* outlives the sentence it was typed into.
|
|
53
|
+
* - `renderedPageBreak` node: dropped with the text. It is Word's cached
|
|
54
|
+
* pagination, re-derived on layout, and nothing else names it.
|
|
55
|
+
* - every other mark: formatting, and left to boundary inheritance, which
|
|
56
|
+
* already gives the replacement the formatting of the text it replaces.
|
|
57
|
+
*
|
|
58
|
+
* Deleting the whole of a comment's span leaves it no mark anywhere, so
|
|
59
|
+
* `CommentReferenceExtension` drops the orphan reference and the save drops
|
|
60
|
+
* the comment: the one case where a range is meant to disappear.
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* What a replacement does with each mark the schema declares
|
|
64
|
+
* `inclusive: false`. Boundary inheritance already handles every other mark,
|
|
65
|
+
* so this table is exactly the set that needs a decision; a new
|
|
66
|
+
* non-inclusive mark that is missing from it fails
|
|
67
|
+
* `replacedAnnotations.test.ts` rather than silently following the text.
|
|
68
|
+
*/
|
|
69
|
+
const NON_INCLUSIVE_MARK_DISPOSITION = {
|
|
70
|
+
comment: "carry",
|
|
71
|
+
hyperlink: "carry",
|
|
72
|
+
footnoteRef: "followsTheText",
|
|
73
|
+
pageBreakRunOwner: "followsTheText",
|
|
74
|
+
insertion: "followsTheText",
|
|
75
|
+
deletion: "followsTheText",
|
|
76
|
+
runPropertyChange: "followsTheText",
|
|
77
|
+
inlineWrapper: "followsTheText"
|
|
78
|
+
};
|
|
79
|
+
/** The mark names in the schema that a replacement must not silently drop. */
|
|
80
|
+
const nonInclusiveMarkNames = (schema) => Object.entries(schema.marks).filter(([, type]) => type.spec.inclusive === false).map(([name]) => name);
|
|
81
|
+
const isCarried = (mark) => NON_INCLUSIVE_MARK_DISPOSITION[mark.type.name] === "carry";
|
|
82
|
+
/** Anchors an edit must put back, and where relative to the replacement. */
|
|
83
|
+
const ANCHOR_PLACEMENT = {
|
|
84
|
+
[COMMENT_REFERENCE_NODE_NAME]: "after",
|
|
85
|
+
[TEXT_BOX_ANCHOR_NODE_NAME]: "after",
|
|
86
|
+
[BOOKMARK_BOUNDARY_NODE_NAME]: "byBoundaryType"
|
|
87
|
+
};
|
|
88
|
+
const anchorPlacement = (node) => ANCHOR_PLACEMENT[node.type.name];
|
|
89
|
+
const NOTHING_REPLACED = {
|
|
90
|
+
carried: [],
|
|
91
|
+
leading: [],
|
|
92
|
+
trailing: []
|
|
93
|
+
};
|
|
94
|
+
const hasReplacedAnnotations = ({ carried, leading, trailing }) => carried.length > 0 || leading.length > 0 || trailing.length > 0;
|
|
95
|
+
/**
|
|
96
|
+
* The annotations carried by `[from, to)`. An anchor counts only when the
|
|
97
|
+
* range covers it whole: a partially covered atom is not deleted by the
|
|
98
|
+
* replacement either.
|
|
99
|
+
*/
|
|
100
|
+
const surveyReplacedAnnotations = (doc, from, to) => {
|
|
101
|
+
if (to <= from) return NOTHING_REPLACED;
|
|
102
|
+
const carried = [];
|
|
103
|
+
const leading = [];
|
|
104
|
+
const trailing = [];
|
|
105
|
+
doc.nodesBetween(from, to, (node, position) => {
|
|
106
|
+
if (!node.isInline) return true;
|
|
107
|
+
for (const mark of node.marks) if (isCarried(mark) && !alreadyCarried(mark, carried)) carried.push(mark);
|
|
108
|
+
const placement = anchorPlacement(node);
|
|
109
|
+
if (placement === void 0 || position < from || position + node.nodeSize > to) return false;
|
|
110
|
+
(placement === "byBoundaryType" && node.attrs["type"] === "start" ? leading : trailing).push(node);
|
|
111
|
+
return false;
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
carried,
|
|
115
|
+
leading,
|
|
116
|
+
trailing
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Whether the span already contributed this mark, or one the mark would evict.
|
|
121
|
+
* Comments do not exclude each other, so every comment is collected; a
|
|
122
|
+
* hyperlink excludes its own type, so the first address in the span wins
|
|
123
|
+
* rather than the last silently overwriting it.
|
|
124
|
+
*/
|
|
125
|
+
const alreadyCarried = (mark, carried) => carried.some((other) => other.eq(mark) || mark.type.excludes(other.type));
|
|
126
|
+
const anchorsSize = (anchors) => {
|
|
127
|
+
let size = 0;
|
|
128
|
+
for (const node of anchors) size += node.nodeSize;
|
|
129
|
+
return size;
|
|
130
|
+
};
|
|
131
|
+
/** `marks` with the carried marks added, each type's exclusions respected. */
|
|
132
|
+
const addCarriedMarks = (marks, carried) => {
|
|
133
|
+
let next = marks;
|
|
134
|
+
for (const mark of carried) next = mark.addToSet(next);
|
|
135
|
+
return next;
|
|
136
|
+
};
|
|
137
|
+
const withCarriedMarks = (node, carried) => node.mark(addCarriedMarks(node.marks, carried));
|
|
138
|
+
/** `content` with the surveyed marks on it and the surveyed anchors around it. */
|
|
139
|
+
const annotatedReplacement = ({ annotations: { carried, leading, trailing }, content }) => {
|
|
140
|
+
const inline = [];
|
|
141
|
+
content.forEach((child) => {
|
|
142
|
+
inline.push(carried.length === 0 ? child : withCarriedMarks(child, carried));
|
|
143
|
+
});
|
|
144
|
+
const fragment = Fragment.fromArray([
|
|
145
|
+
...leading,
|
|
146
|
+
...inline,
|
|
147
|
+
...trailing
|
|
148
|
+
]);
|
|
149
|
+
const leadingSize = anchorsSize(leading);
|
|
150
|
+
return {
|
|
151
|
+
fragment,
|
|
152
|
+
leadingSize,
|
|
153
|
+
contentSize: fragment.size - leadingSize - anchorsSize(trailing)
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* The marks a replacement inherits at `[from, to)`, exactly as
|
|
158
|
+
* `Transaction.insertText` would compute them.
|
|
159
|
+
*/
|
|
160
|
+
const inheritedReplacementMarks = (doc, from, to) => {
|
|
161
|
+
const $from = doc.resolve(from);
|
|
162
|
+
return (to === from ? $from.marks() : $from.marksAcross(doc.resolve(to))) ?? Mark.none;
|
|
163
|
+
};
|
|
164
|
+
//#endregion
|
|
165
|
+
export { NON_INCLUSIVE_MARK_DISPOSITION, addCarriedMarks, annotatedReplacement, hasReplacedAnnotations, inheritedReplacementMarks, nonInclusiveMarkNames, surveyReplacedAnnotations };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transaction } from "prosemirror-state";
|
|
2
2
|
import { Mark, Node } from "prosemirror-model";
|
|
3
3
|
//#region src/prosemirror/runFormattingInlineCarriers.d.ts
|
|
4
|
-
type RunFormattingInlineAtomDisposition = "break-run" | "field-run" | "not-a-run" | "page-break-carrier" | "structured-field" | "symbol-run" | "tab-run" | "text-run";
|
|
4
|
+
type RunFormattingInlineAtomDisposition = "break-run" | "field-run" | "not-a-run" | "page-break-carrier" | "preserved-xml-run" | "structured-field" | "symbol-run" | "tab-run" | "text-run";
|
|
5
5
|
/**
|
|
6
6
|
* How every inline atom maps to a serialized run-formatting carrier.
|
|
7
7
|
*
|
|
@@ -12,11 +12,13 @@ type RunFormattingInlineAtomDisposition = "break-run" | "field-run" | "not-a-run
|
|
|
12
12
|
*/
|
|
13
13
|
declare const RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS: Readonly<{
|
|
14
14
|
readonly bookmarkBoundary: "not-a-run";
|
|
15
|
+
readonly commentReference: "not-a-run";
|
|
15
16
|
readonly field: "field-run";
|
|
16
17
|
readonly hardBreak: "break-run";
|
|
17
18
|
readonly image: "not-a-run";
|
|
18
19
|
readonly math: "not-a-run";
|
|
19
20
|
readonly pageBreakRun: "page-break-carrier";
|
|
21
|
+
readonly preservedXml: "preserved-xml-run";
|
|
20
22
|
readonly renderedPageBreak: "not-a-run";
|
|
21
23
|
readonly shape: "not-a-run";
|
|
22
24
|
readonly structuredField: "structured-field";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { decodeOoxmlSymbolCharacter } from "../utils/ooxmlSymbol.js";
|
|
2
|
-
import { expectFieldAttrs, expectSymbolAttrs } from "./attrs/index.js";
|
|
2
|
+
import { expectFieldAttrs, expectPreservedXmlAttrs, expectSymbolAttrs } from "./attrs/index.js";
|
|
3
3
|
import { panic } from "better-result";
|
|
4
4
|
import { Mark } from "prosemirror-model";
|
|
5
5
|
//#region src/prosemirror/runFormattingInlineCarriers.ts
|
|
@@ -13,11 +13,13 @@ import { Mark } from "prosemirror-model";
|
|
|
13
13
|
*/
|
|
14
14
|
const RUN_FORMATTING_INLINE_ATOM_DISPOSITIONS = Object.freeze({
|
|
15
15
|
bookmarkBoundary: "not-a-run",
|
|
16
|
+
commentReference: "not-a-run",
|
|
16
17
|
field: "field-run",
|
|
17
18
|
hardBreak: "break-run",
|
|
18
19
|
image: "not-a-run",
|
|
19
20
|
math: "not-a-run",
|
|
20
21
|
pageBreakRun: "page-break-carrier",
|
|
22
|
+
preservedXml: "preserved-xml-run",
|
|
21
23
|
renderedPageBreak: "not-a-run",
|
|
22
24
|
shape: "not-a-run",
|
|
23
25
|
structuredField: "structured-field",
|
|
@@ -32,6 +34,7 @@ const CONTROL_CHARACTER_BY_DISPOSITION = Object.freeze({
|
|
|
32
34
|
"field-run": null,
|
|
33
35
|
"not-a-run": null,
|
|
34
36
|
"page-break-carrier": null,
|
|
37
|
+
"preserved-xml-run": null,
|
|
35
38
|
"structured-field": null,
|
|
36
39
|
"symbol-run": null,
|
|
37
40
|
"tab-run": " ",
|
|
@@ -162,6 +165,7 @@ const runFormattingCarrierReviewText = (carrier) => {
|
|
|
162
165
|
const { char } = expectSymbolAttrs(carrier.node);
|
|
163
166
|
return decodeOoxmlSymbolCharacter(char) ?? "�";
|
|
164
167
|
}
|
|
168
|
+
case "preserved-xml-run": return expectPreservedXmlAttrs(carrier.node).text;
|
|
165
169
|
case "field-run":
|
|
166
170
|
case "structured-field": return expectFieldAttrs(carrier.node).displayText ?? carrier.node.textContent;
|
|
167
171
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "./marks.js";
|
|
2
|
-
import { BlockSdtAttrs, BookmarkBoundaryAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PageBreakRunAttrs, ParagraphAttrs, ParagraphPropertyChangeAttrs, SdtAttrs, ShapeAttrs, SymbolAttrs, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "./nodes.js";
|
|
1
|
+
import { CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RunFormattingOverrideAttrs, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, UnderlineAttrs } from "./marks.js";
|
|
2
|
+
import { BlockSdtAttrs, BookmarkBoundaryAttrs, FieldAttrs, HardBreakAttrs, ImageAttrs, ImagePositionAttrs, MathAttrs, PageBreakRunAttrs, ParagraphAttrs, ParagraphPropertyChangeAttrs, PreservedBlockAttrs, PreservedXmlAttrs, PreservedXmlLevel, SdtAttrs, ShapeAttrs, SymbolAttrs, TabAttrs, TableAttrs, TableCellAttrs, TableRowAttrs, TextBoxAttrs } from "./nodes.js";
|
|
3
3
|
import { ExtensionManager } from "../extensions/ExtensionManager.js";
|
|
4
4
|
//#region src/prosemirror/schema/index.d.ts
|
|
5
5
|
declare const singletonManager: ExtensionManager;
|
|
@@ -11,4 +11,4 @@ type DocxSchema = typeof schema;
|
|
|
11
11
|
type DocxNode = ReturnType<typeof schema.node>;
|
|
12
12
|
type DocxMark = ReturnType<typeof schema.mark>;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { type BlockSdtAttrs, type BookmarkBoundaryAttrs, type CharacterSpacingAttrs, type CharacterStyleAttrs, type CommentAttrs, DocxMark, DocxNode, DocxSchema, type EmphasisMarkAttrs, type FieldAttrs, type FontFamilyAttrs, type FontSizeAttrs, type FootnoteRefAttrs, type HardBreakAttrs, type HighlightAttrs, type HyperlinkAttrs, type ImageAttrs, type ImagePositionAttrs, type LanguageAttrs, type MathAttrs, type PageBreakRunAttrs, type PageBreakRunOwnerMarkAttrs, type ParagraphAttrs, type ParagraphPropertyChangeAttrs, type RunFormattingOverrideAttrs, type RunPropertyChangeMarkAttrs, type RunShadingAttrs, type SdtAttrs, type ShapeAttrs, type StrikeAttrs, type SymbolAttrs, type TabAttrs, type TableAttrs, type TableCellAttrs, type TableRowAttrs, type TextBoxAttrs, type TextColorAttrs, type TextEffectAttrs, type TrackedChangeMarkAttrs, type UnderlineAttrs, schema, singletonManager };
|
|
14
|
+
export { type BlockSdtAttrs, type BookmarkBoundaryAttrs, type CharacterSpacingAttrs, type CharacterStyleAttrs, type CommentAttrs, DocxMark, DocxNode, DocxSchema, type EmphasisMarkAttrs, type FieldAttrs, type FontFamilyAttrs, type FontSizeAttrs, type FootnoteRefAttrs, type HardBreakAttrs, type HighlightAttrs, type HyperlinkAttrs, type ImageAttrs, type ImagePositionAttrs, type InlineWrapperAttrs, type InlineWrapperKind, type InlineWrapperLayer, type LanguageAttrs, type MathAttrs, type PageBreakRunAttrs, type PageBreakRunOwnerMarkAttrs, type ParagraphAttrs, type ParagraphPropertyChangeAttrs, type PreservedBlockAttrs, type PreservedXmlAttrs, type PreservedXmlLevel, type RunFormattingOverrideAttrs, type RunPropertyChangeMarkAttrs, type RunShadingAttrs, type SdtAttrs, type ShapeAttrs, type StrikeAttrs, type SymbolAttrs, type TabAttrs, type TableAttrs, type TableCellAttrs, type TableRowAttrs, type TextBoxAttrs, type TextColorAttrs, type TextEffectAttrs, type TrackedChangeMarkAttrs, type UnderlineAttrs, schema, singletonManager };
|
|
@@ -127,6 +127,30 @@ type RunPropertyChangeMarkAttrs = {
|
|
|
127
127
|
type PageBreakRunOwnerMarkAttrs = {
|
|
128
128
|
id: number;
|
|
129
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* One transparent wrapper a leaf sits inside, minus the content ProseMirror
|
|
132
|
+
* now holds instead.
|
|
133
|
+
*
|
|
134
|
+
* Distributed over the model's union rather than written out beside it: a
|
|
135
|
+
* wrapper kind exists in both places or in neither, and the fields a kind
|
|
136
|
+
* carries are stated once. A smart tag cannot gain a `control` this way, and
|
|
137
|
+
* a kind added to the model reaches the editor as a compile error at every
|
|
138
|
+
* site that decides per kind.
|
|
139
|
+
*/
|
|
140
|
+
type WrapperLayer<Wrapper> = Wrapper extends unknown ? Omit<Wrapper, "type" | "content"> : never;
|
|
141
|
+
type InlineWrapperLayer = WrapperLayer<document_d_exports.InlineWrapper>;
|
|
142
|
+
type InlineWrapperKind = InlineWrapperLayer["kind"];
|
|
143
|
+
/**
|
|
144
|
+
* The wrappers a leaf sits inside, outermost first.
|
|
145
|
+
*
|
|
146
|
+
* Multiplicity lives here rather than in the mark set: ProseMirror marks are
|
|
147
|
+
* unordered across types and a mark excludes its own type, so nesting a
|
|
148
|
+
* wrapper inside another cannot be spelled as two marks. `null` is no
|
|
149
|
+
* wrapper; an empty stack is never stored.
|
|
150
|
+
*/
|
|
151
|
+
type InlineWrapperAttrs = {
|
|
152
|
+
stack: readonly InlineWrapperLayer[];
|
|
153
|
+
};
|
|
130
154
|
declare const COMPLEX_SCRIPT_RUN_PROPERTY_KEYS: readonly ["boldCs", "italicCs", "fontSizeCs"];
|
|
131
155
|
type ComplexScriptRunPropertyKey = (typeof COMPLEX_SCRIPT_RUN_PROPERTY_KEYS)[number];
|
|
132
156
|
declare const RUN_FORMATTING_BOOLEAN_PROPERTIES: readonly ["bold", "boldCs", "italic", "italicCs", "strike", "doubleStrike", "smallCaps", "allCaps", "hidden", "noProof", "emboss", "imprint", "outline", "shadow", "rtl", "cs"];
|
|
@@ -231,4 +255,4 @@ type HyperlinkAttrs = {
|
|
|
231
255
|
_docxHyperlinkIndex?: number;
|
|
232
256
|
};
|
|
233
257
|
//#endregion
|
|
234
|
-
export { AuthoredRunFormattingValues, COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, ComplexScriptRunPropertyKey, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_PROPERTY_SPECS, RUN_FORMATTING_VALUE_PROPERTIES, RunFormattingBooleanProperty, RunFormattingOverrideAttrs, RunFormattingValueProperty, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TRACKED_CHANGE_PROVENANCE_VALUES, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, TrackedChangeProvenance, UnderlineAttrs };
|
|
258
|
+
export { AuthoredRunFormattingValues, COMPLEX_SCRIPT_RUN_PROPERTY_KEYS, CharacterSpacingAttrs, CharacterStyleAttrs, CommentAttrs, ComplexScriptRunPropertyKey, EmphasisMarkAttrs, FontFamilyAttrs, FontSizeAttrs, FootnoteRefAttrs, HighlightAttrs, HyperlinkAttrs, InlineWrapperAttrs, InlineWrapperKind, InlineWrapperLayer, LanguageAttrs, PageBreakRunOwnerMarkAttrs, RUN_FORMATTING_BOOLEAN_PROPERTIES, RUN_FORMATTING_PROPERTY_SPECS, RUN_FORMATTING_VALUE_PROPERTIES, RunFormattingBooleanProperty, RunFormattingOverrideAttrs, RunFormattingValueProperty, RunPropertyChangeMarkAttrs, RunShadingAttrs, StrikeAttrs, TRACKED_CHANGE_PROVENANCE_VALUES, TextColorAttrs, TextEffectAttrs, TrackedChangeMarkAttrs, TrackedChangeProvenance, UnderlineAttrs };
|