@stll/folio-core 0.54.2 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-edits/apply.js +22 -1
- package/dist/ai-edits/headless.js +1 -0
- package/dist/compare/content-types.d.ts +3 -15
- package/dist/controller/canonicalComposition.d.ts +36 -0
- package/dist/controller/canonicalComposition.js +168 -0
- package/dist/controller/canonicalInput.d.ts +45 -0
- package/dist/controller/canonicalInput.js +338 -0
- package/dist/controller/canonicalOperations.d.ts +22 -0
- package/dist/controller/canonicalOperations.js +85 -0
- package/dist/controller/canonicalReview.d.ts +12 -0
- package/dist/controller/canonicalReview.js +19 -0
- package/dist/controller/canonicalSession.d.ts +149 -0
- package/dist/controller/canonicalSession.js +1038 -0
- package/dist/controller/canonicalStoryEditor.d.ts +34 -0
- package/dist/controller/canonicalStoryEditor.js +82 -0
- package/dist/controller/canonicalStructure.d.ts +16 -0
- package/dist/controller/canonicalStructure.js +269 -0
- package/dist/controller/folioEditor.d.ts +1 -1
- package/dist/controller/folioEditor.js +9 -0
- package/dist/controller/headerFooterEditorManager.d.ts +4 -0
- package/dist/controller/headerFooterEditorManager.js +71 -3
- package/dist/controller/hiddenEditorApi.d.ts +35 -0
- package/dist/controller/hiddenEditorApi.js +25 -8
- package/dist/controller/hiddenEditorManager.d.ts +11 -2
- package/dist/controller/hiddenEditorManager.js +456 -30
- package/dist/controller/layoutPipeline.d.ts +1 -1
- package/dist/controller/layoutPipeline.js +2 -0
- package/dist/controller/noteEditorManager.d.ts +4 -0
- package/dist/controller/noteEditorManager.js +113 -15
- package/dist/docx/attributeRemainder.js +1 -0
- package/dist/docx/canonicalSessionInput.d.ts +11 -0
- package/dist/docx/canonicalSessionInput.js +27 -0
- package/dist/docx/canonicalStoryRepack.d.ts +10 -0
- package/dist/docx/canonicalStoryRepack.js +41 -0
- package/dist/docx/contentTypeRegistry.d.ts +8 -0
- package/dist/docx/contentTypeRegistry.js +64 -0
- package/dist/docx/ensureParaIds.d.ts +7 -1
- package/dist/docx/ensureParaIds.js +163 -211
- package/dist/docx/foldedListNumberFields.d.ts +85 -0
- package/dist/docx/foldedListNumberFields.js +267 -0
- package/dist/docx/headerFooterVerbatim.d.ts +14 -1
- package/dist/docx/headerFooterVerbatim.js +95 -2
- package/dist/docx/noteIds.d.ts +5 -0
- package/dist/docx/noteIds.js +6 -2
- package/dist/docx/noteReferenceMark.d.ts +3 -1
- package/dist/docx/noteReferenceMark.js +15 -14
- package/dist/docx/numberingParser.d.ts +3 -1
- package/dist/docx/numberingParser.js +17 -3
- package/dist/docx/packageParts.d.ts +3 -1
- package/dist/docx/packageParts.js +65 -16
- package/dist/docx/paragraphMarkPropertyPresence.d.ts +9 -0
- package/dist/docx/paragraphMarkPropertyPresence.js +21 -0
- package/dist/docx/paragraphParser.js +101 -53
- package/dist/docx/paragraphPropertySource.d.ts +15 -1
- package/dist/docx/paragraphPropertySource.js +76 -22
- package/dist/docx/parser.js +2 -1
- package/dist/docx/reviewHistoryNamespace.d.ts +4 -0
- package/dist/docx/reviewHistoryNamespace.js +4 -0
- package/dist/docx/reviewResolutionProvenance.d.ts +25 -0
- package/dist/docx/reviewResolutionProvenance.js +153 -0
- package/dist/docx/rezip.d.ts +7 -3
- package/dist/docx/rezip.js +107 -45
- package/dist/docx/runConsolidator.d.ts +2 -58
- package/dist/docx/runConsolidator.js +3 -175
- package/dist/docx/runParser.d.ts +2 -1
- package/dist/docx/runParser.js +156 -116
- package/dist/docx/saveDiagnostics.d.ts +11 -0
- package/dist/docx/saveDiagnostics.js +0 -0
- package/dist/docx/selectiveSave.d.ts +2 -1
- package/dist/docx/selectiveSave.js +4 -1
- package/dist/docx/selectiveXmlPatch.d.ts +16 -8
- package/dist/docx/selectiveXmlPatch.js +74 -2
- package/dist/docx/serializer/headerFooterSerializer.d.ts +5 -1
- package/dist/docx/serializer/headerFooterSerializer.js +19 -11
- package/dist/docx/serializer/noteSerializer.d.ts +2 -2
- package/dist/docx/serializer/noteSerializer.js +24 -8
- package/dist/docx/serializer/paragraphSerializer.js +41 -4
- package/dist/docx/serializer/partNamespaces.js +2 -1
- package/dist/docx/serializer/runSerializer.js +3 -1
- package/dist/docx/settingsHeaderFooterUpdate.d.ts +5 -0
- package/dist/docx/settingsHeaderFooterUpdate.js +90 -0
- package/dist/docx/settingsParser.d.ts +1 -2
- package/dist/docx/settingsParser.js +5 -6
- package/dist/docx/storyBlockReplay.d.ts +11 -0
- package/dist/docx/storyBlockReplay.js +367 -0
- package/dist/docx/streamingXmlParser.d.ts +22 -1
- package/dist/docx/streamingXmlParser.js +49 -3
- package/dist/docx/structuralXmlPatch.js +8 -1
- package/dist/docx/verbatimCapture.d.ts +3 -1
- package/dist/docx/verbatimCapture.js +49 -6
- package/dist/i18n/messages/ar.gen.d.ts +5 -0
- package/dist/i18n/messages/ar.gen.js +656 -0
- package/dist/i18n/messages/cs.gen.d.ts +5 -0
- package/dist/i18n/messages/cs.gen.js +656 -0
- package/dist/i18n/messages/de.gen.d.ts +5 -0
- package/dist/i18n/messages/de.gen.js +656 -0
- package/dist/i18n/messages/en.gen.d.ts +5 -0
- package/dist/i18n/messages/en.gen.js +656 -0
- package/dist/i18n/messages/es.gen.d.ts +5 -0
- package/dist/i18n/messages/es.gen.js +656 -0
- package/dist/i18n/messages/et.gen.d.ts +5 -0
- package/dist/i18n/messages/et.gen.js +656 -0
- package/dist/i18n/messages/fr.gen.d.ts +5 -0
- package/dist/i18n/messages/fr.gen.js +656 -0
- package/dist/i18n/messages/he.gen.d.ts +5 -0
- package/dist/i18n/messages/he.gen.js +656 -0
- package/dist/i18n/messages/hi.gen.d.ts +5 -0
- package/dist/i18n/messages/hi.gen.js +656 -0
- package/dist/i18n/messages/hu.gen.d.ts +5 -0
- package/dist/i18n/messages/hu.gen.js +656 -0
- package/dist/i18n/messages/locales.d.ts +5 -0
- package/dist/i18n/messages/locales.js +22 -0
- package/dist/i18n/messages/lt.gen.d.ts +5 -0
- package/dist/i18n/messages/lt.gen.js +656 -0
- package/dist/i18n/messages/lv.gen.d.ts +5 -0
- package/dist/i18n/messages/lv.gen.js +656 -0
- package/dist/i18n/messages/pl.gen.d.ts +5 -0
- package/dist/i18n/messages/pl.gen.js +656 -0
- package/dist/i18n/messages/pt-BR.gen.d.ts +5 -0
- package/dist/i18n/messages/pt-BR.gen.js +656 -0
- package/dist/i18n/messages/sk.gen.d.ts +5 -0
- package/dist/i18n/messages/sk.gen.js +656 -0
- package/dist/i18n/messages/tr.gen.d.ts +5 -0
- package/dist/i18n/messages/tr.gen.js +656 -0
- package/dist/i18n/messages/zh-CN.gen.d.ts +5 -0
- package/dist/i18n/messages/zh-CN.gen.js +656 -0
- package/dist/i18n/messages.d.ts +2 -3
- package/dist/i18n/messages.js +1 -19
- package/dist/internal/noteMarkerAttrs.d.ts +8 -0
- package/dist/internal/noteMarkerAttrs.js +16 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +1 -0
- package/dist/internal/prosemirrorAttrBoundary.d.ts +21 -0
- package/dist/internal/prosemirrorAttrBoundary.js +50 -0
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/footnoteLayout.js +3 -3
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +1 -0
- package/dist/layout-bridge/convert/headerFooterLayout.js +1 -0
- package/dist/layout-bridge/convert/noteReferences.d.ts +1 -3
- package/dist/layout-bridge/convert/noteReferences.js +1 -6
- package/dist/layout-bridge/convert/paragraphRuns.js +2 -4
- package/dist/layout-bridge/convert/toFlowBlocks.d.ts +2 -2
- package/dist/layout-bridge/convert/toFlowBlocks.js +2 -2
- package/dist/managers/DocumentLoaderManager.d.ts +1 -0
- package/dist/managers/DocumentLoaderManager.js +8 -1
- package/dist/markdown/renderBlock.js +15 -1
- package/dist/markdown/renderParagraph.js +9 -13
- package/dist/markdown/renderRuns.js +3 -2
- package/dist/markdown/renderTable.js +2 -0
- package/dist/markdown/types.d.ts +3 -9
- package/dist/prosemirror/attrs/index.d.ts +2 -12
- package/dist/prosemirror/attrs/index.js +22 -48
- package/dist/prosemirror/bookmarkBoundaryAttrs.d.ts +2 -1
- package/dist/prosemirror/canonicalCommands.d.ts +97 -0
- package/dist/prosemirror/canonicalCommands.js +28 -0
- package/dist/prosemirror/commands/pageBreak.js +15 -1
- package/dist/prosemirror/commentReferenceAttrs.d.ts +2 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +91 -19
- package/dist/prosemirror/conversion/listRenderingDefinition.d.ts +6 -0
- package/dist/prosemirror/conversion/listRenderingDefinition.js +97 -0
- package/dist/prosemirror/conversion/toProseDoc.d.ts +4 -3
- package/dist/prosemirror/conversion/toProseDoc.js +51 -11
- package/dist/prosemirror/executeEditorCommand.d.ts +11 -0
- package/dist/prosemirror/executeEditorCommand.js +26 -0
- package/dist/prosemirror/extensions/StarterKit.js +2 -0
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +50 -19
- package/dist/prosemirror/extensions/features/ListExtension.js +18 -5
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +5 -2
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +13 -1
- package/dist/prosemirror/extensions/marks/TextColorExtension.js +3 -2
- package/dist/prosemirror/extensions/marks/TrackedChangeExtensions.js +2 -0
- package/dist/prosemirror/extensions/marks/markUtils.js +70 -8
- package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/nodes/NoteMarkerExtension.js +36 -0
- package/dist/prosemirror/extensions/nodes/PreservedXmlExtension.js +4 -2
- package/dist/prosemirror/listMarker.d.ts +1 -0
- package/dist/prosemirror/listMarker.js +16 -7
- package/dist/prosemirror/listNumbering.js +26 -5
- package/dist/prosemirror/listRenderingAttrs.d.ts +1 -0
- package/dist/prosemirror/listRenderingAttrs.js +3 -0
- package/dist/prosemirror/markupViewNotes.js +3 -2
- package/dist/prosemirror/moveRangeBoundaryAttrs.d.ts +2 -1
- package/dist/prosemirror/noteReferenceReview.js +5 -3
- package/dist/prosemirror/plugins/suggestionMode.js +50 -2
- package/dist/prosemirror/rangeAnchorAttrs.d.ts +2 -1
- package/dist/prosemirror/runFormattingFromMarks.d.ts +4 -1
- package/dist/prosemirror/runFormattingFromMarks.js +15 -1
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +2 -1
- package/dist/prosemirror/runFormattingInlineCarriers.js +4 -1
- package/dist/prosemirror/schema/marks.d.ts +2 -0
- package/dist/prosemirror/schema/nodes.d.ts +10 -2
- package/dist/prosemirror/textBoxAnchorAttrs.d.ts +2 -1
- package/dist/prosemirror/textInput.js +5 -1
- package/dist/prosemirror/trackedRevisionPath.js +2 -1
- package/dist/prosemirror/trackedRunInlineAtoms.d.ts +1 -0
- package/dist/prosemirror/trackedRunInlineAtoms.js +1 -0
- package/dist/prosemirror/validation.js +4 -0
- package/dist/types/content.d.ts +2 -2
- package/dist/utils/createDocument.js +2 -2
- package/package.json +14 -2
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Result } from "better-result";
|
|
2
2
|
//#region src/docx/packageParts.ts
|
|
3
|
+
/**
|
|
4
|
+
* What a repack carries out of the source package, and the guarantee that
|
|
5
|
+
* nothing in the output points at a part the output does not hold.
|
|
6
|
+
*
|
|
7
|
+
* A `.docx` is an OPC package: `[Content_Types].xml` declares every part in it
|
|
8
|
+
* and the `.rels` parts wire them together. Folio models a handful of those
|
|
9
|
+
* parts (the document body, headers, footers, notes, numbering, styles,
|
|
10
|
+
* comments) and rewrites them on save. Everything else — embedded objects,
|
|
11
|
+
* media, custom XML, fonts, charts, macro projects, parts folio has never heard
|
|
12
|
+
* of — belongs to the author, and a repack hands it back byte for byte.
|
|
13
|
+
*
|
|
14
|
+
* Folio never executes document content and never removes it. The document is
|
|
15
|
+
* the user's; the only thing a save refuses is a package path that would let
|
|
16
|
+
* the archive escape its own directory when a host writes it out, which is a
|
|
17
|
+
* property of the package structure rather than of the content. A macro-enabled
|
|
18
|
+
* document therefore stays macro-enabled, main-part content type included:
|
|
19
|
+
* silently handing back a `.docm` stripped of its project is data loss dressed
|
|
20
|
+
* up as safety.
|
|
21
|
+
*
|
|
22
|
+
* A refused path loses its relationships and its content-type override with it.
|
|
23
|
+
* That is the invariant this module exists for: Word and LibreOffice both
|
|
24
|
+
* refuse a package whose `document.xml.rels` points at nothing, so a repack
|
|
25
|
+
* that removes a part without removing its references produces a file that
|
|
26
|
+
* does not open.
|
|
27
|
+
*/
|
|
3
28
|
const CONTENT_TYPE_ELEMENT = /<(?:Default|Override)\b[^>]*?\/?>/giu;
|
|
4
29
|
const PART_NAME_ATTRIBUTE = /\bPartName\s*=\s*(?<quote>["'])(?<value>[^"']*)\k<quote>/u;
|
|
5
30
|
const RELATIONSHIP_ELEMENT = /<Relationship\b[^>]*?(?:\/>|>\s*<\/Relationship>)/giu;
|
|
@@ -24,12 +49,38 @@ const owningPartPath = (relsPath) => {
|
|
|
24
49
|
};
|
|
25
50
|
/** Normalize a package path for comparison: lower case, no leading slash. */
|
|
26
51
|
const normalizePartPath = (path) => (path.startsWith("/") ? path.slice(1) : path).toLowerCase();
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
/** Decode URI escapes as UTF-8; malformed references cannot name a part. */
|
|
53
|
+
const decodePartName = (name) => {
|
|
54
|
+
const decoded = Result.try({
|
|
55
|
+
try: () => decodeURIComponent(name),
|
|
56
|
+
catch: () => void 0
|
|
57
|
+
});
|
|
58
|
+
return decoded.isOk() ? decoded.value : void 0;
|
|
59
|
+
};
|
|
60
|
+
/** Resolve an internal URI reference once, before comparing it with ZIP entries. */
|
|
61
|
+
const resolvePackageRelationshipTarget = (target, relsPath) => {
|
|
62
|
+
const fragment = target.indexOf("#");
|
|
63
|
+
if (fragment === 0) {
|
|
64
|
+
const owner = owningPartPath(relsPath);
|
|
65
|
+
return owner === void 0 ? void 0 : normalizePartPath(owner);
|
|
66
|
+
}
|
|
67
|
+
const reference = fragment > 0 ? target.slice(0, fragment) : target;
|
|
68
|
+
if (!reference || reference.startsWith("//") || /[\\?:]/u.test(reference)) return void 0;
|
|
69
|
+
const owner = owningPartPath(relsPath);
|
|
70
|
+
const segments = reference.startsWith("/") || owner === void 0 ? [] : owner.split("/").slice(0, -1);
|
|
71
|
+
for (const encoded of reference.split("/")) {
|
|
72
|
+
const segment = decodePartName(encoded);
|
|
73
|
+
if (segment === void 0 || /[/\\]/u.test(segment) || segment.includes(String.fromCharCode(0))) return void 0;
|
|
74
|
+
if (segment === "" || segment === ".") continue;
|
|
75
|
+
if (segment === "..") {
|
|
76
|
+
if (segments.pop() === void 0) return void 0;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
segments.push(segment);
|
|
80
|
+
}
|
|
81
|
+
const path = normalizePartPath(segments.join("/"));
|
|
82
|
+
return isUnsafePackagePath(path) ? void 0 : path;
|
|
83
|
+
};
|
|
33
84
|
/**
|
|
34
85
|
* Whether an entry path would escape the package when a host writes the archive
|
|
35
86
|
* to disk: absolute, backslash-separated, or climbing out through `..`. This is
|
|
@@ -53,15 +104,13 @@ const presentPartPaths = (zip) => {
|
|
|
53
104
|
for (const [path, file] of Object.entries(zip.files)) if (!file.dir) present.add(normalizePartPath(path));
|
|
54
105
|
return present;
|
|
55
106
|
};
|
|
56
|
-
const isPresent = (present, partPath) => present.has(normalizePartPath(partPath)) || present.has(normalizePartPath(decodePartName(partPath)));
|
|
107
|
+
const isPresent = (present, partPath) => present.has(normalizePartPath(partPath)) || present.has(normalizePartPath(decodePartName(partPath) ?? ""));
|
|
57
108
|
/** The part a relationship names, or null when it points outside the package. */
|
|
58
109
|
const relationshipTarget = (element, relsPath) => {
|
|
59
110
|
if (TARGET_MODE_ATTRIBUTE.exec(element)?.groups?.["value"] === "External") return null;
|
|
60
111
|
const target = TARGET_ATTRIBUTE.exec(element)?.groups?.["value"];
|
|
61
112
|
if (target === void 0) return null;
|
|
62
|
-
|
|
63
|
-
if (fragment === 0) return owningPartPath(relsPath) ?? "";
|
|
64
|
-
return resolveRelativePath(relsPath, fragment > 0 ? target.slice(0, fragment) : target);
|
|
113
|
+
return resolvePackageRelationshipTarget(target, relsPath) ?? "";
|
|
65
114
|
};
|
|
66
115
|
/**
|
|
67
116
|
* Every `.rels` part with its text. Read one at a time rather than through
|
|
@@ -107,8 +156,8 @@ const reconcilePackageReferences = async (zip, compressionLevel) => {
|
|
|
107
156
|
let dropped = false;
|
|
108
157
|
const pruned = xml.replaceAll(RELATIONSHIP_ELEMENT, (element) => {
|
|
109
158
|
const target = relationshipTarget(element, path);
|
|
110
|
-
if (target === null ||
|
|
111
|
-
repair.danglingRelationships.push(target);
|
|
159
|
+
if (target === null || present.has(target)) return element;
|
|
160
|
+
repair.danglingRelationships.push(target || TARGET_ATTRIBUTE.exec(element)?.groups?.["value"] || "");
|
|
112
161
|
dropped = true;
|
|
113
162
|
const id = RELATIONSHIP_ID_ATTRIBUTE.exec(element)?.groups?.["value"];
|
|
114
163
|
const owningPart = owningPartPath(path);
|
|
@@ -154,7 +203,7 @@ const reconcilePackageReferences = async (zip, compressionLevel) => {
|
|
|
154
203
|
const prunedContentTypes = (await contentTypes.async("text")).replaceAll(CONTENT_TYPE_ELEMENT, (element) => {
|
|
155
204
|
const partName = PART_NAME_ATTRIBUTE.exec(element)?.groups?.["value"];
|
|
156
205
|
if (partName === void 0 || isPresent(present, partName)) return element;
|
|
157
|
-
repair.danglingOverrides.push(normalizePartPath(decodePartName(partName)));
|
|
206
|
+
repair.danglingOverrides.push(normalizePartPath(decodePartName(partName) ?? partName));
|
|
158
207
|
droppedOverride = true;
|
|
159
208
|
return "";
|
|
160
209
|
});
|
|
@@ -195,7 +244,7 @@ const checkPackageIntegrity = async (zip) => {
|
|
|
195
244
|
const id = RELATIONSHIP_ID_ATTRIBUTE.exec(element)?.groups?.["value"];
|
|
196
245
|
if (id !== void 0) ids.add(id);
|
|
197
246
|
const target = relationshipTarget(element, path);
|
|
198
|
-
if (target !== null && !
|
|
247
|
+
if (target !== null && !present.has(target)) report.danglingRelationshipTargets.push(`${path}|${target || TARGET_ATTRIBUTE.exec(element)?.groups?.["value"] || ""}`);
|
|
199
248
|
}
|
|
200
249
|
if (owningPart !== void 0) idsByOwningPart.set(owningPart, ids);
|
|
201
250
|
}
|
|
@@ -211,4 +260,4 @@ const checkPackageIntegrity = async (zip) => {
|
|
|
211
260
|
return report;
|
|
212
261
|
};
|
|
213
262
|
//#endregion
|
|
214
|
-
export { checkPackageIntegrity, isUnsafePackagePath, reconcilePackageReferences, removeUnsafeEntries };
|
|
263
|
+
export { checkPackageIntegrity, isUnsafePackagePath, reconcilePackageReferences, removeUnsafeEntries, resolvePackageRelationshipTarget };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { document_d_exports } from "../types/document.js";
|
|
2
|
+
import { XmlElement } from "./xmlParser.js";
|
|
3
|
+
//#region src/docx/paragraphMarkPropertyPresence.d.ts
|
|
4
|
+
declare const EMPTY_MARK_PROPERTIES_ATTRIBUTE = "emptyMarkProperties";
|
|
5
|
+
/** A paragraph-owned rPr carrier cannot distinguish absent and explicitly empty formatting. */
|
|
6
|
+
declare const serializeEmptyMarkProperties: (paragraph: document_d_exports.Paragraph) => string | undefined;
|
|
7
|
+
declare const restoreEmptyMarkProperties: (paragraph: document_d_exports.Paragraph, element: XmlElement) => void;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { EMPTY_MARK_PROPERTIES_ATTRIBUTE, restoreEmptyMarkProperties, serializeEmptyMarkProperties };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OOXML_NAMESPACES } from "./serializer/partNamespaces.js";
|
|
2
|
+
import { getAttributeByNamespaceUri } from "./xmlParser.js";
|
|
3
|
+
import { EMPTY_PROPERTY_SETS } from "@stll/docx-core/ops";
|
|
4
|
+
//#region src/docx/paragraphMarkPropertyPresence.ts
|
|
5
|
+
const EMPTY_MARK_PROPERTIES_ATTRIBUTE = "emptyMarkProperties";
|
|
6
|
+
const REVIEW_HISTORY_NAMESPACES = /* @__PURE__ */ new Set([OOXML_NAMESPACES.folio.uri]);
|
|
7
|
+
/** A paragraph-owned rPr carrier cannot distinguish absent and explicitly empty formatting. */
|
|
8
|
+
const serializeEmptyMarkProperties = (paragraph) => {
|
|
9
|
+
const properties = paragraph.formatting?.runProperties;
|
|
10
|
+
if (!(paragraph.pPrMark !== void 0 || paragraph.formatting?.runInWithNext !== void 0) || properties === void 0 || Object.keys(properties).length !== 0) return void 0;
|
|
11
|
+
return `folio:${EMPTY_MARK_PROPERTIES_ATTRIBUTE}="${EMPTY_PROPERTY_SETS.KEEP}"`;
|
|
12
|
+
};
|
|
13
|
+
const restoreEmptyMarkProperties = (paragraph, element) => {
|
|
14
|
+
if (paragraph.pPrMark === void 0 && paragraph.formatting?.runInWithNext === void 0 || getAttributeByNamespaceUri(element, REVIEW_HISTORY_NAMESPACES, "emptyMarkProperties") !== EMPTY_PROPERTY_SETS.KEEP || paragraph.formatting?.runProperties !== void 0) return;
|
|
15
|
+
paragraph.formatting = {
|
|
16
|
+
...paragraph.formatting,
|
|
17
|
+
runProperties: {}
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { EMPTY_MARK_PROPERTIES_ATTRIBUTE, restoreEmptyMarkProperties, serializeEmptyMarkProperties };
|
|
@@ -5,6 +5,7 @@ import { CAPTURE, dispatchChildrenWithContext, ownedElsewhere, transitionalNames
|
|
|
5
5
|
import { resolveDefaultParagraphStyle } from "./defaultParagraphStyle.js";
|
|
6
6
|
import { parseFieldType } from "./fieldParser.js";
|
|
7
7
|
import { fieldStateOf, parseFieldState } from "./fieldState.js";
|
|
8
|
+
import { foldListNumberFields, isListNumberField, isListNumberGapMarker, isTabOnlyRun } from "./foldedListNumberFields.js";
|
|
8
9
|
import { HYPERLINK_CHILD_HANDLERS, parseHyperlink as parseHyperlink$1, parseHyperlinkShell } from "./hyperlinkParser.js";
|
|
9
10
|
import { isHyperlinkContent, isInlineSdtContent, isTrackedChangeWrapperChild } from "./inlineWrapperContent.js";
|
|
10
11
|
import { inlineWrapperOf } from "./inlineWrapperParser.js";
|
|
@@ -13,10 +14,13 @@ import { counterFormatOf, markerAlignmentForLevel, markerFormattingFromLevel, nu
|
|
|
13
14
|
import { mergeParagraphNumbering as mergeParagraphNumbering$1, paragraphNumberingReferenceId as paragraphNumberingReferenceId$1, resolveParagraphNumbering as resolveParagraphNumbering$1 } from "./numberingReference.js";
|
|
14
15
|
import { paraIdAttribute, textIdAttribute } from "./paraIdAttribute.js";
|
|
15
16
|
import { paraIdInRange } from "./paraIdRangeNormalization.js";
|
|
17
|
+
import { EMPTY_MARK_PROPERTIES_ATTRIBUTE, restoreEmptyMarkProperties } from "./paragraphMarkPropertyPresence.js";
|
|
16
18
|
import { parseParagraphProperties } from "./paragraphProperties.js";
|
|
17
19
|
import { assignParagraphPropertySource } from "./paragraphPropertySource.js";
|
|
18
20
|
import { preserveInlineChild, preserveRunChild, preservedInlineCapture } from "./preservedRunContent.js";
|
|
19
21
|
import { standalonePreviewLedger } from "./previewBudget.js";
|
|
22
|
+
import { FOLIO_REVIEW_HISTORY_NAMESPACE } from "./reviewHistoryNamespace.js";
|
|
23
|
+
import { ReviewResolutionProvenanceError, parseParagraphMarkResolutionJoin, parseResolutionJoins } from "./reviewResolutionProvenance.js";
|
|
20
24
|
import { consolidateParagraphContent } from "./runConsolidator.js";
|
|
21
25
|
import { parseRun } from "./runParser.js";
|
|
22
26
|
import { runHoldsPayload } from "./runPayload.js";
|
|
@@ -31,15 +35,10 @@ import { WORDPROCESSINGML_NAMESPACE_URIS, cloneElement, findChild, findChildByNa
|
|
|
31
35
|
import { panic } from "better-result";
|
|
32
36
|
import { PARAGRAPH_MARK_CHANGE_KINDS, REVIEW_CARRIERS } from "@stll/docx-core/model";
|
|
33
37
|
//#region src/docx/paragraphParser.ts
|
|
34
|
-
const FOLIO_REVIEW_HISTORY_NAMESPACES = /* @__PURE__ */ new Set([
|
|
38
|
+
const FOLIO_REVIEW_HISTORY_NAMESPACES = /* @__PURE__ */ new Set([FOLIO_REVIEW_HISTORY_NAMESPACE]);
|
|
35
39
|
/**
|
|
36
40
|
* Extract plain text from a math element (recursive text content extraction)
|
|
37
41
|
*/
|
|
38
|
-
function extractPlainText(runs) {
|
|
39
|
-
let out = "";
|
|
40
|
-
for (const run of runs) for (const c of run.content) if (c.type === "text") out += c.text;
|
|
41
|
-
return out;
|
|
42
|
-
}
|
|
43
42
|
function extractMathText(el) {
|
|
44
43
|
let text = "";
|
|
45
44
|
if (el.type === "text" && typeof el.text === "string") return el.text;
|
|
@@ -200,17 +199,20 @@ function parseParagraphMarkChange(pPr) {
|
|
|
200
199
|
const element = findChildByNamespaceUri(rPr, WORDPROCESSINGML_NAMESPACE_URIS, kind);
|
|
201
200
|
if (element) return {
|
|
202
201
|
kind,
|
|
203
|
-
info: parseTrackedChangeInfo(element)
|
|
202
|
+
info: parseTrackedChangeInfo(element),
|
|
203
|
+
...parseParagraphMarkResolutionJoin(element)
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function pushTrackedChangeWrapper({ contents, type, info, content, preserveEmpty = false }) {
|
|
207
|
+
function pushTrackedChangeWrapper({ contents, type, info, resolutionJoins, content, preserveEmpty = false }) {
|
|
208
208
|
if (content.length === 0 && !preserveEmpty) return;
|
|
209
|
+
const provenance = resolutionJoins === void 0 ? {} : { resolutionJoins };
|
|
209
210
|
if (type === "insertion") {
|
|
210
211
|
contents.push({
|
|
211
212
|
type: "insertion",
|
|
212
213
|
info,
|
|
213
|
-
content: [...content]
|
|
214
|
+
content: [...content],
|
|
215
|
+
...provenance
|
|
214
216
|
});
|
|
215
217
|
return;
|
|
216
218
|
}
|
|
@@ -218,7 +220,8 @@ function pushTrackedChangeWrapper({ contents, type, info, content, preserveEmpty
|
|
|
218
220
|
contents.push({
|
|
219
221
|
type: "deletion",
|
|
220
222
|
info,
|
|
221
|
-
content: [...content]
|
|
223
|
+
content: [...content],
|
|
224
|
+
...provenance
|
|
222
225
|
});
|
|
223
226
|
return;
|
|
224
227
|
}
|
|
@@ -226,22 +229,30 @@ function pushTrackedChangeWrapper({ contents, type, info, content, preserveEmpty
|
|
|
226
229
|
contents.push({
|
|
227
230
|
type: "moveFrom",
|
|
228
231
|
info,
|
|
229
|
-
content: [...content]
|
|
232
|
+
content: [...content],
|
|
233
|
+
...provenance
|
|
230
234
|
});
|
|
231
235
|
return;
|
|
232
236
|
}
|
|
233
237
|
contents.push({
|
|
234
238
|
type: "moveTo",
|
|
235
239
|
info,
|
|
236
|
-
content: [...content]
|
|
240
|
+
content: [...content],
|
|
241
|
+
...provenance
|
|
237
242
|
});
|
|
238
243
|
}
|
|
239
|
-
function pushTrackedChangeSegments({ contents, type, info, parsedContent }) {
|
|
244
|
+
function pushTrackedChangeSegments({ contents, type, info, resolutionJoins, parsedContent }) {
|
|
245
|
+
if (resolutionJoins !== void 0 && parsedContent.some((item) => !isTrackedChangeWrapperChild(item))) throw new ReviewResolutionProvenanceError({
|
|
246
|
+
attribute: "resolutionJoins",
|
|
247
|
+
reason: "invalid",
|
|
248
|
+
message: "Tracked-resolution provenance cannot bind a fragmented imported wrapper."
|
|
249
|
+
});
|
|
240
250
|
if (!parsedContent.some(isTrackedChangeWrapperChild)) {
|
|
241
251
|
pushTrackedChangeWrapper({
|
|
242
252
|
contents,
|
|
243
253
|
type,
|
|
244
254
|
info,
|
|
255
|
+
resolutionJoins,
|
|
245
256
|
content: [],
|
|
246
257
|
preserveEmpty: true
|
|
247
258
|
});
|
|
@@ -258,6 +269,7 @@ function pushTrackedChangeSegments({ contents, type, info, parsedContent }) {
|
|
|
258
269
|
contents,
|
|
259
270
|
type,
|
|
260
271
|
info,
|
|
272
|
+
resolutionJoins,
|
|
261
273
|
content: segment
|
|
262
274
|
});
|
|
263
275
|
segment.length = 0;
|
|
@@ -267,6 +279,7 @@ function pushTrackedChangeSegments({ contents, type, info, parsedContent }) {
|
|
|
267
279
|
contents,
|
|
268
280
|
type,
|
|
269
281
|
info,
|
|
282
|
+
resolutionJoins,
|
|
270
283
|
content: segment
|
|
271
284
|
});
|
|
272
285
|
}
|
|
@@ -679,6 +692,34 @@ const FIELD_INLINE_WRAPPER_HANDLERS = {
|
|
|
679
692
|
pPr: CAPTURE
|
|
680
693
|
};
|
|
681
694
|
/**
|
|
695
|
+
* The `w:r` elements a complex field, or a run holding one tab, was read
|
|
696
|
+
* from. A list paragraph draws its `LISTNUM` fields in the list marker and
|
|
697
|
+
* keeps their markup in the content as it was read; these are where that
|
|
698
|
+
* markup comes from.
|
|
699
|
+
*/
|
|
700
|
+
const fieldSourceElements = /* @__PURE__ */ new WeakMap();
|
|
701
|
+
const tabRunSources = /* @__PURE__ */ new WeakMap();
|
|
702
|
+
/**
|
|
703
|
+
* Whether the content read so far ends in a list-number field whose markup is
|
|
704
|
+
* kept, with nothing but range markers after it: the next tab is its tab.
|
|
705
|
+
*/
|
|
706
|
+
const followsListNumberField = (contents) => {
|
|
707
|
+
for (let index = contents.length - 1; index >= 0; index -= 1) {
|
|
708
|
+
const item = contents[index];
|
|
709
|
+
if (item === void 0 || isListNumberGapMarker(item)) continue;
|
|
710
|
+
return item.type === "complexField" && fieldSourceElements.has(item);
|
|
711
|
+
}
|
|
712
|
+
return false;
|
|
713
|
+
};
|
|
714
|
+
const sourceMarkupOf = (item) => {
|
|
715
|
+
if (item.type === "run") {
|
|
716
|
+
const element = tabRunSources.get(item);
|
|
717
|
+
return element ? captureVerbatimXml(element) : void 0;
|
|
718
|
+
}
|
|
719
|
+
const elements = fieldSourceElements.get(item);
|
|
720
|
+
return elements && elements.length > 0 ? elements.map((element) => captureVerbatimXml(element)).join("") : void 0;
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
682
723
|
* Whether the walk is currently inside some open field's code region — its
|
|
683
724
|
* own `begin` has been read but not yet its `separate` — at any nesting
|
|
684
725
|
* depth. `codeDepthStack` tracks every open field regardless of whether it
|
|
@@ -839,6 +880,7 @@ const PARAGRAPH_CONTENT_HANDLERS = {
|
|
|
839
880
|
scan.complexFieldCodeRuns = [];
|
|
840
881
|
scan.complexFieldResultRuns = [];
|
|
841
882
|
scan.complexFieldOpenRuns = [];
|
|
883
|
+
scan.complexFieldSourceRuns = [];
|
|
842
884
|
scan.complexFieldState = beginFieldState;
|
|
843
885
|
scan.complexFieldDataXml = beginFieldData ? captureVerbatimXml(beginFieldData) : void 0;
|
|
844
886
|
scan.complexFieldFallbackDisplay = beginFallbackDisplay;
|
|
@@ -849,6 +891,8 @@ const PARAGRAPH_CONTENT_HANDLERS = {
|
|
|
849
891
|
if (hasFieldEnd && scan.codeDepthStack.length > 0) scan.codeDepthStack.pop();
|
|
850
892
|
if (scan.inComplexField) {
|
|
851
893
|
scan.complexFieldOpenRuns.push(withOrphanFieldCharsPreserved(run, runElement));
|
|
894
|
+
if (commentReferenceId !== null || trackedContext === "deletion") scan.complexFieldSourceRuns = null;
|
|
895
|
+
else scan.complexFieldSourceRuns?.push(runElement);
|
|
852
896
|
if (instrText) scan.complexFieldInstr += instrText;
|
|
853
897
|
if ((!scan.complexFieldFormatting || Object.keys(scan.complexFieldFormatting).length === 0) && run.formatting && Object.keys(run.formatting).length > 0) scan.complexFieldFormatting = run.formatting;
|
|
854
898
|
let inFieldCodeRegion = !hasFieldBegin && !scan.afterSeparator;
|
|
@@ -897,6 +941,7 @@ const PARAGRAPH_CONTENT_HANDLERS = {
|
|
|
897
941
|
if (scan.complexFieldDataXml !== void 0) complexField.formFieldDataXml = scan.complexFieldDataXml;
|
|
898
942
|
if (resultIsFallback) complexField.fieldResultIsFallback = true;
|
|
899
943
|
if (scan.complexFieldFormatting) complexField.formatting = scan.complexFieldFormatting;
|
|
944
|
+
if (scan.complexFieldSourceRuns !== null && isListNumberField(complexField)) fieldSourceElements.set(complexField, scan.complexFieldSourceRuns);
|
|
900
945
|
contents.push(complexField);
|
|
901
946
|
if (commentReferenceId !== null) contents.push({
|
|
902
947
|
type: "commentReference",
|
|
@@ -926,7 +971,11 @@ const PARAGRAPH_CONTENT_HANDLERS = {
|
|
|
926
971
|
runElement,
|
|
927
972
|
rels,
|
|
928
973
|
media
|
|
929
|
-
}))
|
|
974
|
+
})) {
|
|
975
|
+
const kept = withOrphanFieldCharsPreserved(run, runElement);
|
|
976
|
+
if (isTabOnlyRun(kept) && trackedContext !== "deletion" && followsListNumberField(contents)) tabRunSources.set(kept, runElement);
|
|
977
|
+
contents.push(kept);
|
|
978
|
+
}
|
|
930
979
|
},
|
|
931
980
|
hyperlink: (child, { contents, styles, theme, rels, media, previews, inScopeXmlns }) => {
|
|
932
981
|
contents.push(...parseHyperlinkParagraphContents(child, rels, styles, theme, media, inScopeXmlns, previews));
|
|
@@ -983,35 +1032,47 @@ const PARAGRAPH_CONTENT_HANDLERS = {
|
|
|
983
1032
|
}
|
|
984
1033
|
},
|
|
985
1034
|
ins: (child, { contents, styles, theme, rels, media, previews, inScopeXmlns }) => {
|
|
1035
|
+
const insInfo = parseTrackedChangeInfo(child);
|
|
1036
|
+
const insContent = parseParagraphContents(child, styles, theme, null, rels, media, previews, "default", inScopeXmlns);
|
|
986
1037
|
pushTrackedChangeSegments({
|
|
987
1038
|
contents,
|
|
988
1039
|
type: "insertion",
|
|
989
|
-
info:
|
|
990
|
-
|
|
1040
|
+
info: insInfo,
|
|
1041
|
+
resolutionJoins: parseResolutionJoins(child),
|
|
1042
|
+
parsedContent: insContent
|
|
991
1043
|
});
|
|
992
1044
|
},
|
|
993
1045
|
del: (child, { contents, styles, theme, rels, media, previews, inScopeXmlns }) => {
|
|
1046
|
+
const delInfo = parseTrackedChangeInfo(child);
|
|
1047
|
+
const delContent = parseParagraphContents(child, styles, theme, null, rels, media, previews, "deletion", inScopeXmlns);
|
|
994
1048
|
pushTrackedChangeSegments({
|
|
995
1049
|
contents,
|
|
996
1050
|
type: "deletion",
|
|
997
|
-
info:
|
|
998
|
-
|
|
1051
|
+
info: delInfo,
|
|
1052
|
+
resolutionJoins: parseResolutionJoins(child),
|
|
1053
|
+
parsedContent: delContent
|
|
999
1054
|
});
|
|
1000
1055
|
},
|
|
1001
1056
|
moveFrom: (child, { contents, styles, theme, rels, media, previews, inScopeXmlns }) => {
|
|
1057
|
+
const moveFromInfo = parseTrackedChangeInfo(child);
|
|
1058
|
+
const moveFromContent = parseParagraphContents(child, styles, theme, null, rels, media, previews, "deletion", inScopeXmlns);
|
|
1002
1059
|
pushTrackedChangeSegments({
|
|
1003
1060
|
contents,
|
|
1004
1061
|
type: "moveFrom",
|
|
1005
|
-
info:
|
|
1006
|
-
|
|
1062
|
+
info: moveFromInfo,
|
|
1063
|
+
resolutionJoins: parseResolutionJoins(child),
|
|
1064
|
+
parsedContent: moveFromContent
|
|
1007
1065
|
});
|
|
1008
1066
|
},
|
|
1009
1067
|
moveTo: (child, { contents, styles, theme, rels, media, previews, inScopeXmlns }) => {
|
|
1068
|
+
const moveToInfo = parseTrackedChangeInfo(child);
|
|
1069
|
+
const moveToContent = parseParagraphContents(child, styles, theme, null, rels, media, previews, "default", inScopeXmlns);
|
|
1010
1070
|
pushTrackedChangeSegments({
|
|
1011
1071
|
contents,
|
|
1012
1072
|
type: "moveTo",
|
|
1013
|
-
info:
|
|
1014
|
-
|
|
1073
|
+
info: moveToInfo,
|
|
1074
|
+
resolutionJoins: parseResolutionJoins(child),
|
|
1075
|
+
parsedContent: moveToContent
|
|
1015
1076
|
});
|
|
1016
1077
|
},
|
|
1017
1078
|
smartTag: paragraphInlineWrapper("smartTag"),
|
|
@@ -1068,6 +1129,7 @@ function parseParagraphContents(paraElement, styles, theme, _numbering, rels, me
|
|
|
1068
1129
|
complexFieldCodeRuns: [],
|
|
1069
1130
|
complexFieldResultRuns: [],
|
|
1070
1131
|
complexFieldOpenRuns: [],
|
|
1132
|
+
complexFieldSourceRuns: null,
|
|
1071
1133
|
afterSeparator: false,
|
|
1072
1134
|
complexFieldState: {},
|
|
1073
1135
|
complexFieldDataXml: void 0,
|
|
@@ -1116,7 +1178,8 @@ function getCommentReferenceId(runElement) {
|
|
|
1116
1178
|
const PARAGRAPH_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
1117
1179
|
"paraId",
|
|
1118
1180
|
"textId",
|
|
1119
|
-
"reviewCarrier"
|
|
1181
|
+
"reviewCarrier",
|
|
1182
|
+
EMPTY_MARK_PROPERTIES_ATTRIBUTE
|
|
1120
1183
|
]);
|
|
1121
1184
|
/**
|
|
1122
1185
|
* Parse a paragraph element (w:p)
|
|
@@ -1158,8 +1221,10 @@ function parseParagraph(node, styles, theme, numbering, rels = null, media = nul
|
|
|
1158
1221
|
const sectPr = findChild(pPr, "w", "sectPr");
|
|
1159
1222
|
if (sectPr) paragraph.sectionProperties = parseSectionProperties(sectPr);
|
|
1160
1223
|
}
|
|
1224
|
+
restoreEmptyMarkProperties(paragraph, node);
|
|
1161
1225
|
const rawContent = parseParagraphContents(node, styles, theme, numbering, rels, media, options?.previews ?? standalonePreviewLedger(), "default", options?.rootXmlns ?? {});
|
|
1162
|
-
|
|
1226
|
+
const consolidated = (content) => options?.runConsolidation === "deferred" ? content : consolidateParagraphContent(content);
|
|
1227
|
+
paragraph.content = consolidated(rawContent);
|
|
1163
1228
|
const paragraphFormatting = paragraph.formatting;
|
|
1164
1229
|
const directNumPr = paragraphFormatting?.numPr;
|
|
1165
1230
|
const styleNumPr = paragraphFormatting?.styleId && styles ? styles.get(paragraphFormatting.styleId)?.pPr?.numPr : void 0;
|
|
@@ -1206,41 +1271,23 @@ function parseParagraph(node, styles, theme, numbering, rels = null, media = nul
|
|
|
1206
1271
|
if (markerAlignment !== void 0) listRendering.markerAlignment = markerAlignment;
|
|
1207
1272
|
if (level.suffix) listRendering.markerSuffix = level.suffix;
|
|
1208
1273
|
if (level.pPr?.tabs?.length) listRendering.levelTabs = level.pPr.tabs;
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
}
|
|
1219
|
-
if (dropNextTab) {
|
|
1220
|
-
dropNextTab = false;
|
|
1221
|
-
if (content.type === "run" && content.content.length === 1 && content.content[0]?.type === "tab") continue;
|
|
1222
|
-
}
|
|
1223
|
-
if (content.type === "complexField") {
|
|
1224
|
-
if (content.fieldType === "LISTNUM" || content.instruction.trim().toUpperCase().startsWith("LISTNUM")) {
|
|
1225
|
-
implicitChildLevelAdvances += 1;
|
|
1226
|
-
const cached = extractPlainText(content.fieldResult);
|
|
1227
|
-
if (cached) foldedMarkerSuffix.push(cached);
|
|
1228
|
-
dropNextTab = true;
|
|
1229
|
-
continue;
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
filteredContent.push(content);
|
|
1233
|
-
}
|
|
1234
|
-
if (foldedMarkerSuffix.length > 0) {
|
|
1235
|
-
paragraph.content = filteredContent;
|
|
1236
|
-
listRendering.marker = `${listRendering.marker}\t${foldedMarkerSuffix.join(" ")}`;
|
|
1274
|
+
const fold = rawContent.some((item) => item.type === "complexField") ? foldListNumberFields(rawContent, sourceMarkupOf) : {
|
|
1275
|
+
content: rawContent,
|
|
1276
|
+
cached: [],
|
|
1277
|
+
fieldCount: 0
|
|
1278
|
+
};
|
|
1279
|
+
const markerShowsFields = !listRendering.isBullet && level.lvlText !== "" && !level.lvlText.includes(" ");
|
|
1280
|
+
if (fold.cached.length > 0 && markerShowsFields) {
|
|
1281
|
+
paragraph.content = consolidated(fold.content);
|
|
1282
|
+
listRendering.foldedMarkerSuffix = fold.cached.join(" ");
|
|
1283
|
+
listRendering.marker = `${listRendering.marker}\t${listRendering.foldedMarkerSuffix}`;
|
|
1237
1284
|
const nextLevel = numbering.getLevel(numId, ilvl + 1);
|
|
1238
1285
|
if (nextLevel?.pPr?.hangingIndent === true && nextLevel.pPr.indentFirstLine !== void 0) {
|
|
1239
1286
|
const hangingTwips = -nextLevel.pPr.indentFirstLine;
|
|
1240
1287
|
if (hangingTwips > 0) listRendering.markerSecondSlotOffsetTwips = hangingTwips;
|
|
1241
1288
|
}
|
|
1242
1289
|
}
|
|
1243
|
-
if (
|
|
1290
|
+
if (fold.fieldCount > 0) listRendering.implicitChildLevelAdvances = fold.fieldCount;
|
|
1244
1291
|
paragraph.listRendering = listRendering;
|
|
1245
1292
|
const styleInd = styleChainInd(paragraph.formatting?.styleId ?? (styles ? resolveDefaultParagraphStyle(styles.values())?.styleId : void 0), styles);
|
|
1246
1293
|
const chainInd = numPrFromStyle ? styleInd : {
|
|
@@ -1304,6 +1351,7 @@ const getRunContentText = (content) => {
|
|
|
1304
1351
|
case "fieldChar":
|
|
1305
1352
|
case "footnoteRef":
|
|
1306
1353
|
case "instrText":
|
|
1354
|
+
case "noteMarker":
|
|
1307
1355
|
case "renderedPageBreak":
|
|
1308
1356
|
case "shape":
|
|
1309
1357
|
case "symbol": return "";
|
|
@@ -43,6 +43,20 @@ declare const getProseDocumentParagraphPropertySourceContract: (document: Node)
|
|
|
43
43
|
declare const getProseParagraphPropertySourceToken: (paragraph: Node) => unknown;
|
|
44
44
|
declare const copyDocumentParagraphPropertySourceContract: (target: document_d_exports.Document, source: document_d_exports.Document) => void;
|
|
45
45
|
declare const getParagraphPropertySourceToken: (paragraph: document_d_exports.Paragraph) => string | undefined;
|
|
46
|
+
type ParagraphSourceIdentity = {
|
|
47
|
+
type: "durable";
|
|
48
|
+
token: string;
|
|
49
|
+
} | {
|
|
50
|
+
type: "capture-only";
|
|
51
|
+
} | {
|
|
52
|
+
type: "authored";
|
|
53
|
+
} | {
|
|
54
|
+
type: "missing-token";
|
|
55
|
+
} | {
|
|
56
|
+
type: "invalid";
|
|
57
|
+
};
|
|
58
|
+
/** Byte captures can follow derivations; only explicit copies carry durable tokens. */
|
|
59
|
+
declare const inspectParagraphSourceIdentity: (paragraph: document_d_exports.Paragraph, document: document_d_exports.Document) => ParagraphSourceIdentity;
|
|
46
60
|
type ParagraphCloneOverrides = Omit<Partial<document_d_exports.Paragraph>, "type">;
|
|
47
61
|
/** Clone a paragraph while deliberately retaining its parsed `w:pPr` owner. */
|
|
48
62
|
declare const cloneParagraphWithPropertySource: (paragraph: document_d_exports.Paragraph, overrides: ParagraphCloneOverrides) => document_d_exports.Paragraph;
|
|
@@ -136,4 +150,4 @@ declare const linkParagraphPropertySourceCandidate: (target: document_d_exports.
|
|
|
136
150
|
declare const getParagraphPropertySourceCandidate: (paragraph: document_d_exports.Paragraph) => document_d_exports.Paragraph | undefined;
|
|
137
151
|
declare const getParagraphPropertySourceTransferId: (paragraph: document_d_exports.Paragraph) => string | undefined;
|
|
138
152
|
//#endregion
|
|
139
|
-
export { DecodedTableCellParagraphSourcePayload, PARAGRAPH_PROPERTY_SOURCE_VALIDATION_CODES, PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, PROSE_PARAGRAPH_SOURCE_TOKEN_ATTR, ParagraphPropertySourceTransfer, ParagraphPropertySourceValidationCode, ParagraphPropertySourceValidationError, TABLE_CELL_PARAGRAPH_SOURCE_BINDING_ATTR, TABLE_CELL_PARAGRAPH_SOURCE_PAYLOAD_ERROR_CLASSIFICATIONS, TableCellParagraphPropertySourceBinding, TableCellParagraphSourcePayloadErrorClassification, assignDocumentParagraphPropertySourceContract, assignParagraphPropertySource, cloneDocumentWithParagraphPropertySources, cloneParagraphWithPropertySource, cloneParagraphWithoutPropertySource, cloneTableCellsWithParagraphPropertyCaptures, copyDocumentParagraphPropertySourceContract, copyDocumentParagraphPropertySources, copyParagraphPropertyCapture, copyParagraphPropertySource, createProseParagraphWithPropertySource, decodeTableCellParagraphSourcePayload, getDocumentParagraphPropertySourceContract, getExplicitParagraphPropertySourceTransfers, getParagraphPropertySource, getParagraphPropertySourceCandidate, getParagraphPropertySourceToken, getParagraphPropertySourceTransferId, getProseDocumentParagraphPropertySourceContract, getProseParagraphPropertySourceToken, isParagraphPropertySourceToken, joinProseParagraphsWithRightPropertySource, linkParagraphPropertySourceCandidate, linkProseParagraphPropertySource, markParagraphPropertySourceTransfers, paragraphPropertySourceBelongsToDocument, paragraphPropertySourceMatchesEmission, paragraphPropertySourceTokenMatchesContract, proseParagraphAttrsWithoutPropertySource, recreateProseNodeWithDetachedParagraphPropertySource, recreateProseNodeWithParagraphPropertySource, restoreTableCellsWithParagraphPropertySources, setProseParagraphMarkupWithPropertySource, transferProseParagraphPropertySource, transportTableCellsWithParagraphPropertySources, visitDocumentStoryParagraphs, visitTableCellParagraphPropertySourceBindings };
|
|
153
|
+
export { DecodedTableCellParagraphSourcePayload, PARAGRAPH_PROPERTY_SOURCE_VALIDATION_CODES, PROSE_PARAGRAPH_SOURCE_CONTRACT_ATTR, PROSE_PARAGRAPH_SOURCE_TOKEN_ATTR, ParagraphPropertySourceTransfer, ParagraphPropertySourceValidationCode, ParagraphPropertySourceValidationError, TABLE_CELL_PARAGRAPH_SOURCE_BINDING_ATTR, TABLE_CELL_PARAGRAPH_SOURCE_PAYLOAD_ERROR_CLASSIFICATIONS, TableCellParagraphPropertySourceBinding, TableCellParagraphSourcePayloadErrorClassification, assignDocumentParagraphPropertySourceContract, assignParagraphPropertySource, cloneDocumentWithParagraphPropertySources, cloneParagraphWithPropertySource, cloneParagraphWithoutPropertySource, cloneTableCellsWithParagraphPropertyCaptures, copyDocumentParagraphPropertySourceContract, copyDocumentParagraphPropertySources, copyParagraphPropertyCapture, copyParagraphPropertySource, createProseParagraphWithPropertySource, decodeTableCellParagraphSourcePayload, getDocumentParagraphPropertySourceContract, getExplicitParagraphPropertySourceTransfers, getParagraphPropertySource, getParagraphPropertySourceCandidate, getParagraphPropertySourceToken, getParagraphPropertySourceTransferId, getProseDocumentParagraphPropertySourceContract, getProseParagraphPropertySourceToken, inspectParagraphSourceIdentity, isParagraphPropertySourceToken, joinProseParagraphsWithRightPropertySource, linkParagraphPropertySourceCandidate, linkProseParagraphPropertySource, markParagraphPropertySourceTransfers, paragraphPropertySourceBelongsToDocument, paragraphPropertySourceMatchesEmission, paragraphPropertySourceTokenMatchesContract, proseParagraphAttrsWithoutPropertySource, recreateProseNodeWithDetachedParagraphPropertySource, recreateProseNodeWithParagraphPropertySource, restoreTableCellsWithParagraphPropertySources, setProseParagraphMarkupWithPropertySource, transferProseParagraphPropertySource, transportTableCellsWithParagraphPropertySources, visitDocumentStoryParagraphs, visitTableCellParagraphPropertySourceBindings };
|