@stll/folio-core 0.52.0 → 0.53.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 +23 -0
- package/dist/ai-edits/apply.d.ts +26 -1
- package/dist/ai-edits/apply.js +1519 -105
- package/dist/ai-edits/batch-claims.d.ts +130 -0
- package/dist/ai-edits/batch-claims.js +244 -0
- package/dist/ai-edits/blockRange.js +9 -3
- package/dist/ai-edits/character-boundaries.d.ts +43 -0
- package/dist/ai-edits/character-boundaries.js +95 -0
- package/dist/ai-edits/clean-text.d.ts +33 -3
- package/dist/ai-edits/clean-text.js +52 -6
- package/dist/ai-edits/comment-lifecycle.d.ts +18 -0
- package/dist/ai-edits/comment-lifecycle.js +52 -0
- package/dist/ai-edits/headless.d.ts +71 -7
- package/dist/ai-edits/headless.js +381 -41
- package/dist/ai-edits/index.d.ts +2 -1
- package/dist/ai-edits/index.js +2 -1
- package/dist/ai-edits/minimal-replacement.d.ts +21 -6
- package/dist/ai-edits/minimal-replacement.js +134 -15
- package/dist/ai-edits/newListNumbering.d.ts +23 -0
- package/dist/ai-edits/newListNumbering.js +94 -0
- package/dist/ai-edits/note-references.d.ts +96 -0
- package/dist/ai-edits/note-references.js +139 -0
- package/dist/ai-edits/pending-suggestions.d.ts +79 -0
- package/dist/ai-edits/pending-suggestions.js +306 -0
- package/dist/ai-edits/read.d.ts +1 -1
- package/dist/ai-edits/read.js +56 -43
- package/dist/ai-edits/result-validation.d.ts +29 -0
- package/dist/ai-edits/result-validation.js +164 -0
- package/dist/ai-edits/snapshot.d.ts +36 -3
- package/dist/ai-edits/snapshot.js +177 -23
- package/dist/ai-edits/table-cell-mutations.d.ts +1 -1
- package/dist/ai-edits/table-cell-mutations.js +4 -1
- package/dist/ai-edits/table-geometry.d.ts +1 -1
- package/dist/ai-edits/table-row-column-mutations.d.ts +38 -16
- package/dist/ai-edits/table-row-column-mutations.js +61 -26
- package/dist/ai-edits/types.d.ts +155 -16
- package/dist/compare/compare.d.ts +1 -1
- package/dist/compare/compare.js +65 -16
- package/dist/compare/content-alignment.js +13 -2
- package/dist/compare/content-types.d.ts +7 -0
- package/dist/compare/content.d.ts +4 -1
- package/dist/compare/content.js +6 -1
- package/dist/compare/formatting.js +2 -1
- package/dist/compare/inline-atoms.d.ts +21 -4
- package/dist/compare/inline-atoms.js +138 -16
- package/dist/compare/plan.js +10 -5
- package/dist/compare/scenario.js +14 -3
- package/dist/compare/section-boundary-properties.js +1 -1
- package/dist/compare/types.d.ts +4 -2
- package/dist/compare/types.js +2 -1
- package/dist/compare/verification.d.ts +1 -1
- package/dist/compare/verification.js +15 -3
- package/dist/controller/committedLayoutDiff.d.ts +25 -0
- package/dist/controller/committedLayoutDiff.js +71 -0
- package/dist/controller/contentControlWidgetController.d.ts +1 -1
- package/dist/controller/folioEditor.d.ts +1 -1
- package/dist/controller/fontReadiness.d.ts +70 -3
- package/dist/controller/fontReadiness.js +100 -10
- package/dist/controller/headerFooterEditorManager.js +6 -1
- package/dist/controller/layoutPipeline.d.ts +12 -10
- package/dist/controller/layoutPipeline.js +62 -9
- package/dist/controller/layoutRunOptions.d.ts +24 -0
- package/dist/controller/layoutRunOptions.js +17 -0
- package/dist/controller/layoutScheduler.d.ts +19 -14
- package/dist/controller/layoutScheduler.js +15 -12
- package/dist/controller/layoutSession.d.ts +26 -2
- package/dist/controller/layoutSession.js +1 -1
- package/dist/controller/noteEditorManager.js +8 -3
- package/dist/document-operations.d.ts +11 -2
- package/dist/document-operations.js +230 -21
- package/dist/docx/altChunk.d.ts +8 -0
- package/dist/docx/altChunk.js +17 -0
- package/dist/docx/attributeRemainder.d.ts +1 -1
- package/dist/docx/blockContentParser.d.ts +64 -1
- package/dist/docx/blockContentParser.js +17 -4
- package/dist/docx/blockCustomXmlShell.d.ts +7 -0
- package/dist/docx/blockCustomXmlShell.js +14 -0
- package/dist/docx/blockPlainText.js +7 -0
- package/dist/docx/commentAnchorIndex.js +1 -1
- package/dist/docx/commentRangeIntegrity.js +8 -3
- package/dist/docx/commentReferenceNormalization.js +1 -1
- package/dist/docx/commentReplyMarkers.js +20 -1
- package/dist/docx/compatibility.d.ts +1 -1
- package/dist/docx/compatibility.js +34 -13
- package/dist/docx/containerChildren.gen.d.ts +1 -1
- package/dist/docx/containerChildren.gen.js +1 -0
- package/dist/docx/documentParser.js +12 -12
- package/dist/docx/drawingIdNormalization.d.ts +3 -1
- package/dist/docx/drawingIdNormalization.js +6 -1
- package/dist/docx/ensureParaIds.js +119 -97
- package/dist/docx/footnoteParser.js +8 -4
- package/dist/docx/headerFooterParser.js +3 -3
- package/dist/docx/headerFooterReferenceNormalization.d.ts +20 -1
- package/dist/docx/headerFooterReferenceNormalization.js +52 -27
- package/dist/docx/hyperlinkParser.d.ts +1 -1
- package/dist/docx/index.d.ts +1 -1
- package/dist/docx/listNumberingInstances.d.ts +59 -0
- package/dist/docx/listNumberingInstances.js +249 -0
- package/dist/docx/normalizeBaseDirection.js +2 -1
- package/dist/docx/opaqueCarrier.d.ts +7 -0
- package/dist/docx/opaqueCarrier.js +38 -0
- package/dist/docx/packageParts.js +4 -1
- package/dist/docx/paragraphParser.js +91 -24
- package/dist/docx/paragraphPropertySource.d.ts +4 -2
- package/dist/docx/paragraphPropertySource.js +7 -1
- package/dist/docx/paragraphTraversal.js +1 -0
- package/dist/docx/parseWarningMessage.js +4 -1
- package/dist/docx/parser.js +173 -20
- package/dist/docx/rezip.js +27 -5
- package/dist/docx/sdtProperties.js +1 -1
- package/dist/docx/sdtPropertiesPatch.js +3 -0
- package/dist/docx/selectiveSave.js +16 -9
- package/dist/docx/selectiveXmlPatch.js +106 -37
- package/dist/docx/serializer/blockCustomXmlSerializer.d.ts +5 -0
- package/dist/docx/serializer/blockCustomXmlSerializer.js +4 -0
- package/dist/docx/serializer/documentSerializer.js +2 -0
- package/dist/docx/serializer/headerFooterSerializer.js +2 -0
- package/dist/docx/serializer/noteSerializer.js +3 -1
- package/dist/docx/serializer/paragraphSerializer.js +33 -9
- package/dist/docx/serializer/tableSerializer.js +25 -38
- package/dist/docx/server/createBilingualDocument.js +3 -3
- package/dist/docx/tableParser.d.ts +157 -1
- package/dist/docx/tableParser.js +89 -10
- package/dist/docx/textBoxParser.js +1 -1
- package/dist/docx/unzip.d.ts +2 -1
- package/dist/docx/unzip.js +1 -1
- package/dist/docx/wordprocessingPrefixes.d.ts +78 -0
- package/dist/docx/wordprocessingPrefixes.js +286 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +136 -0
- package/dist/i18n/messages/catalogs.gen.js +153 -17
- package/dist/i18n/messages/messages.gen.d.ts +8 -0
- package/dist/internal/compare/inline-presentation.d.ts +2 -1
- package/dist/internal/compare/inline-presentation.js +11 -10
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +2 -8
- package/dist/internal/headlessRevisionResolutionGuard.js +2 -11
- package/dist/internal/indexedPositionMap.d.ts +11 -0
- package/dist/internal/indexedPositionMap.js +42 -0
- package/dist/internal/pageBreakRunSourceDescendantIndex.js +2 -1
- package/dist/internal/revisionResolutionEdits.d.ts +13 -0
- package/dist/internal/revisionResolutionEdits.js +19 -0
- package/dist/internal/revisionResolutionInline.d.ts +24 -0
- package/dist/internal/{headlessRevisionResolution.js → revisionResolutionInline.js} +61 -43
- package/dist/internal/revisionResolutionStep.d.ts +34 -0
- package/dist/internal/revisionResolutionStep.js +282 -0
- package/dist/internal/revisionResolutionTracking.d.ts +11 -0
- package/dist/internal/revisionResolutionTracking.js +124 -0
- package/dist/internal/wholeStoryRevisionResolution.d.ts +56 -0
- package/dist/internal/wholeStoryRevisionResolution.js +530 -0
- package/dist/layout-bridge/convert/markupViewFlow.d.ts +20 -0
- package/dist/layout-bridge/convert/markupViewFlow.js +123 -0
- package/dist/layout-bridge/convert/tableConversion.js +1 -1
- package/dist/layout-bridge/convert/toFlowBlocks.js +10 -1
- package/dist/layout-engine/layoutInstrumentation.d.ts +9 -1
- package/dist/layout-engine/layoutInstrumentation.js +4 -1
- package/dist/layout-engine/measure/cache.d.ts +18 -1
- package/dist/layout-engine/measure/cache.js +31 -1
- package/dist/layout-engine/measure/font-metrics.worker.js +3 -7
- package/dist/layout-engine/measure/measureContainer.js +7 -47
- package/dist/layout-engine/measure/measureHelpers.d.ts +6 -1
- package/dist/layout-engine/measure/measureHelpers.js +22 -2
- package/dist/layout-engine/measure/measureWorker.js +2 -3
- package/dist/layout-engine/measure/measureWorkerProtocol.d.ts +6 -7
- package/dist/layout-engine/measure/measureWorkerProtocol.js +1 -2
- package/dist/layout-engine/types.d.ts +6 -0
- package/dist/layout-painter/renderPage.js +1 -0
- package/dist/layout-painter/renderParagraph.js +1 -1
- package/dist/managers/ContextMenuManager.js +5 -2
- package/dist/managers/types.d.ts +3 -0
- package/dist/markdown/fromMarkdown.js +2 -1
- package/dist/markdown/internals.d.ts +11 -1
- package/dist/markdown/internals.js +24 -3
- package/dist/markdown/renderBlock.js +39 -9
- package/dist/markdown/renderParagraph.d.ts +13 -1
- package/dist/markdown/renderParagraph.js +85 -38
- package/dist/markdown/renderRuns.js +3 -10
- package/dist/markdown/renderTable.js +24 -12
- package/dist/markdown/trailers.js +2 -2
- package/dist/markdown/types.d.ts +29 -7
- package/dist/paged-layout/incrementalMeasure.d.ts +1 -2
- package/dist/paged-layout/incrementalMeasure.js +1 -9
- package/dist/paged-layout/transactionDirtyRange.d.ts +1 -3
- package/dist/paged-layout/transactionDirtyRange.js +29 -41
- package/dist/panel-layout.d.ts +83 -0
- package/dist/panel-layout.js +96 -0
- package/dist/prosemirror/anchoredTextBoxes.d.ts +37 -0
- package/dist/prosemirror/anchoredTextBoxes.js +156 -0
- package/dist/prosemirror/attrs/index.d.ts +6 -2
- package/dist/prosemirror/attrs/index.js +172 -1
- package/dist/prosemirror/commands/comments.d.ts +7 -8
- package/dist/prosemirror/commands/comments.js +241 -207
- package/dist/prosemirror/commands/contentControls.d.ts +1 -1
- package/dist/prosemirror/commands/formatPainter.d.ts +1 -1
- package/dist/prosemirror/commands/formatting.d.ts +1 -1
- package/dist/prosemirror/commands/index.d.ts +2 -2
- package/dist/prosemirror/commands/index.js +2 -2
- package/dist/prosemirror/commands/paragraph.d.ts +7 -1
- package/dist/prosemirror/commands/paragraph.js +9 -1
- package/dist/prosemirror/commands/paragraphBookmarkJoin.d.ts +13 -0
- package/dist/prosemirror/commands/paragraphBookmarkJoin.js +22 -0
- package/dist/prosemirror/commands/pastePlainText.d.ts +1 -1
- package/dist/prosemirror/commands/resolveAllTableChanges.d.ts +40 -0
- package/dist/prosemirror/commands/resolveAllTableChanges.js +615 -0
- package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.d.ts +15 -0
- package/dist/prosemirror/commands/resolveNodePropertyChangeAttrs.js +46 -0
- package/dist/prosemirror/commands/resolveParagraphProperties.d.ts +16 -0
- package/dist/prosemirror/commands/resolveParagraphProperties.js +59 -0
- package/dist/prosemirror/commands/sectionBreak.js +2 -1
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +8 -2
- package/dist/prosemirror/commands/tableCellMergeResolution.js +1 -1
- package/dist/prosemirror/contentControlRevisions.d.ts +1 -1
- package/dist/prosemirror/conversion/fromProseDoc.js +181 -31
- package/dist/prosemirror/conversion/toProseDoc.js +39 -4
- package/dist/prosemirror/emptyFieldResultRuns.d.ts +18 -0
- package/dist/prosemirror/emptyFieldResultRuns.js +33 -0
- package/dist/prosemirror/extensions/ExtensionManager.d.ts +1 -1
- package/dist/prosemirror/extensions/ExtensionManager.js +3 -1
- package/dist/prosemirror/extensions/StarterKit.js +3 -1
- package/dist/prosemirror/extensions/core/DocExtension.js +1 -1
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +12 -0
- package/dist/prosemirror/extensions/features/BaseKeymapExtension.js +3 -0
- package/dist/prosemirror/extensions/features/ListExtension.js +161 -123
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.d.ts +19 -2
- package/dist/prosemirror/extensions/features/ParaIdAllocatorExtension.js +33 -20
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.d.ts +31 -2
- package/dist/prosemirror/extensions/features/ParagraphChangeTrackerExtension.js +270 -99
- package/dist/prosemirror/extensions/features/PasteCleanupExtension.js +3 -2
- package/dist/prosemirror/extensions/features/pasteCleanup.js +2 -1
- package/dist/prosemirror/extensions/features/pastedHtmlLists.d.ts +12 -0
- package/dist/prosemirror/extensions/features/pastedHtmlLists.js +126 -0
- package/dist/prosemirror/extensions/marks/FootnoteRefExtension.js +21 -5
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.d.ts +21 -18
- package/dist/prosemirror/extensions/marks/RunIdentityExtension.js +37 -17
- package/dist/prosemirror/extensions/marks/markUtils.d.ts +7 -2
- package/dist/prosemirror/extensions/marks/markUtils.js +8 -2
- package/dist/prosemirror/extensions/marks/noteReferenceDeletion.d.ts +10 -0
- package/dist/prosemirror/extensions/marks/noteReferenceDeletion.js +35 -0
- package/dist/prosemirror/extensions/nodes/BlockCustomXmlExtension.d.ts +6 -0
- package/dist/prosemirror/extensions/nodes/BlockCustomXmlExtension.js +52 -0
- package/dist/prosemirror/extensions/nodes/FieldExtension.d.ts +3 -3
- package/dist/prosemirror/extensions/nodes/FieldExtension.js +50 -15
- package/dist/prosemirror/extensions/nodes/PreservedBlockExtension.js +4 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.d.ts +1 -1
- package/dist/prosemirror/extensions/nodes/TableExtension.js +19 -18
- package/dist/prosemirror/extensions/types.d.ts +4 -1
- package/dist/prosemirror/findReplaceSelection.js +1 -1
- package/dist/prosemirror/index.d.ts +3 -2
- package/dist/prosemirror/index.js +3 -2
- package/dist/prosemirror/indexedNodeLookup.d.ts +17 -0
- package/dist/prosemirror/indexedNodeLookup.js +103 -0
- package/dist/prosemirror/listAutoformatMarkers.d.ts +19 -0
- package/dist/prosemirror/listAutoformatMarkers.js +98 -0
- package/dist/prosemirror/listInstanceReferences.d.ts +12 -0
- package/dist/prosemirror/listInstanceReferences.js +72 -0
- package/dist/prosemirror/listLabels.d.ts +24 -0
- package/dist/prosemirror/listLabels.js +111 -0
- package/dist/prosemirror/listNumbering.d.ts +110 -0
- package/dist/prosemirror/listNumbering.js +345 -0
- package/dist/prosemirror/listRenderingAttrs.d.ts +11 -2
- package/dist/prosemirror/listRenderingAttrs.js +8 -1
- package/dist/prosemirror/markupViewProjection.d.ts +95 -0
- package/dist/prosemirror/markupViewProjection.js +83 -0
- package/dist/prosemirror/numberingAttr.d.ts +9 -1
- package/dist/prosemirror/numberingAttr.js +9 -1
- package/dist/prosemirror/outlineLevelAttr.js +1 -1
- package/dist/prosemirror/paragraphIndentation.d.ts +10 -1
- package/dist/prosemirror/paragraphIndentation.js +29 -7
- package/dist/prosemirror/paragraphMarkJoin.d.ts +19 -0
- package/dist/prosemirror/paragraphMarkJoin.js +24 -0
- package/dist/prosemirror/plugins/createDocScanPlugin.d.ts +1 -1
- package/dist/prosemirror/plugins/documentNumbering.d.ts +27 -1
- package/dist/prosemirror/plugins/documentNumbering.js +97 -11
- package/dist/prosemirror/plugins/documentStyles.d.ts +10 -1
- package/dist/prosemirror/plugins/documentStyles.js +14 -1
- package/dist/prosemirror/plugins/suggestionMode.d.ts +16 -2
- package/dist/prosemirror/plugins/suggestionMode.js +116 -52
- package/dist/prosemirror/plugins/templateDirectives.d.ts +1 -1
- package/dist/prosemirror/plugins/transactionInvariants.d.ts +32 -0
- package/dist/prosemirror/plugins/transactionInvariants.js +86 -0
- package/dist/prosemirror/positionSweep.d.ts +24 -0
- package/dist/prosemirror/positionSweep.js +222 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -1
- package/dist/prosemirror/rejoinRunCarriers.d.ts +1 -1
- package/dist/prosemirror/replacedAnnotations.d.ts +33 -1
- package/dist/prosemirror/replacedAnnotations.js +170 -1
- package/dist/prosemirror/runFormattingInlineCarriers.d.ts +1 -1
- package/dist/prosemirror/schema/index.d.ts +2 -2
- package/dist/prosemirror/schema/index.js +3 -0
- package/dist/prosemirror/schema/nodes.d.ts +42 -11
- package/dist/prosemirror/sectionMarkEdits.d.ts +20 -0
- package/dist/prosemirror/sectionMarkEdits.js +59 -0
- package/dist/prosemirror/storyListNumbering.d.ts +17 -0
- package/dist/prosemirror/storyListNumbering.js +102 -0
- package/dist/prosemirror/tableGridMutation.d.ts +48 -2
- package/dist/prosemirror/tableGridMutation.js +106 -1
- package/dist/prosemirror/validation.js +5 -1
- package/dist/redline.js +93 -9
- package/dist/render-dom/BodySelectionOverlay.d.ts +4 -1
- package/dist/render-dom/BodySelectionOverlay.js +3 -2
- package/dist/utils/findReplace.js +2 -2
- package/dist/utils/mergeDocumentContent.js +1 -1
- package/dist/utils/noteReferenceLabels.d.ts +36 -0
- package/dist/utils/noteReferenceLabels.js +32 -0
- package/dist/utils/replaceText.js +1 -1
- package/dist/version-comparison.d.ts +1 -0
- package/dist/version-comparison.js +1 -0
- package/package.json +3 -2
- package/dist/internal/headlessRevisionResolution.d.ts +0 -23
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { serializeBlockCustomXml } from "./blockCustomXmlSerializer.js";
|
|
1
2
|
import { serializeBlockSdt } from "./blockSdtSerializer.js";
|
|
2
3
|
import { serializeBookmarkMarker } from "./markupRangeAttributes.js";
|
|
3
4
|
import { serializeParagraph } from "./paragraphSerializer.js";
|
|
@@ -45,6 +46,7 @@ function serializeBlockContent(block) {
|
|
|
45
46
|
case "paragraph": return serializeParagraph(block);
|
|
46
47
|
case "table": return serializeTable(block, serializeParagraph);
|
|
47
48
|
case "blockSdt": return serializeBlockSdt(block, serializeBlockContent);
|
|
49
|
+
case "blockCustomXml": return serializeBlockCustomXml(block, serializeBlockContent);
|
|
48
50
|
case "preservedBlock": return block.xml;
|
|
49
51
|
case "bookmarkStart":
|
|
50
52
|
case "bookmarkEnd": return serializeBookmarkMarker(block);
|
|
@@ -2,6 +2,7 @@ import { canReplayHeaderFooterVerbatim, getHeaderFooterVerbatimXml } from "../he
|
|
|
2
2
|
import { isEmptyParagraph } from "../paragraphParser.js";
|
|
3
3
|
import { captureVerbatimXml } from "../verbatimCapture.js";
|
|
4
4
|
import { getLocalName, parseXmlDocument } from "../xmlParser.js";
|
|
5
|
+
import { serializeBlockCustomXml } from "./blockCustomXmlSerializer.js";
|
|
5
6
|
import { serializeBlockSdt } from "./blockSdtSerializer.js";
|
|
6
7
|
import { serializeBookmarkMarker } from "./markupRangeAttributes.js";
|
|
7
8
|
import { serializeParagraph } from "./paragraphSerializer.js";
|
|
@@ -41,6 +42,7 @@ function serializeBlock(block) {
|
|
|
41
42
|
case "paragraph": return serializeParagraph(block);
|
|
42
43
|
case "table": return serializeTable(block, serializeParagraph);
|
|
43
44
|
case "blockSdt": return serializeBlockSdt(block, serializeBlock);
|
|
45
|
+
case "blockCustomXml": return serializeBlockCustomXml(block, serializeBlock);
|
|
44
46
|
case "preservedBlock": return block.xml;
|
|
45
47
|
case "bookmarkStart":
|
|
46
48
|
case "bookmarkEnd": return serializeBookmarkMarker(block);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { serializeBlockCustomXml } from "./blockCustomXmlSerializer.js";
|
|
1
2
|
import { serializeBlockSdt } from "./blockSdtSerializer.js";
|
|
2
3
|
import { serializeBookmarkMarker } from "./markupRangeAttributes.js";
|
|
3
4
|
import { serializeParagraph } from "./paragraphSerializer.js";
|
|
@@ -43,6 +44,7 @@ function serializeBlock(block) {
|
|
|
43
44
|
case "paragraph": return serializeParagraph(block);
|
|
44
45
|
case "table": return serializeTable(block, serializeParagraph);
|
|
45
46
|
case "blockSdt": return serializeBlockSdt(block, serializeBlock);
|
|
47
|
+
case "blockCustomXml": return serializeBlockCustomXml(block, serializeBlock);
|
|
46
48
|
case "preservedBlock": return block.xml;
|
|
47
49
|
case "bookmarkStart":
|
|
48
50
|
case "bookmarkEnd": return serializeBookmarkMarker(block);
|
|
@@ -65,7 +67,7 @@ function serializeRequiredNoteSeparators(elementName) {
|
|
|
65
67
|
return `<w:${elementName} w:type="separator" w:id="-1">${NOTE_SEPARATOR_BODY}<w:r><w:separator/></w:r></w:p></w:${elementName}><w:${elementName} w:type="continuationSeparator" w:id="0">${NOTE_SEPARATOR_BODY}<w:r><w:continuationSeparator/></w:r></w:p></w:${elementName}>`;
|
|
66
68
|
}
|
|
67
69
|
function insertNoteReferenceMark(xml, elementName) {
|
|
68
|
-
if (
|
|
70
|
+
if (new RegExp(`<(?:[\\w.-]+:)?${elementName}Ref[\\s/>]`, "u").test(xml)) return xml;
|
|
69
71
|
const paragraphOpen = /<w:p(?=[\s>])[^>]*>/u.exec(xml);
|
|
70
72
|
if (!paragraphOpen) return `${`<w:p><w:r><w:rPr><w:rStyle w:val="${elementName === "footnote" ? "FootnoteReference" : "EndnoteReference"}"/></w:rPr><w:${elementName}Ref/></w:r></w:p>`}${xml}`;
|
|
71
73
|
const paragraphStart = paragraphOpen.index + paragraphOpen[0].length;
|
|
@@ -14,7 +14,7 @@ import { serializeSdtWrapper } from "./sdtPropertiesSerializer.js";
|
|
|
14
14
|
import { serializeSectionProperties } from "./sectionPropertiesSerializer.js";
|
|
15
15
|
import { serializeTextFormatting } from "./textFormattingSerializer.js";
|
|
16
16
|
import { serializeTrackedChangeAttributes, trackedChangeAttributeRecord } from "./trackedChangeAttributes.js";
|
|
17
|
-
import { panic } from "better-result";
|
|
17
|
+
import { TaggedError, panic } from "better-result";
|
|
18
18
|
import { escapeXmlAttribute, escapeXmlText } from "@stll/docx-core";
|
|
19
19
|
import { PARAGRAPH_MARK_CHANGE_KINDS } from "@stll/docx-core/model";
|
|
20
20
|
import { SEQUENCE_CHILDREN } from "@stll/docx-core/schema";
|
|
@@ -315,27 +315,51 @@ function serializeSimpleField(field) {
|
|
|
315
315
|
}).join("");
|
|
316
316
|
return `<w:fldSimple ${attrs.join(" ")}>${contentXml}</w:fldSimple>`;
|
|
317
317
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
318
|
+
const replayableFormFieldDataXml = createCapturedXmlSanitizer({
|
|
319
|
+
allowedLocalNames: /* @__PURE__ */ new Set(["ffData"]),
|
|
320
|
+
allowedNamespaceUris: WORDPROCESSINGML_NAMESPACE,
|
|
321
|
+
inheritedNamespaceScope: OOXML_NAMESPACE_SCOPE
|
|
322
|
+
});
|
|
323
|
+
/** Serialize a complex field as structural fldChar runs and its content runs. */
|
|
323
324
|
function serializeComplexField(field) {
|
|
324
325
|
const parts = [];
|
|
325
326
|
const structuralFormatting = field.formatting ?? (field.fieldResultIsFallback ? void 0 : field.fieldResult[0]?.formatting);
|
|
326
327
|
const rPrXml = structuralFormatting ? serializeTextFormatting(structuralFormatting) : "";
|
|
327
328
|
const beginAttrs = ["w:fldCharType=\"begin\"", ...fieldStateAttributes(field)];
|
|
328
|
-
|
|
329
|
+
const formFieldDataXml = replayableFormFieldDataXml(field.formFieldDataXml);
|
|
330
|
+
const begin = formFieldDataXml ? `<w:fldChar ${beginAttrs.join(" ")}>${formFieldDataXml}</w:fldChar>` : `<w:fldChar ${beginAttrs.join(" ")}/>`;
|
|
331
|
+
parts.push(`<w:r>${rPrXml}${begin}</w:r>`);
|
|
329
332
|
if (field.fieldCode.length > 0) parts.push(...field.fieldCode.map((run) => serializeRun(run)));
|
|
330
333
|
else if (field.instruction.length > 0) {
|
|
331
334
|
const spaceAttr = field.instruction.startsWith(" ") || field.instruction.endsWith(" ") || field.instruction.includes(" ") ? " xml:space=\"preserve\"" : "";
|
|
332
335
|
parts.push(`<w:r>${rPrXml}<w:instrText${spaceAttr}>${escapeXmlText(field.instruction)}</w:instrText></w:r>`);
|
|
333
336
|
}
|
|
334
337
|
parts.push(`<w:r>${rPrXml}<w:fldChar w:fldCharType="separate"/></w:r>`);
|
|
335
|
-
if (!field.fieldResultIsFallback) parts.push(...field.fieldResult.map((run) => serializeRun(run)));
|
|
338
|
+
if (!field.fieldResultIsFallback || !formFieldDataXml) parts.push(...field.fieldResult.map((run) => serializeRun(run)));
|
|
336
339
|
parts.push(`<w:r>${rPrXml}<w:fldChar w:fldCharType="end"/></w:r>`);
|
|
337
340
|
return parts.join("");
|
|
338
341
|
}
|
|
342
|
+
var UnrepresentableTrackedSimpleFieldError = class extends TaggedError("UnrepresentableTrackedSimpleFieldError") {};
|
|
343
|
+
/** A revision can contain run-level field characters, but not `w:fldSimple`. */
|
|
344
|
+
function serializeTrackedSimpleField(field) {
|
|
345
|
+
const fieldResult = [];
|
|
346
|
+
for (const item of field.content) {
|
|
347
|
+
if (item.type !== "run") throw new UnrepresentableTrackedSimpleFieldError({
|
|
348
|
+
message: `A tracked simple field with ${item.type} result content cannot be serialized as valid OOXML.`,
|
|
349
|
+
contentType: item.type
|
|
350
|
+
});
|
|
351
|
+
fieldResult.push(item);
|
|
352
|
+
}
|
|
353
|
+
return serializeComplexField({
|
|
354
|
+
type: "complexField",
|
|
355
|
+
instruction: field.instruction,
|
|
356
|
+
fieldType: field.fieldType,
|
|
357
|
+
fieldCode: [],
|
|
358
|
+
fieldResult,
|
|
359
|
+
...field.fldLock !== void 0 && { fldLock: field.fldLock },
|
|
360
|
+
...field.dirty !== void 0 && { dirty: field.dirty }
|
|
361
|
+
});
|
|
362
|
+
}
|
|
339
363
|
/**
|
|
340
364
|
* Serialize an inline SDT (w:sdt).
|
|
341
365
|
*
|
|
@@ -413,7 +437,7 @@ function serializeTrackedChange(tag, change) {
|
|
|
413
437
|
case "run": return serializeContentRun(item);
|
|
414
438
|
case "simpleField":
|
|
415
439
|
case "complexField": {
|
|
416
|
-
const xml = item.type === "simpleField" ?
|
|
440
|
+
const xml = item.type === "simpleField" ? serializeTrackedSimpleField(item) : serializeComplexField(item);
|
|
417
441
|
return disposition === "removed" ? rewriteRunTextAsDeleted(xml) : xml;
|
|
418
442
|
}
|
|
419
443
|
case "mathEquation": return item.ommlXml;
|
|
@@ -6,6 +6,7 @@ import { TRANSITIONAL_NAME_BY_STRICT_NAME } from "../strictNames.gen.js";
|
|
|
6
6
|
import { TABLE_LOOK_FLAGS } from "../tableLook.js";
|
|
7
7
|
import { parseTableCellProperties, parseTableGrid, parseTableProperties, parseTablePropertyExceptions, parseTableRowProperties } from "../tableParser.js";
|
|
8
8
|
import { OOXML_NAMESPACE_SCOPE, parseXml } from "../xmlParser.js";
|
|
9
|
+
import { serializeBlockCustomXml } from "./blockCustomXmlSerializer.js";
|
|
9
10
|
import { serializeBlockSdt } from "./blockSdtSerializer.js";
|
|
10
11
|
import { serializeBorder } from "./borderSerializer.js";
|
|
11
12
|
import { serializeBookmarkMarker } from "./markupRangeAttributes.js";
|
|
@@ -456,56 +457,40 @@ const serializeTableGridChange = ({ id, columnWidths }) => {
|
|
|
456
457
|
const columns = columnWidths.map((width) => width === void 0 ? "<w:gridCol/>" : `<w:gridCol w:w="${intAttr(width)}"/>`).join("");
|
|
457
458
|
return `<w:tblGridChange w:id="${intAttr(id)}"><w:tblGrid>${columns}</w:tblGrid></w:tblGridChange>`;
|
|
458
459
|
};
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
*
|
|
462
|
-
* The control's record is on every child it held, so the wrapper is rebuilt
|
|
463
|
-
* by grouping consecutive children that name the same control. Equality is
|
|
464
|
-
* the record's canonical spelling rather than object identity, because the
|
|
465
|
-
* editor carries these records through JSON — a Yjs sync, a snapshot, a
|
|
466
|
-
* structured clone — and hands back an equal record rather than the same one.
|
|
467
|
-
* A wrapper that split in two there would mint a second `w:id` for one
|
|
468
|
-
* control, which is the defect, not the fix.
|
|
469
|
-
*
|
|
470
|
-
* The cost is the other direction: two adjacent rows the author put in two
|
|
471
|
-
* separate but identically spelled controls come back as one. Word mints a
|
|
472
|
-
* distinct `w:id` per control, so that needs a producer that writes none; the
|
|
473
|
-
* inline wrapper stack makes the same trade for the same reason.
|
|
474
|
-
*/
|
|
475
|
-
const contentControlKey = (properties) => canonicalJson(properties);
|
|
476
|
-
/**
|
|
477
|
-
* Re-open each control around the run of children that named it, outermost
|
|
478
|
-
* first.
|
|
479
|
-
*
|
|
480
|
-
* @param depth which layer of the stack this call is opening
|
|
481
|
-
*/
|
|
482
|
-
const serializeControlledChildren = (children, depth) => {
|
|
460
|
+
const tableCarrierKey = (carrier) => carrier.type === "customXml" ? `customXml:${String(carrier.wrapper.id)}` : `sdt:${canonicalJson(carrier.properties)}`;
|
|
461
|
+
const serializeTableCarriers = (children, depth = 0) => {
|
|
483
462
|
const parts = [];
|
|
484
463
|
let index = 0;
|
|
485
464
|
while (index < children.length) {
|
|
486
465
|
const child = children[index];
|
|
487
|
-
|
|
488
|
-
|
|
466
|
+
if (!child) break;
|
|
467
|
+
const carrier = child.carriers[depth];
|
|
468
|
+
if (!carrier) {
|
|
489
469
|
parts.push(child.xml);
|
|
490
470
|
index += 1;
|
|
491
471
|
continue;
|
|
492
472
|
}
|
|
493
|
-
const
|
|
473
|
+
const carrierKey = tableCarrierKey(carrier);
|
|
494
474
|
let end = index + 1;
|
|
495
475
|
while (end < children.length) {
|
|
496
|
-
const next = children[end]?.
|
|
497
|
-
if (next
|
|
476
|
+
const next = children[end]?.carriers[depth];
|
|
477
|
+
if ((next ? tableCarrierKey(next) : void 0) !== carrierKey) break;
|
|
498
478
|
end += 1;
|
|
499
479
|
}
|
|
500
|
-
const inner =
|
|
501
|
-
parts.push(
|
|
480
|
+
const inner = serializeTableCarriers(children.slice(index, end), depth + 1);
|
|
481
|
+
if (carrier.type === "customXml") parts.push(`${carrier.wrapper.openingXml}${inner}${carrier.wrapper.closingXml}`);
|
|
482
|
+
else parts.push(serializeSdtWrapper(carrier.properties, inner));
|
|
502
483
|
index = end;
|
|
503
484
|
}
|
|
504
485
|
return parts.join("");
|
|
505
486
|
};
|
|
487
|
+
const carriersFor = (value) => value.carrierStack ?? [...(value.contentControls ?? []).map((properties) => ({
|
|
488
|
+
type: "sdt",
|
|
489
|
+
properties
|
|
490
|
+
}))];
|
|
506
491
|
/** A capture from the sink, with the controls it sat inside when parsed. */
|
|
507
492
|
const preservedChild = (xml, child) => ({
|
|
508
|
-
|
|
493
|
+
carriers: carriersFor(child),
|
|
509
494
|
xml
|
|
510
495
|
});
|
|
511
496
|
/**
|
|
@@ -517,6 +502,7 @@ function serializeCellContent(content, serializeParagraph) {
|
|
|
517
502
|
case "paragraph": return serializeParagraph(block);
|
|
518
503
|
case "table": return serializeTable(block, serializeParagraph);
|
|
519
504
|
case "blockSdt": return serializeBlockSdt(block, serializeCellBlock);
|
|
505
|
+
case "blockCustomXml": return serializeBlockCustomXml(block, serializeCellBlock);
|
|
520
506
|
case "preservedBlock": return block.xml;
|
|
521
507
|
case "bookmarkStart":
|
|
522
508
|
case "bookmarkEnd": return serializeBookmarkMarker(block);
|
|
@@ -549,10 +535,11 @@ function serializeTableCell(cell, serializeParagraph) {
|
|
|
549
535
|
*/
|
|
550
536
|
const positionedChildren = (preserved, bookmarks) => {
|
|
551
537
|
if (bookmarks === void 0 || bookmarks.length === 0) return preserved;
|
|
552
|
-
return { children: [...preserved?.children ?? [], ...bookmarks.map(({ index, marker, contentControls }) => ({
|
|
538
|
+
return { children: [...preserved?.children ?? [], ...bookmarks.map(({ index, marker, contentControls, carrierStack }) => ({
|
|
553
539
|
index,
|
|
554
540
|
xml: serializeBookmarkMarker(marker),
|
|
555
|
-
...contentControls === void 0 ? {} : { contentControls }
|
|
541
|
+
...contentControls === void 0 ? {} : { contentControls },
|
|
542
|
+
...carrierStack === void 0 ? {} : { carrierStack }
|
|
556
543
|
}))] };
|
|
557
544
|
};
|
|
558
545
|
/**
|
|
@@ -564,8 +551,8 @@ function serializeTableRow(row, serializeParagraph) {
|
|
|
564
551
|
if (tblPrExXml) parts.push(tblPrExXml);
|
|
565
552
|
const trPrXml = serializeTableRowFormatting(row.formatting, row.propertyChanges, row.structuralChange);
|
|
566
553
|
if (trPrXml) parts.push(trPrXml);
|
|
567
|
-
parts.push(
|
|
568
|
-
|
|
554
|
+
parts.push(serializeTableCarriers(withPreservedChildren(row.cells.map((cell) => ({
|
|
555
|
+
carriers: carriersFor(cell),
|
|
569
556
|
xml: serializeTableCell(cell, serializeParagraph)
|
|
570
557
|
})), positionedChildren(row.preserved, row.bookmarks), preservedChild), 0));
|
|
571
558
|
const attrs = serializePreservedAttributes([], row.preservedAttributes);
|
|
@@ -581,8 +568,8 @@ function serializeTable(table, serializeParagraph) {
|
|
|
581
568
|
return `<w:tbl>${[
|
|
582
569
|
serializeTableFormatting(table.formatting, table.propertyChanges) || "<w:tblPr/>",
|
|
583
570
|
serializeTableGrid(table),
|
|
584
|
-
|
|
585
|
-
|
|
571
|
+
serializeTableCarriers(withPreservedChildren(table.rows.map((row) => ({
|
|
572
|
+
carriers: carriersFor(row),
|
|
586
573
|
xml: serializeTableRow(row, serializeParagraph)
|
|
587
574
|
})), positionedChildren(table.preserved, table.bookmarks), preservedChild), 0)
|
|
588
575
|
].join("")}</w:tbl>`;
|
|
@@ -203,7 +203,7 @@ const flattenBlocks = (content) => {
|
|
|
203
203
|
out.push(block);
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
|
-
if (block.type !== "blockSdt") return;
|
|
206
|
+
if (block.type !== "blockSdt" && block.type !== "blockCustomXml") return;
|
|
207
207
|
for (const child of block.content) visit(child);
|
|
208
208
|
};
|
|
209
209
|
for (const block of content) visit(block);
|
|
@@ -467,7 +467,7 @@ const collectTableParagraphs = (table) => {
|
|
|
467
467
|
const collectBlocks = (blocks) => {
|
|
468
468
|
for (const item of blocks) if (item.type === "paragraph") out.push(item);
|
|
469
469
|
else if (item.type === "table") out.push(...collectTableParagraphs(item));
|
|
470
|
-
else if (item.type === "blockSdt") collectBlocks(item.content);
|
|
470
|
+
else if (item.type === "blockSdt" || item.type === "blockCustomXml") collectBlocks(item.content);
|
|
471
471
|
};
|
|
472
472
|
for (const row of table.rows) for (const cell of row.cells) collectBlocks(cell.content);
|
|
473
473
|
return out;
|
|
@@ -476,7 +476,7 @@ const cloneTableForTarget = ({ table, editableParagraphIds, paraIds, styleCloner
|
|
|
476
476
|
const paragraphs = [];
|
|
477
477
|
const cloneBlocks = (blocks) => blocks.map((item) => {
|
|
478
478
|
if (item.type === "table") return cloneTable(item);
|
|
479
|
-
if (item.type === "blockSdt") return {
|
|
479
|
+
if (item.type === "blockSdt" || item.type === "blockCustomXml") return {
|
|
480
480
|
...structuredClone(item),
|
|
481
481
|
content: cloneBlocks(item.content)
|
|
482
482
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { document_d_exports } from "../types/document.js";
|
|
2
2
|
import { NumberingMap } from "./numberingParser.js";
|
|
3
|
+
import { ParseContext } from "./parseContext.js";
|
|
3
4
|
import { XmlElement } from "./xmlParser.js";
|
|
5
|
+
import { OwnedElsewhere } from "./containerChildren.js";
|
|
4
6
|
import { PreviewLedger } from "./previewBudget.js";
|
|
5
7
|
import { StyleMap } from "./styleParser.js";
|
|
6
8
|
//#region src/docx/tableParser.d.ts
|
|
@@ -68,6 +70,8 @@ declare function parseTableProperties(tblPrElement: XmlElement | null): document
|
|
|
68
70
|
* {@link parseTablePropertyExceptionChanges}.
|
|
69
71
|
*/
|
|
70
72
|
declare function parseTablePropertyExceptions(tblPrExElement: XmlElement | null): document_d_exports.TablePropertyExceptionFormatting | undefined;
|
|
73
|
+
declare function isTableCellMergeRevisionValue(value: unknown): value is "continue" | "rest";
|
|
74
|
+
declare function isTableCellMergeRevisionContinuation(value: "continue" | "rest" | undefined): boolean;
|
|
71
75
|
/**
|
|
72
76
|
* Parse table row properties (w:trPr)
|
|
73
77
|
*
|
|
@@ -89,6 +93,20 @@ declare function parseConditionalFormatStyle(cnfElement: XmlElement | null): doc
|
|
|
89
93
|
* @returns Parsed cell formatting
|
|
90
94
|
*/
|
|
91
95
|
declare function parseTableCellProperties(tcPrElement: XmlElement | null): document_d_exports.TableCellFormatting | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Record a `CT_SdtRow` / `CT_SdtCell` on the rows or cells it wrapped.
|
|
98
|
+
*
|
|
99
|
+
* Both are transparent: what they hold is ordinary rows and cells, and the
|
|
100
|
+
* control adds properties and an end mark. folio keeps the children modelled
|
|
101
|
+
* and puts the control on each of them rather than modelling a wrapper
|
|
102
|
+
* between them, because a table's children are rows and a row's are cells,
|
|
103
|
+
* and neither has a node to spare for something that is not one.
|
|
104
|
+
*
|
|
105
|
+
* Outermost first, so a control inside a control — a bound row inside a
|
|
106
|
+
* repeating section — comes back nested the way it was written. The
|
|
107
|
+
* recursion reads the inner one first, so the outer prepends.
|
|
108
|
+
*/
|
|
109
|
+
type TablePreservedChild = NonNullable<document_d_exports.TablePreservedMarkup["children"]>[number];
|
|
92
110
|
/**
|
|
93
111
|
* Parse table cell content, including nested block controls.
|
|
94
112
|
*
|
|
@@ -105,6 +123,58 @@ type TableParseOptions = {
|
|
|
105
123
|
rootXmlns?: Record<string, string>;
|
|
106
124
|
/** The ledger of the package this table belongs to; a table read on its own has none. */
|
|
107
125
|
previews?: PreviewLedger;
|
|
126
|
+
context?: ParseContext | undefined;
|
|
127
|
+
};
|
|
128
|
+
/** What a table's rows, cells and blocks read: the ledger is settled where the walk enters. */
|
|
129
|
+
type TableScope = TableParseOptions & {
|
|
130
|
+
previews: PreviewLedger;
|
|
131
|
+
};
|
|
132
|
+
/** The parts and maps a table's content is read against. */
|
|
133
|
+
type TableParseResources = {
|
|
134
|
+
styles: StyleMap | null;
|
|
135
|
+
theme: document_d_exports.Theme | null;
|
|
136
|
+
numbering: NumberingMap | null;
|
|
137
|
+
rels: document_d_exports.RelationshipMap | null;
|
|
138
|
+
media: Map<string, document_d_exports.MediaFile> | null;
|
|
139
|
+
};
|
|
140
|
+
/** One cell's block sequence, or a block control's inside it, as it is read. */
|
|
141
|
+
type CellChildrenWalk = {
|
|
142
|
+
resources: TableParseResources;
|
|
143
|
+
options: TableScope;
|
|
144
|
+
modelled: document_d_exports.TableCellBlock[];
|
|
145
|
+
captured: document_d_exports.PreservedChild[];
|
|
146
|
+
};
|
|
147
|
+
declare const CELL_CONTENT_HANDLERS: {
|
|
148
|
+
readonly p: (child: XmlElement, { resources: { styles, theme, numbering, rels, media }, options, modelled }: CellChildrenWalk) => void;
|
|
149
|
+
readonly tbl: (child: XmlElement, { resources: { styles, theme, numbering, rels, media }, options, modelled }: CellChildrenWalk) => void;
|
|
150
|
+
readonly sdt: (child: XmlElement, { resources, options, modelled }: CellChildrenWalk) => "capture" | undefined;
|
|
151
|
+
readonly customXml: (child: XmlElement, { resources, options, modelled }: CellChildrenWalk) => void;
|
|
152
|
+
readonly bookmarkStart: (child: XmlElement, { modelled }: CellChildrenWalk) => void;
|
|
153
|
+
readonly bookmarkEnd: (child: XmlElement, { modelled }: CellChildrenWalk) => void;
|
|
154
|
+
readonly tcPr: OwnedElsewhere<"block-content", "tcPr">;
|
|
155
|
+
readonly sectPr: "capture";
|
|
156
|
+
readonly altChunk: "capture";
|
|
157
|
+
readonly commentRangeEnd: "capture";
|
|
158
|
+
readonly commentRangeStart: "capture";
|
|
159
|
+
readonly customXmlDelRangeEnd: "capture";
|
|
160
|
+
readonly customXmlDelRangeStart: "capture";
|
|
161
|
+
readonly customXmlInsRangeEnd: "capture";
|
|
162
|
+
readonly customXmlInsRangeStart: "capture";
|
|
163
|
+
readonly customXmlMoveFromRangeEnd: "capture";
|
|
164
|
+
readonly customXmlMoveFromRangeStart: "capture";
|
|
165
|
+
readonly customXmlMoveToRangeEnd: "capture";
|
|
166
|
+
readonly customXmlMoveToRangeStart: "capture";
|
|
167
|
+
readonly del: "capture";
|
|
168
|
+
readonly ins: "capture";
|
|
169
|
+
readonly moveFrom: "capture";
|
|
170
|
+
readonly moveFromRangeEnd: "capture";
|
|
171
|
+
readonly moveFromRangeStart: "capture";
|
|
172
|
+
readonly moveTo: "capture";
|
|
173
|
+
readonly moveToRangeEnd: "capture";
|
|
174
|
+
readonly moveToRangeStart: "capture";
|
|
175
|
+
readonly permEnd: "capture";
|
|
176
|
+
readonly permStart: "capture";
|
|
177
|
+
readonly proofErr: "capture";
|
|
108
178
|
};
|
|
109
179
|
/**
|
|
110
180
|
* Parse a table cell (w:tc)
|
|
@@ -118,6 +188,49 @@ type TableParseOptions = {
|
|
|
118
188
|
* @returns Parsed table cell
|
|
119
189
|
*/
|
|
120
190
|
declare function parseTableCell(tcElement: XmlElement, styles: StyleMap | null, theme: document_d_exports.Theme | null, numbering: NumberingMap | null, rels: document_d_exports.RelationshipMap | null, media: Map<string, document_d_exports.MediaFile> | null, options?: TableParseOptions): document_d_exports.TableCell;
|
|
191
|
+
/** One row's children, or a cell-level content control's, as they are read. */
|
|
192
|
+
type RowChildrenWalk = {
|
|
193
|
+
resources: TableParseResources;
|
|
194
|
+
options: TableScope;
|
|
195
|
+
row: document_d_exports.TableRow;
|
|
196
|
+
bookmarks: document_d_exports.PositionedBookmarkMarker[];
|
|
197
|
+
preservedChildren: TablePreservedChild[];
|
|
198
|
+
customXmlIdentity: {
|
|
199
|
+
next: number;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
declare const ROW_CONTENT_HANDLERS: {
|
|
203
|
+
readonly commentRangeEnd: "capture";
|
|
204
|
+
readonly commentRangeStart: "capture";
|
|
205
|
+
readonly customXmlPr: "capture";
|
|
206
|
+
readonly customXmlDelRangeEnd: "capture";
|
|
207
|
+
readonly customXmlDelRangeStart: "capture";
|
|
208
|
+
readonly customXmlInsRangeEnd: "capture";
|
|
209
|
+
readonly customXmlInsRangeStart: "capture";
|
|
210
|
+
readonly customXmlMoveFromRangeEnd: "capture";
|
|
211
|
+
readonly customXmlMoveFromRangeStart: "capture";
|
|
212
|
+
readonly customXmlMoveToRangeEnd: "capture";
|
|
213
|
+
readonly customXmlMoveToRangeStart: "capture";
|
|
214
|
+
readonly del: "capture";
|
|
215
|
+
readonly ins: "capture";
|
|
216
|
+
readonly moveFrom: "capture";
|
|
217
|
+
readonly moveFromRangeEnd: "capture";
|
|
218
|
+
readonly moveFromRangeStart: "capture";
|
|
219
|
+
readonly moveTo: "capture";
|
|
220
|
+
readonly moveToRangeEnd: "capture";
|
|
221
|
+
readonly moveToRangeStart: "capture";
|
|
222
|
+
readonly permEnd: "capture";
|
|
223
|
+
readonly permStart: "capture";
|
|
224
|
+
readonly proofErr: "capture";
|
|
225
|
+
readonly tr: (child: XmlElement, { options }: RowChildrenWalk) => "capture";
|
|
226
|
+
readonly trPr: OwnedElsewhere<"row-content", "trPr">;
|
|
227
|
+
readonly tblPrEx: OwnedElsewhere<"row-content", "tblPrEx">;
|
|
228
|
+
readonly tc: (child: XmlElement, { resources: { styles, theme, numbering, rels, media }, options, row }: RowChildrenWalk) => void;
|
|
229
|
+
readonly sdt: (child: XmlElement, walk: RowChildrenWalk) => "capture" | undefined;
|
|
230
|
+
readonly customXml: (child: XmlElement, walk: RowChildrenWalk) => "capture" | undefined;
|
|
231
|
+
readonly bookmarkStart: (child: XmlElement, { row, bookmarks }: RowChildrenWalk) => void;
|
|
232
|
+
readonly bookmarkEnd: (child: XmlElement, { row, bookmarks }: RowChildrenWalk) => void;
|
|
233
|
+
};
|
|
121
234
|
/**
|
|
122
235
|
* Parse a table row (w:tr)
|
|
123
236
|
*
|
|
@@ -137,6 +250,49 @@ declare function parseTableRow(trElement: XmlElement, styles: StyleMap | null, t
|
|
|
137
250
|
* @returns Array of column widths in twips
|
|
138
251
|
*/
|
|
139
252
|
declare function parseTableGrid(tblGridElement: XmlElement | null): number[] | undefined;
|
|
253
|
+
/** One table's children, or a row-level content control's, as they are read. */
|
|
254
|
+
type TableChildrenWalk = {
|
|
255
|
+
resources: TableParseResources;
|
|
256
|
+
options: TableScope;
|
|
257
|
+
table: document_d_exports.Table;
|
|
258
|
+
rowsWithGridOffsets: Set<number>;
|
|
259
|
+
bookmarks: document_d_exports.PositionedBookmarkMarker[];
|
|
260
|
+
preservedChildren: TablePreservedChild[];
|
|
261
|
+
customXmlIdentity: {
|
|
262
|
+
next: number;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
declare const TABLE_CONTENT_HANDLERS: {
|
|
266
|
+
readonly bookmarkStart: (child: XmlElement, { table, bookmarks }: TableChildrenWalk) => void;
|
|
267
|
+
readonly bookmarkEnd: (child: XmlElement, { table, bookmarks }: TableChildrenWalk) => void;
|
|
268
|
+
readonly commentRangeEnd: "capture";
|
|
269
|
+
readonly commentRangeStart: "capture";
|
|
270
|
+
readonly customXmlPr: "capture";
|
|
271
|
+
readonly customXmlDelRangeEnd: "capture";
|
|
272
|
+
readonly customXmlDelRangeStart: "capture";
|
|
273
|
+
readonly customXmlInsRangeEnd: "capture";
|
|
274
|
+
readonly customXmlInsRangeStart: "capture";
|
|
275
|
+
readonly customXmlMoveFromRangeEnd: "capture";
|
|
276
|
+
readonly customXmlMoveFromRangeStart: "capture";
|
|
277
|
+
readonly customXmlMoveToRangeEnd: "capture";
|
|
278
|
+
readonly customXmlMoveToRangeStart: "capture";
|
|
279
|
+
readonly del: "capture";
|
|
280
|
+
readonly ins: "capture";
|
|
281
|
+
readonly moveFrom: "capture";
|
|
282
|
+
readonly moveFromRangeEnd: "capture";
|
|
283
|
+
readonly moveFromRangeStart: "capture";
|
|
284
|
+
readonly moveTo: "capture";
|
|
285
|
+
readonly moveToRangeEnd: "capture";
|
|
286
|
+
readonly moveToRangeStart: "capture";
|
|
287
|
+
readonly permEnd: "capture";
|
|
288
|
+
readonly permStart: "capture";
|
|
289
|
+
readonly proofErr: "capture";
|
|
290
|
+
readonly tblPr: OwnedElsewhere<"table-content", "tblPr">;
|
|
291
|
+
readonly tblGrid: OwnedElsewhere<"table-content", "tblGrid">;
|
|
292
|
+
readonly tr: (child: XmlElement, { resources: { styles, theme, numbering, rels, media }, options, table, rowsWithGridOffsets }: TableChildrenWalk) => void;
|
|
293
|
+
readonly sdt: (child: XmlElement, walk: TableChildrenWalk) => "capture" | undefined;
|
|
294
|
+
readonly customXml: (child: XmlElement, walk: TableChildrenWalk) => "capture" | undefined;
|
|
295
|
+
};
|
|
140
296
|
/**
|
|
141
297
|
* Parse a table element (w:tbl)
|
|
142
298
|
*
|
|
@@ -215,4 +371,4 @@ declare function getHeaderRows(table: document_d_exports.Table): document_d_expo
|
|
|
215
371
|
*/
|
|
216
372
|
declare function isFloatingTable(table: document_d_exports.Table): boolean;
|
|
217
373
|
//#endregion
|
|
218
|
-
export { MAX_TABLE_COLUMNS, getHeaderRows, getTableColumnCount, getTableRowCount, getTableText, hasHeaderRow, isCellHorizontallyMerged, isCellMergeContinuation, isCellMergeStart, isFloatingTable, parseCellMargins, parseConditionalFormatStyle, parseFloatingTableProperties, parseTable, parseTableBorders, parseTableCell, parseTableCellProperties, parseTableGrid, parseTableLook, parseTableMeasurement, parseTableProperties, parseTablePropertyExceptions, parseTableRow, parseTableRowProperties };
|
|
374
|
+
export { CELL_CONTENT_HANDLERS, MAX_TABLE_COLUMNS, ROW_CONTENT_HANDLERS, TABLE_CONTENT_HANDLERS, getHeaderRows, getTableColumnCount, getTableRowCount, getTableText, hasHeaderRow, isCellHorizontallyMerged, isCellMergeContinuation, isCellMergeStart, isFloatingTable, isTableCellMergeRevisionContinuation, isTableCellMergeRevisionValue, parseCellMargins, parseConditionalFormatStyle, parseFloatingTableProperties, parseTable, parseTableBorders, parseTableCell, parseTableCellProperties, parseTableGrid, parseTableLook, parseTableMeasurement, parseTableProperties, parseTablePropertyExceptions, parseTableRow, parseTableRowProperties };
|