@harbour-enterprises/superdoc 1.8.1-next.3 → 1.8.2-next.1
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/chunks/{PdfViewer-BMQ_aatT.es.js → PdfViewer-B8zn6M2I.es.js} +2 -2
- package/dist/chunks/{PdfViewer-CG3fXB6W.cjs → PdfViewer-DBHRMd3z.cjs} +2 -2
- package/dist/chunks/{SuperConverter-0lz82cmH.es.js → SuperConverter-CLZ8o__p.es.js} +1 -1
- package/dist/chunks/{SuperConverter-C4jc-A34.cjs → SuperConverter-CzZpTS13.cjs} +1 -1
- package/dist/chunks/{index-Cn36ZWmU.cjs → index-BTwCQoeP.cjs} +4 -4
- package/dist/chunks/{index-B__DcNBW.cjs → index-CAbg8dAQ.cjs} +347 -367
- package/dist/chunks/{index-0in1nXsV.es.js → index-DHWm6zEW.es.js} +4 -4
- package/dist/chunks/{index-DPmjm9Nw.es.js → index-DR6N6rCG.es.js} +347 -367
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +350 -370
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-C8_CqJxM.cjs");
|
|
3
3
|
const helpers$1 = require("./helpers-nOdwpmwb.cjs");
|
|
4
|
-
const superEditor_converter = require("./SuperConverter-
|
|
4
|
+
const superEditor_converter = require("./SuperConverter-CzZpTS13.cjs");
|
|
5
5
|
const vue = require("./vue-De9wkgLl.cjs");
|
|
6
6
|
require("./jszip.min-BPh2MMAa.cjs");
|
|
7
7
|
const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
|
|
@@ -15795,7 +15795,7 @@ const canUseDOM = () => {
|
|
|
15795
15795
|
return false;
|
|
15796
15796
|
}
|
|
15797
15797
|
};
|
|
15798
|
-
const summaryVersion = "1.8.
|
|
15798
|
+
const summaryVersion = "1.8.2-next.1";
|
|
15799
15799
|
const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
|
|
15800
15800
|
const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
|
|
15801
15801
|
function mapAttributes(attrs) {
|
|
@@ -18518,7 +18518,7 @@ class Editor extends EventEmitter {
|
|
|
18518
18518
|
* Process collaboration migrations
|
|
18519
18519
|
*/
|
|
18520
18520
|
processCollaborationMigrations() {
|
|
18521
|
-
console.debug("[checkVersionMigrations] Current editor version", "1.8.
|
|
18521
|
+
console.debug("[checkVersionMigrations] Current editor version", "1.8.2-next.1");
|
|
18522
18522
|
if (!this.options.ydoc) return;
|
|
18523
18523
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
18524
18524
|
let docVersion = metaMap.get("version");
|
|
@@ -34387,22 +34387,26 @@ function applyTocMetadata(blocks, metadata) {
|
|
|
34387
34387
|
}
|
|
34388
34388
|
});
|
|
34389
34389
|
}
|
|
34390
|
-
function processTocChildren(children, metadata, context, outputArrays
|
|
34390
|
+
function processTocChildren(children, metadata, context, outputArrays) {
|
|
34391
|
+
const paragraphConverter = context.converters.paragraphToFlowBlocks;
|
|
34391
34392
|
const { docPartGallery, docPartObjectId, tocInstruction } = metadata;
|
|
34392
34393
|
const { blocks, recordBlockKind } = outputArrays;
|
|
34393
34394
|
children.forEach((child) => {
|
|
34394
34395
|
if (child.type === "paragraph") {
|
|
34395
|
-
const paragraphBlocks = paragraphConverter(
|
|
34396
|
-
child,
|
|
34397
|
-
context.nextBlockId,
|
|
34398
|
-
context.positions,
|
|
34399
|
-
context.defaultFont,
|
|
34400
|
-
context.defaultSize,
|
|
34401
|
-
context.styleContext,
|
|
34402
|
-
context.
|
|
34403
|
-
context.bookmarks,
|
|
34404
|
-
context.hyperlinkConfig
|
|
34405
|
-
|
|
34396
|
+
const paragraphBlocks = paragraphConverter({
|
|
34397
|
+
para: child,
|
|
34398
|
+
nextBlockId: context.nextBlockId,
|
|
34399
|
+
positions: context.positions,
|
|
34400
|
+
defaultFont: context.defaultFont,
|
|
34401
|
+
defaultSize: context.defaultSize,
|
|
34402
|
+
styleContext: context.styleContext,
|
|
34403
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
34404
|
+
bookmarks: context.bookmarks,
|
|
34405
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
34406
|
+
converters: context.converters,
|
|
34407
|
+
enableComments: context.enableComments,
|
|
34408
|
+
converterContext: context.converterContext
|
|
34409
|
+
});
|
|
34406
34410
|
applyTocMetadata(paragraphBlocks, {
|
|
34407
34411
|
gallery: docPartGallery,
|
|
34408
34412
|
uniqueId: docPartObjectId,
|
|
@@ -34423,8 +34427,7 @@ function processTocChildren(children, metadata, context, outputArrays, paragraph
|
|
|
34423
34427
|
child.content,
|
|
34424
34428
|
{ docPartGallery, docPartObjectId, tocInstruction: finalInstruction, sdtMetadata: metadata.sdtMetadata },
|
|
34425
34429
|
context,
|
|
34426
|
-
outputArrays
|
|
34427
|
-
paragraphConverter
|
|
34430
|
+
outputArrays
|
|
34428
34431
|
);
|
|
34429
34432
|
}
|
|
34430
34433
|
});
|
|
@@ -34442,17 +34445,17 @@ function handleTableOfContentsNode(node, context) {
|
|
|
34442
34445
|
trackedChangesConfig,
|
|
34443
34446
|
bookmarks,
|
|
34444
34447
|
hyperlinkConfig,
|
|
34445
|
-
converters
|
|
34448
|
+
converters: converters2,
|
|
34449
|
+
converterContext,
|
|
34450
|
+
themeColors,
|
|
34451
|
+
enableComments
|
|
34446
34452
|
} = context;
|
|
34447
34453
|
const tocInstruction = getNodeInstruction(node);
|
|
34448
|
-
const paragraphToFlowBlocks2 =
|
|
34449
|
-
if (!paragraphToFlowBlocks2) {
|
|
34450
|
-
return;
|
|
34451
|
-
}
|
|
34454
|
+
const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
|
|
34452
34455
|
node.content.forEach((child) => {
|
|
34453
34456
|
if (child.type === "paragraph") {
|
|
34454
|
-
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
34455
|
-
child,
|
|
34457
|
+
const paragraphBlocks = paragraphToFlowBlocks2({
|
|
34458
|
+
para: child,
|
|
34456
34459
|
nextBlockId,
|
|
34457
34460
|
positions,
|
|
34458
34461
|
defaultFont,
|
|
@@ -34460,8 +34463,12 @@ function handleTableOfContentsNode(node, context) {
|
|
|
34460
34463
|
styleContext,
|
|
34461
34464
|
trackedChangesConfig,
|
|
34462
34465
|
bookmarks,
|
|
34463
|
-
|
|
34464
|
-
|
|
34466
|
+
themeColors,
|
|
34467
|
+
hyperlinkConfig,
|
|
34468
|
+
converters: converters2,
|
|
34469
|
+
enableComments,
|
|
34470
|
+
converterContext
|
|
34471
|
+
});
|
|
34465
34472
|
paragraphBlocks.forEach((block) => {
|
|
34466
34473
|
if (block.kind === "paragraph") {
|
|
34467
34474
|
if (!block.attrs) block.attrs = {};
|
|
@@ -34501,12 +34508,11 @@ function handleIndexNode(node, context) {
|
|
|
34501
34508
|
bookmarks,
|
|
34502
34509
|
hyperlinkConfig,
|
|
34503
34510
|
sectionState,
|
|
34504
|
-
converters
|
|
34511
|
+
converters: converters2,
|
|
34512
|
+
themeColors,
|
|
34513
|
+
enableComments
|
|
34505
34514
|
} = context;
|
|
34506
|
-
const paragraphToFlowBlocks2 =
|
|
34507
|
-
if (!paragraphToFlowBlocks2) {
|
|
34508
|
-
return;
|
|
34509
|
-
}
|
|
34515
|
+
const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
|
|
34510
34516
|
children.forEach((child) => {
|
|
34511
34517
|
if (child.type !== "paragraph") {
|
|
34512
34518
|
return;
|
|
@@ -34523,8 +34529,8 @@ function handleIndexNode(node, context) {
|
|
|
34523
34529
|
sectionState.currentSectionIndex++;
|
|
34524
34530
|
}
|
|
34525
34531
|
}
|
|
34526
|
-
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
34527
|
-
child,
|
|
34532
|
+
const paragraphBlocks = paragraphToFlowBlocks2({
|
|
34533
|
+
para: child,
|
|
34528
34534
|
nextBlockId,
|
|
34529
34535
|
positions,
|
|
34530
34536
|
defaultFont,
|
|
@@ -34533,10 +34539,11 @@ function handleIndexNode(node, context) {
|
|
|
34533
34539
|
trackedChangesConfig,
|
|
34534
34540
|
bookmarks,
|
|
34535
34541
|
hyperlinkConfig,
|
|
34536
|
-
|
|
34537
|
-
|
|
34538
|
-
|
|
34539
|
-
|
|
34542
|
+
themeColors,
|
|
34543
|
+
converterContext: context.converterContext,
|
|
34544
|
+
enableComments,
|
|
34545
|
+
converters: converters2
|
|
34546
|
+
});
|
|
34540
34547
|
paragraphBlocks.forEach((block) => {
|
|
34541
34548
|
blocks.push(block);
|
|
34542
34549
|
recordBlockKind(block.kind);
|
|
@@ -34557,17 +34564,17 @@ function handleStructuredContentBlockNode(node, context) {
|
|
|
34557
34564
|
trackedChangesConfig,
|
|
34558
34565
|
bookmarks,
|
|
34559
34566
|
hyperlinkConfig,
|
|
34560
|
-
converters
|
|
34567
|
+
converters: converters2,
|
|
34568
|
+
converterContext,
|
|
34569
|
+
enableComments,
|
|
34570
|
+
themeColors
|
|
34561
34571
|
} = context;
|
|
34562
34572
|
const structuredContentMetadata = resolveNodeSdtMetadata(node, "structuredContentBlock");
|
|
34563
|
-
const paragraphToFlowBlocks2 =
|
|
34564
|
-
if (!paragraphToFlowBlocks2) {
|
|
34565
|
-
return;
|
|
34566
|
-
}
|
|
34573
|
+
const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
|
|
34567
34574
|
node.content.forEach((child) => {
|
|
34568
34575
|
if (child.type === "paragraph") {
|
|
34569
|
-
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
34570
|
-
child,
|
|
34576
|
+
const paragraphBlocks = paragraphToFlowBlocks2({
|
|
34577
|
+
para: child,
|
|
34571
34578
|
nextBlockId,
|
|
34572
34579
|
positions,
|
|
34573
34580
|
defaultFont,
|
|
@@ -34575,8 +34582,12 @@ function handleStructuredContentBlockNode(node, context) {
|
|
|
34575
34582
|
styleContext,
|
|
34576
34583
|
trackedChangesConfig,
|
|
34577
34584
|
bookmarks,
|
|
34578
|
-
hyperlinkConfig
|
|
34579
|
-
|
|
34585
|
+
hyperlinkConfig,
|
|
34586
|
+
themeColors,
|
|
34587
|
+
enableComments,
|
|
34588
|
+
converters: converters2,
|
|
34589
|
+
converterContext
|
|
34590
|
+
});
|
|
34580
34591
|
applySdtMetadataToParagraphBlocks(
|
|
34581
34592
|
paragraphBlocks.filter((b2) => b2.kind === "paragraph"),
|
|
34582
34593
|
structuredContentMetadata
|
|
@@ -34586,10 +34597,10 @@ function handleStructuredContentBlockNode(node, context) {
|
|
|
34586
34597
|
recordBlockKind(block.kind);
|
|
34587
34598
|
});
|
|
34588
34599
|
} else if (child.type === "table") {
|
|
34589
|
-
const tableNodeToBlock2 =
|
|
34600
|
+
const tableNodeToBlock2 = converters2?.tableNodeToBlock;
|
|
34590
34601
|
if (tableNodeToBlock2) {
|
|
34591
|
-
const tableBlock = tableNodeToBlock2(
|
|
34592
|
-
child,
|
|
34602
|
+
const tableBlock = tableNodeToBlock2({
|
|
34603
|
+
node: child,
|
|
34593
34604
|
nextBlockId,
|
|
34594
34605
|
positions,
|
|
34595
34606
|
defaultFont,
|
|
@@ -34597,8 +34608,12 @@ function handleStructuredContentBlockNode(node, context) {
|
|
|
34597
34608
|
styleContext,
|
|
34598
34609
|
trackedChangesConfig,
|
|
34599
34610
|
bookmarks,
|
|
34600
|
-
hyperlinkConfig
|
|
34601
|
-
|
|
34611
|
+
hyperlinkConfig,
|
|
34612
|
+
themeColors,
|
|
34613
|
+
enableComments,
|
|
34614
|
+
converters: converters2,
|
|
34615
|
+
converterContext
|
|
34616
|
+
});
|
|
34602
34617
|
if (tableBlock) {
|
|
34603
34618
|
applySdtMetadataToTableBlock(tableBlock, structuredContentMetadata);
|
|
34604
34619
|
blocks.push(tableBlock);
|
|
@@ -34608,19 +34623,22 @@ function handleStructuredContentBlockNode(node, context) {
|
|
|
34608
34623
|
}
|
|
34609
34624
|
});
|
|
34610
34625
|
}
|
|
34611
|
-
function processParagraphChild(child, sectionMetadata, context, output,
|
|
34612
|
-
const paragraphBlocks =
|
|
34613
|
-
child,
|
|
34614
|
-
context.nextBlockId,
|
|
34615
|
-
context.positions,
|
|
34616
|
-
context.defaultFont,
|
|
34617
|
-
context.defaultSize,
|
|
34618
|
-
context.styleContext,
|
|
34619
|
-
void 0,
|
|
34626
|
+
function processParagraphChild(child, sectionMetadata, context, output, converters2) {
|
|
34627
|
+
const paragraphBlocks = converters2.paragraphToFlowBlocks({
|
|
34628
|
+
para: child,
|
|
34629
|
+
nextBlockId: context.nextBlockId,
|
|
34630
|
+
positions: context.positions,
|
|
34631
|
+
defaultFont: context.defaultFont,
|
|
34632
|
+
defaultSize: context.defaultSize,
|
|
34633
|
+
styleContext: context.styleContext,
|
|
34634
|
+
trackedChangesConfig: void 0,
|
|
34620
34635
|
// trackedChanges
|
|
34621
|
-
context.bookmarks,
|
|
34622
|
-
context.hyperlinkConfig
|
|
34623
|
-
|
|
34636
|
+
bookmarks: context.bookmarks,
|
|
34637
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
34638
|
+
converters: converters2,
|
|
34639
|
+
enableComments: context.enableComments,
|
|
34640
|
+
converterContext: context.converterContext
|
|
34641
|
+
});
|
|
34624
34642
|
applySdtMetadataToParagraphBlocks(
|
|
34625
34643
|
paragraphBlocks.filter((b2) => b2.kind === "paragraph"),
|
|
34626
34644
|
sectionMetadata
|
|
@@ -34630,26 +34648,29 @@ function processParagraphChild(child, sectionMetadata, context, output, converte
|
|
|
34630
34648
|
output.recordBlockKind(block.kind);
|
|
34631
34649
|
});
|
|
34632
34650
|
}
|
|
34633
|
-
function processTableChild(child, sectionMetadata, context, output,
|
|
34634
|
-
const tableBlock =
|
|
34635
|
-
child,
|
|
34636
|
-
context.nextBlockId,
|
|
34637
|
-
context.positions,
|
|
34638
|
-
context.defaultFont,
|
|
34639
|
-
context.defaultSize,
|
|
34640
|
-
context.styleContext,
|
|
34641
|
-
|
|
34642
|
-
|
|
34643
|
-
context.hyperlinkConfig
|
|
34644
|
-
|
|
34651
|
+
function processTableChild(child, sectionMetadata, context, output, converters2) {
|
|
34652
|
+
const tableBlock = converters2.tableNodeToBlock({
|
|
34653
|
+
node: child,
|
|
34654
|
+
nextBlockId: context.nextBlockId,
|
|
34655
|
+
positions: context.positions,
|
|
34656
|
+
defaultFont: context.defaultFont,
|
|
34657
|
+
defaultSize: context.defaultSize,
|
|
34658
|
+
styleContext: context.styleContext,
|
|
34659
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
34660
|
+
bookmarks: context.bookmarks,
|
|
34661
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
34662
|
+
enableComments: context.enableComments,
|
|
34663
|
+
converters: converters2,
|
|
34664
|
+
converterContext: context.converterContext
|
|
34665
|
+
});
|
|
34645
34666
|
if (tableBlock) {
|
|
34646
34667
|
applySdtMetadataToTableBlock(tableBlock, sectionMetadata);
|
|
34647
34668
|
output.blocks.push(tableBlock);
|
|
34648
34669
|
output.recordBlockKind(tableBlock.kind);
|
|
34649
34670
|
}
|
|
34650
34671
|
}
|
|
34651
|
-
function processImageChild(child, sectionMetadata, context, output,
|
|
34652
|
-
const imageBlock =
|
|
34672
|
+
function processImageChild(child, sectionMetadata, context, output, converters2) {
|
|
34673
|
+
const imageBlock = converters2.imageNodeToBlock(child, context.nextBlockId, context.positions);
|
|
34653
34674
|
if (imageBlock && imageBlock.kind === "image") {
|
|
34654
34675
|
if (sectionMetadata) {
|
|
34655
34676
|
if (!imageBlock.attrs) imageBlock.attrs = {};
|
|
@@ -34659,22 +34680,25 @@ function processImageChild(child, sectionMetadata, context, output, converters)
|
|
|
34659
34680
|
output.recordBlockKind(imageBlock.kind);
|
|
34660
34681
|
}
|
|
34661
34682
|
}
|
|
34662
|
-
function processNestedStructuredContent(child, sectionMetadata, context, output,
|
|
34683
|
+
function processNestedStructuredContent(child, sectionMetadata, context, output, converters2) {
|
|
34663
34684
|
const nestedMetadata = resolveNodeSdtMetadata(child, "structuredContentBlock");
|
|
34664
34685
|
child.content?.forEach((grandchild) => {
|
|
34665
34686
|
if (grandchild.type === "paragraph") {
|
|
34666
|
-
const paragraphBlocks =
|
|
34667
|
-
grandchild,
|
|
34668
|
-
context.nextBlockId,
|
|
34669
|
-
context.positions,
|
|
34670
|
-
context.defaultFont,
|
|
34671
|
-
context.defaultSize,
|
|
34672
|
-
context.styleContext,
|
|
34673
|
-
|
|
34674
|
-
|
|
34675
|
-
context.
|
|
34676
|
-
|
|
34677
|
-
|
|
34687
|
+
const paragraphBlocks = converters2.paragraphToFlowBlocks({
|
|
34688
|
+
para: grandchild,
|
|
34689
|
+
nextBlockId: context.nextBlockId,
|
|
34690
|
+
positions: context.positions,
|
|
34691
|
+
defaultFont: context.defaultFont,
|
|
34692
|
+
defaultSize: context.defaultSize,
|
|
34693
|
+
styleContext: context.styleContext,
|
|
34694
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
34695
|
+
bookmarks: context.bookmarks,
|
|
34696
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
34697
|
+
converters: converters2,
|
|
34698
|
+
enableComments: context.enableComments,
|
|
34699
|
+
converterContext: context.converterContext,
|
|
34700
|
+
themeColors: context.themeColors
|
|
34701
|
+
});
|
|
34678
34702
|
const paraOnly = paragraphBlocks.filter((b2) => b2.kind === "paragraph");
|
|
34679
34703
|
applySdtMetadataToParagraphBlocks(paraOnly, nestedMetadata);
|
|
34680
34704
|
applySdtMetadataToParagraphBlocks(paraOnly, sectionMetadata);
|
|
@@ -34683,17 +34707,21 @@ function processNestedStructuredContent(child, sectionMetadata, context, output,
|
|
|
34683
34707
|
output.recordBlockKind(block.kind);
|
|
34684
34708
|
});
|
|
34685
34709
|
} else if (grandchild.type === "table") {
|
|
34686
|
-
const tableBlock =
|
|
34687
|
-
grandchild,
|
|
34688
|
-
context.nextBlockId,
|
|
34689
|
-
context.positions,
|
|
34690
|
-
context.defaultFont,
|
|
34691
|
-
context.defaultSize,
|
|
34692
|
-
context.styleContext,
|
|
34693
|
-
|
|
34694
|
-
|
|
34695
|
-
context.hyperlinkConfig
|
|
34696
|
-
|
|
34710
|
+
const tableBlock = converters2.tableNodeToBlock({
|
|
34711
|
+
node: grandchild,
|
|
34712
|
+
nextBlockId: context.nextBlockId,
|
|
34713
|
+
positions: context.positions,
|
|
34714
|
+
defaultFont: context.defaultFont,
|
|
34715
|
+
defaultSize: context.defaultSize,
|
|
34716
|
+
styleContext: context.styleContext,
|
|
34717
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
34718
|
+
bookmarks: context.bookmarks,
|
|
34719
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
34720
|
+
enableComments: context.enableComments,
|
|
34721
|
+
themeColors: context.themeColors,
|
|
34722
|
+
converters: converters2,
|
|
34723
|
+
converterContext: context.converterContext
|
|
34724
|
+
});
|
|
34697
34725
|
if (tableBlock) {
|
|
34698
34726
|
if (nestedMetadata) applySdtMetadataToTableBlock(tableBlock, nestedMetadata);
|
|
34699
34727
|
applySdtMetadataToTableBlock(tableBlock, sectionMetadata);
|
|
@@ -34703,7 +34731,7 @@ function processNestedStructuredContent(child, sectionMetadata, context, output,
|
|
|
34703
34731
|
}
|
|
34704
34732
|
});
|
|
34705
34733
|
}
|
|
34706
|
-
function processDocumentPartObject(child, sectionMetadata, context, output,
|
|
34734
|
+
function processDocumentPartObject(child, sectionMetadata, context, output, converters2) {
|
|
34707
34735
|
const docPartGallery = getDocPartGallery(child);
|
|
34708
34736
|
const docPartObjectId = getDocPartObjectId(child);
|
|
34709
34737
|
const tocInstruction = getNodeInstruction(child);
|
|
@@ -34720,10 +34748,13 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
|
|
|
34720
34748
|
defaultSize: context.defaultSize,
|
|
34721
34749
|
styleContext: context.styleContext,
|
|
34722
34750
|
bookmarks: context.bookmarks,
|
|
34723
|
-
hyperlinkConfig: context.hyperlinkConfig
|
|
34751
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
34752
|
+
enableComments: context.enableComments,
|
|
34753
|
+
themeColors: context.themeColors,
|
|
34754
|
+
converters: converters2,
|
|
34755
|
+
converterContext: context.converterContext
|
|
34724
34756
|
},
|
|
34725
|
-
{ blocks: output.blocks, recordBlockKind: output.recordBlockKind }
|
|
34726
|
-
converters.paragraphToFlowBlocks
|
|
34757
|
+
{ blocks: output.blocks, recordBlockKind: output.recordBlockKind }
|
|
34727
34758
|
);
|
|
34728
34759
|
for (let i = blocksBeforeToc; i < output.blocks.length; i++) {
|
|
34729
34760
|
const block = output.blocks[i];
|
|
@@ -34741,18 +34772,18 @@ function processDocumentPartObject(child, sectionMetadata, context, output, conv
|
|
|
34741
34772
|
}
|
|
34742
34773
|
}
|
|
34743
34774
|
}
|
|
34744
|
-
function processDocumentSectionChildren(children, sectionMetadata, context, output,
|
|
34775
|
+
function processDocumentSectionChildren(children, sectionMetadata, context, output, converters2) {
|
|
34745
34776
|
children.forEach((child) => {
|
|
34746
34777
|
if (child.type === "paragraph") {
|
|
34747
|
-
processParagraphChild(child, sectionMetadata, context, output,
|
|
34778
|
+
processParagraphChild(child, sectionMetadata, context, output, converters2);
|
|
34748
34779
|
} else if (child.type === "table") {
|
|
34749
|
-
processTableChild(child, sectionMetadata, context, output,
|
|
34780
|
+
processTableChild(child, sectionMetadata, context, output, converters2);
|
|
34750
34781
|
} else if (child.type === "image") {
|
|
34751
|
-
processImageChild(child, sectionMetadata, context, output,
|
|
34782
|
+
processImageChild(child, sectionMetadata, context, output, converters2);
|
|
34752
34783
|
} else if (child.type === "structuredContentBlock" && Array.isArray(child.content)) {
|
|
34753
|
-
processNestedStructuredContent(child, sectionMetadata, context, output,
|
|
34784
|
+
processNestedStructuredContent(child, sectionMetadata, context, output, converters2);
|
|
34754
34785
|
} else if (child.type === "documentPartObject" && Array.isArray(child.content)) {
|
|
34755
|
-
processDocumentPartObject(child, sectionMetadata, context, output,
|
|
34786
|
+
processDocumentPartObject(child, sectionMetadata, context, output, converters2);
|
|
34756
34787
|
}
|
|
34757
34788
|
});
|
|
34758
34789
|
}
|
|
@@ -34768,14 +34799,13 @@ function handleDocumentSectionNode(node, context) {
|
|
|
34768
34799
|
styleContext,
|
|
34769
34800
|
bookmarks,
|
|
34770
34801
|
hyperlinkConfig,
|
|
34771
|
-
converters
|
|
34802
|
+
converters: converters2,
|
|
34803
|
+
enableComments,
|
|
34804
|
+
converterContext,
|
|
34805
|
+
trackedChangesConfig,
|
|
34806
|
+
themeColors
|
|
34772
34807
|
} = context;
|
|
34773
34808
|
const sectionMetadata = resolveNodeSdtMetadata(node, "documentSection");
|
|
34774
|
-
const convertersToUse = {
|
|
34775
|
-
paragraphToFlowBlocks: converters?.paragraphToFlowBlocks || (() => []),
|
|
34776
|
-
tableNodeToBlock: converters?.tableNodeToBlock || (() => null),
|
|
34777
|
-
imageNodeToBlock: converters?.imageNodeToBlock || (() => null)
|
|
34778
|
-
};
|
|
34779
34809
|
processDocumentSectionChildren(
|
|
34780
34810
|
node.content,
|
|
34781
34811
|
sectionMetadata,
|
|
@@ -34786,10 +34816,14 @@ function handleDocumentSectionNode(node, context) {
|
|
|
34786
34816
|
defaultSize,
|
|
34787
34817
|
styleContext,
|
|
34788
34818
|
bookmarks,
|
|
34789
|
-
|
|
34819
|
+
trackedChangesConfig,
|
|
34820
|
+
hyperlinkConfig,
|
|
34821
|
+
themeColors,
|
|
34822
|
+
enableComments,
|
|
34823
|
+
converterContext
|
|
34790
34824
|
},
|
|
34791
34825
|
{ blocks, recordBlockKind },
|
|
34792
|
-
|
|
34826
|
+
converters2
|
|
34793
34827
|
);
|
|
34794
34828
|
}
|
|
34795
34829
|
function handleDocumentPartObjectNode(node, context) {
|
|
@@ -34804,15 +34838,18 @@ function handleDocumentPartObjectNode(node, context) {
|
|
|
34804
34838
|
styleContext,
|
|
34805
34839
|
bookmarks,
|
|
34806
34840
|
hyperlinkConfig,
|
|
34807
|
-
converters,
|
|
34808
|
-
|
|
34841
|
+
converters: converters2,
|
|
34842
|
+
converterContext,
|
|
34843
|
+
enableComments,
|
|
34844
|
+
trackedChangesConfig,
|
|
34845
|
+
themeColors
|
|
34809
34846
|
} = context;
|
|
34810
34847
|
const docPartGallery = getDocPartGallery(node);
|
|
34811
34848
|
const docPartObjectId = getDocPartObjectId(node);
|
|
34812
34849
|
const tocInstruction = getNodeInstruction(node);
|
|
34813
34850
|
const docPartSdtMetadata = resolveNodeSdtMetadata(node, "docPartObject");
|
|
34814
|
-
const paragraphToFlowBlocks2 =
|
|
34815
|
-
if (docPartGallery === "Table of Contents"
|
|
34851
|
+
const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
|
|
34852
|
+
if (docPartGallery === "Table of Contents") {
|
|
34816
34853
|
processTocChildren(
|
|
34817
34854
|
Array.from(node.content),
|
|
34818
34855
|
{ docPartGallery, docPartObjectId, tocInstruction, sdtMetadata: docPartSdtMetadata },
|
|
@@ -34823,16 +34860,19 @@ function handleDocumentPartObjectNode(node, context) {
|
|
|
34823
34860
|
defaultSize,
|
|
34824
34861
|
styleContext,
|
|
34825
34862
|
bookmarks,
|
|
34826
|
-
hyperlinkConfig
|
|
34863
|
+
hyperlinkConfig,
|
|
34864
|
+
enableComments,
|
|
34865
|
+
trackedChangesConfig,
|
|
34866
|
+
converters: converters2,
|
|
34867
|
+
converterContext
|
|
34827
34868
|
},
|
|
34828
|
-
{ blocks, recordBlockKind }
|
|
34829
|
-
paragraphToFlowBlocks2
|
|
34869
|
+
{ blocks, recordBlockKind }
|
|
34830
34870
|
);
|
|
34831
34871
|
} else if (paragraphToFlowBlocks2) {
|
|
34832
34872
|
for (const child of node.content) {
|
|
34833
34873
|
if (child.type === "paragraph") {
|
|
34834
|
-
const childBlocks = paragraphToFlowBlocks2(
|
|
34835
|
-
child,
|
|
34874
|
+
const childBlocks = paragraphToFlowBlocks2({
|
|
34875
|
+
para: child,
|
|
34836
34876
|
nextBlockId,
|
|
34837
34877
|
positions,
|
|
34838
34878
|
defaultFont,
|
|
@@ -34840,8 +34880,12 @@ function handleDocumentPartObjectNode(node, context) {
|
|
|
34840
34880
|
styleContext,
|
|
34841
34881
|
trackedChangesConfig,
|
|
34842
34882
|
bookmarks,
|
|
34843
|
-
hyperlinkConfig
|
|
34844
|
-
|
|
34883
|
+
hyperlinkConfig,
|
|
34884
|
+
converters: converters2,
|
|
34885
|
+
themeColors,
|
|
34886
|
+
enableComments,
|
|
34887
|
+
converterContext
|
|
34888
|
+
});
|
|
34845
34889
|
for (const block of childBlocks) {
|
|
34846
34890
|
blocks.push(block);
|
|
34847
34891
|
recordBlockKind(block.kind);
|
|
@@ -35327,7 +35371,21 @@ const applyInlineRunProperties = (run, runProperties, converterContext) => {
|
|
|
35327
35371
|
const runAttrs = computeRunAttrs(runProperties, converterContext);
|
|
35328
35372
|
return { ...run, ...runAttrs };
|
|
35329
35373
|
};
|
|
35330
|
-
function paragraphToFlowBlocks
|
|
35374
|
+
function paragraphToFlowBlocks({
|
|
35375
|
+
para,
|
|
35376
|
+
nextBlockId,
|
|
35377
|
+
positions,
|
|
35378
|
+
defaultFont,
|
|
35379
|
+
defaultSize,
|
|
35380
|
+
styleContext,
|
|
35381
|
+
trackedChangesConfig,
|
|
35382
|
+
bookmarks,
|
|
35383
|
+
hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1,
|
|
35384
|
+
themeColors,
|
|
35385
|
+
converters: converters2,
|
|
35386
|
+
converterContext,
|
|
35387
|
+
enableComments = true
|
|
35388
|
+
}) {
|
|
35331
35389
|
const paragraphProps = typeof para.attrs?.paragraphProperties === "object" && para.attrs.paragraphProperties !== null ? para.attrs.paragraphProperties : {};
|
|
35332
35390
|
const baseBlockId = nextBlockId("paragraph");
|
|
35333
35391
|
const { paragraphAttrs, resolvedParagraphProperties } = computeParagraphAttrs(para, converterContext);
|
|
@@ -35688,14 +35746,14 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35688
35746
|
const anchorParagraphId = nextId();
|
|
35689
35747
|
flushParagraph();
|
|
35690
35748
|
const mergedMarks = [...node.marks ?? [], ...inheritedMarks ?? []];
|
|
35691
|
-
const trackedMeta =
|
|
35692
|
-
if (shouldHideTrackedNode(trackedMeta,
|
|
35749
|
+
const trackedMeta = trackedChangesConfig?.enabled ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
|
|
35750
|
+
if (shouldHideTrackedNode(trackedMeta, trackedChangesConfig)) {
|
|
35693
35751
|
return;
|
|
35694
35752
|
}
|
|
35695
|
-
if (
|
|
35696
|
-
const imageBlock =
|
|
35753
|
+
if (converters2?.imageNodeToBlock) {
|
|
35754
|
+
const imageBlock = converters2.imageNodeToBlock(node, nextBlockId, positions, trackedMeta, trackedChangesConfig);
|
|
35697
35755
|
if (imageBlock && imageBlock.kind === "image") {
|
|
35698
|
-
annotateBlockWithTrackedChange(imageBlock, trackedMeta,
|
|
35756
|
+
annotateBlockWithTrackedChange(imageBlock, trackedMeta, trackedChangesConfig);
|
|
35699
35757
|
blocks.push(attachAnchorParagraphId(imageBlock, anchorParagraphId));
|
|
35700
35758
|
}
|
|
35701
35759
|
}
|
|
@@ -35715,7 +35773,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35715
35773
|
const hrIndentRight = typeof indent?.right === "number" ? indent.right : void 0;
|
|
35716
35774
|
const hasIndent = typeof hrIndentLeft === "number" && hrIndentLeft !== 0 || typeof hrIndentRight === "number" && hrIndentRight !== 0;
|
|
35717
35775
|
const hrNode = hasIndent ? { ...node, attrs: { ...attrs, hrIndentLeft, hrIndentRight } } : node;
|
|
35718
|
-
const convert =
|
|
35776
|
+
const convert = converters2?.contentBlockNodeToDrawingBlock ?? contentBlockNodeToDrawingBlock;
|
|
35719
35777
|
const drawingBlock = convert(hrNode, nextBlockId, positions);
|
|
35720
35778
|
if (drawingBlock) {
|
|
35721
35779
|
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
@@ -35733,8 +35791,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35733
35791
|
}
|
|
35734
35792
|
const anchorParagraphId = nextId();
|
|
35735
35793
|
flushParagraph();
|
|
35736
|
-
if (
|
|
35737
|
-
const drawingBlock =
|
|
35794
|
+
if (converters2?.vectorShapeNodeToDrawingBlock) {
|
|
35795
|
+
const drawingBlock = converters2.vectorShapeNodeToDrawingBlock(node, nextBlockId, positions);
|
|
35738
35796
|
if (drawingBlock) {
|
|
35739
35797
|
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
35740
35798
|
}
|
|
@@ -35751,8 +35809,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35751
35809
|
}
|
|
35752
35810
|
const anchorParagraphId = nextId();
|
|
35753
35811
|
flushParagraph();
|
|
35754
|
-
if (
|
|
35755
|
-
const drawingBlock =
|
|
35812
|
+
if (converters2?.shapeGroupNodeToDrawingBlock) {
|
|
35813
|
+
const drawingBlock = converters2.shapeGroupNodeToDrawingBlock(node, nextBlockId, positions);
|
|
35756
35814
|
if (drawingBlock) {
|
|
35757
35815
|
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
35758
35816
|
}
|
|
@@ -35769,8 +35827,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35769
35827
|
}
|
|
35770
35828
|
const anchorParagraphId = nextId();
|
|
35771
35829
|
flushParagraph();
|
|
35772
|
-
if (
|
|
35773
|
-
const drawingBlock =
|
|
35830
|
+
if (converters2?.shapeContainerNodeToDrawingBlock) {
|
|
35831
|
+
const drawingBlock = converters2.shapeContainerNodeToDrawingBlock(node, nextBlockId, positions);
|
|
35774
35832
|
if (drawingBlock) {
|
|
35775
35833
|
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
35776
35834
|
}
|
|
@@ -35787,8 +35845,8 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35787
35845
|
}
|
|
35788
35846
|
const anchorParagraphId = nextId();
|
|
35789
35847
|
flushParagraph();
|
|
35790
|
-
if (
|
|
35791
|
-
const drawingBlock =
|
|
35848
|
+
if (converters2?.shapeTextboxNodeToDrawingBlock) {
|
|
35849
|
+
const drawingBlock = converters2.shapeTextboxNodeToDrawingBlock(node, nextBlockId, positions);
|
|
35792
35850
|
if (drawingBlock) {
|
|
35793
35851
|
blocks.push(attachAnchorParagraphId(drawingBlock, anchorParagraphId));
|
|
35794
35852
|
}
|
|
@@ -35802,20 +35860,22 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35802
35860
|
}
|
|
35803
35861
|
const anchorParagraphId = nextId();
|
|
35804
35862
|
flushParagraph();
|
|
35805
|
-
if (
|
|
35806
|
-
const tableBlock =
|
|
35863
|
+
if (converters2?.tableNodeToBlock) {
|
|
35864
|
+
const tableBlock = converters2.tableNodeToBlock({
|
|
35807
35865
|
node,
|
|
35808
35866
|
nextBlockId,
|
|
35809
35867
|
positions,
|
|
35810
35868
|
defaultFont,
|
|
35811
35869
|
defaultSize,
|
|
35812
35870
|
styleContext,
|
|
35813
|
-
|
|
35871
|
+
trackedChangesConfig,
|
|
35814
35872
|
bookmarks,
|
|
35815
35873
|
hyperlinkConfig,
|
|
35816
35874
|
themeColors,
|
|
35817
|
-
|
|
35818
|
-
|
|
35875
|
+
converterContext,
|
|
35876
|
+
converters: converters2,
|
|
35877
|
+
enableComments
|
|
35878
|
+
});
|
|
35819
35879
|
if (tableBlock) {
|
|
35820
35880
|
blocks.push(attachAnchorParagraphId(tableBlock, anchorParagraphId));
|
|
35821
35881
|
}
|
|
@@ -35892,7 +35952,7 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35892
35952
|
block.runs = mergeAdjacentRuns(block.runs);
|
|
35893
35953
|
}
|
|
35894
35954
|
});
|
|
35895
|
-
if (!
|
|
35955
|
+
if (!trackedChangesConfig) {
|
|
35896
35956
|
return blocks;
|
|
35897
35957
|
}
|
|
35898
35958
|
const processedBlocks = [];
|
|
@@ -35903,20 +35963,20 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
|
|
|
35903
35963
|
}
|
|
35904
35964
|
const filteredRuns = applyTrackedChangesModeToRuns(
|
|
35905
35965
|
block.runs,
|
|
35906
|
-
|
|
35966
|
+
trackedChangesConfig,
|
|
35907
35967
|
hyperlinkConfig,
|
|
35908
35968
|
applyMarksToRun,
|
|
35909
35969
|
themeColors,
|
|
35910
35970
|
enableComments
|
|
35911
35971
|
);
|
|
35912
|
-
if (
|
|
35972
|
+
if (trackedChangesConfig.enabled && filteredRuns.length === 0) {
|
|
35913
35973
|
return;
|
|
35914
35974
|
}
|
|
35915
35975
|
block.runs = filteredRuns;
|
|
35916
35976
|
block.attrs = {
|
|
35917
35977
|
...block.attrs ?? {},
|
|
35918
|
-
trackedChangesMode:
|
|
35919
|
-
trackedChangesEnabled:
|
|
35978
|
+
trackedChangesMode: trackedChangesConfig.mode,
|
|
35979
|
+
trackedChangesEnabled: trackedChangesConfig.enabled
|
|
35920
35980
|
};
|
|
35921
35981
|
processedBlocks.push(block);
|
|
35922
35982
|
});
|
|
@@ -35935,7 +35995,10 @@ function handleParagraphNode(node, context) {
|
|
|
35935
35995
|
bookmarks,
|
|
35936
35996
|
hyperlinkConfig,
|
|
35937
35997
|
sectionState,
|
|
35938
|
-
converters
|
|
35998
|
+
converters: converters2,
|
|
35999
|
+
converterContext,
|
|
36000
|
+
themeColors,
|
|
36001
|
+
enableComments
|
|
35939
36002
|
} = context;
|
|
35940
36003
|
const { ranges: sectionRanges, currentSectionIndex, currentParagraphIndex } = sectionState;
|
|
35941
36004
|
if (sectionRanges.length > 0) {
|
|
@@ -35950,12 +36013,9 @@ function handleParagraphNode(node, context) {
|
|
|
35950
36013
|
sectionState.currentSectionIndex++;
|
|
35951
36014
|
}
|
|
35952
36015
|
}
|
|
35953
|
-
const paragraphToFlowBlocks2 =
|
|
35954
|
-
|
|
35955
|
-
|
|
35956
|
-
}
|
|
35957
|
-
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
35958
|
-
node,
|
|
36016
|
+
const paragraphToFlowBlocks2 = converters2.paragraphToFlowBlocks;
|
|
36017
|
+
const paragraphBlocks = paragraphToFlowBlocks2({
|
|
36018
|
+
para: node,
|
|
35959
36019
|
nextBlockId,
|
|
35960
36020
|
positions,
|
|
35961
36021
|
defaultFont,
|
|
@@ -35964,10 +36024,11 @@ function handleParagraphNode(node, context) {
|
|
|
35964
36024
|
trackedChangesConfig,
|
|
35965
36025
|
bookmarks,
|
|
35966
36026
|
hyperlinkConfig,
|
|
35967
|
-
|
|
35968
|
-
|
|
35969
|
-
|
|
35970
|
-
|
|
36027
|
+
themeColors,
|
|
36028
|
+
converterContext,
|
|
36029
|
+
converters: converters2,
|
|
36030
|
+
enableComments
|
|
36031
|
+
});
|
|
35971
36032
|
paragraphBlocks.forEach((block) => {
|
|
35972
36033
|
blocks.push(block);
|
|
35973
36034
|
recordBlockKind(block.kind);
|
|
@@ -36340,7 +36401,7 @@ const parseTableCell = (args) => {
|
|
|
36340
36401
|
...tableProperties && { tableInfo: { tableProperties, rowIndex, cellIndex, numCells, numRows } },
|
|
36341
36402
|
...cellBackgroundColor && { backgroundColor: cellBackgroundColor }
|
|
36342
36403
|
} : context.converterContext;
|
|
36343
|
-
const paragraphToFlowBlocks2 = context.converters
|
|
36404
|
+
const paragraphToFlowBlocks2 = context.converters.paragraphToFlowBlocks;
|
|
36344
36405
|
const tableNodeToBlock2 = context.converters?.tableNodeToBlock;
|
|
36345
36406
|
const appendParagraphBlocks = (paragraphBlocks, sdtMetadata) => {
|
|
36346
36407
|
applySdtMetadataToParagraphBlocks(
|
|
@@ -36356,19 +36417,21 @@ const parseTableCell = (args) => {
|
|
|
36356
36417
|
for (const childNode of cellNode.content) {
|
|
36357
36418
|
if (childNode.type === "paragraph") {
|
|
36358
36419
|
if (!paragraphToFlowBlocks2) continue;
|
|
36359
|
-
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
36360
|
-
childNode,
|
|
36361
|
-
context.nextBlockId,
|
|
36362
|
-
context.positions,
|
|
36363
|
-
context.defaultFont,
|
|
36364
|
-
context.defaultSize,
|
|
36365
|
-
context.styleContext,
|
|
36366
|
-
context.
|
|
36367
|
-
context.bookmarks,
|
|
36368
|
-
context.hyperlinkConfig,
|
|
36369
|
-
context.themeColors,
|
|
36370
|
-
cellConverterContext
|
|
36371
|
-
|
|
36420
|
+
const paragraphBlocks = paragraphToFlowBlocks2({
|
|
36421
|
+
para: childNode,
|
|
36422
|
+
nextBlockId: context.nextBlockId,
|
|
36423
|
+
positions: context.positions,
|
|
36424
|
+
defaultFont: context.defaultFont,
|
|
36425
|
+
defaultSize: context.defaultSize,
|
|
36426
|
+
styleContext: context.styleContext,
|
|
36427
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
36428
|
+
bookmarks: context.bookmarks,
|
|
36429
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
36430
|
+
themeColors: context.themeColors,
|
|
36431
|
+
converterContext: cellConverterContext,
|
|
36432
|
+
converters: context.converters,
|
|
36433
|
+
enableComments: context.enableComments
|
|
36434
|
+
});
|
|
36372
36435
|
appendParagraphBlocks(paragraphBlocks);
|
|
36373
36436
|
continue;
|
|
36374
36437
|
}
|
|
@@ -36377,38 +36440,40 @@ const parseTableCell = (args) => {
|
|
|
36377
36440
|
for (const nestedNode of childNode.content) {
|
|
36378
36441
|
if (nestedNode.type === "paragraph") {
|
|
36379
36442
|
if (!paragraphToFlowBlocks2) continue;
|
|
36380
|
-
const paragraphBlocks = paragraphToFlowBlocks2(
|
|
36381
|
-
nestedNode,
|
|
36382
|
-
context.nextBlockId,
|
|
36383
|
-
context.positions,
|
|
36384
|
-
context.defaultFont,
|
|
36385
|
-
context.defaultSize,
|
|
36386
|
-
context.styleContext,
|
|
36387
|
-
context.
|
|
36388
|
-
context.bookmarks,
|
|
36389
|
-
context.hyperlinkConfig,
|
|
36390
|
-
context.themeColors,
|
|
36391
|
-
cellConverterContext
|
|
36392
|
-
|
|
36443
|
+
const paragraphBlocks = paragraphToFlowBlocks2({
|
|
36444
|
+
para: nestedNode,
|
|
36445
|
+
nextBlockId: context.nextBlockId,
|
|
36446
|
+
positions: context.positions,
|
|
36447
|
+
defaultFont: context.defaultFont,
|
|
36448
|
+
defaultSize: context.defaultSize,
|
|
36449
|
+
styleContext: context.styleContext,
|
|
36450
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
36451
|
+
bookmarks: context.bookmarks,
|
|
36452
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
36453
|
+
themeColors: context.themeColors,
|
|
36454
|
+
converterContext: cellConverterContext,
|
|
36455
|
+
converters: context.converters,
|
|
36456
|
+
enableComments: context.enableComments
|
|
36457
|
+
});
|
|
36393
36458
|
appendParagraphBlocks(paragraphBlocks, structuredContentMetadata);
|
|
36394
36459
|
continue;
|
|
36395
36460
|
}
|
|
36396
36461
|
if (nestedNode.type === "table" && tableNodeToBlock2) {
|
|
36397
|
-
const tableBlock = tableNodeToBlock2(
|
|
36398
|
-
nestedNode,
|
|
36399
|
-
context.nextBlockId,
|
|
36400
|
-
context.positions,
|
|
36401
|
-
context.defaultFont,
|
|
36402
|
-
context.defaultSize,
|
|
36403
|
-
context.styleContext,
|
|
36404
|
-
context.
|
|
36405
|
-
context.bookmarks,
|
|
36406
|
-
context.hyperlinkConfig,
|
|
36407
|
-
context.themeColors,
|
|
36408
|
-
|
|
36409
|
-
context.
|
|
36410
|
-
|
|
36411
|
-
);
|
|
36462
|
+
const tableBlock = tableNodeToBlock2({
|
|
36463
|
+
node: nestedNode,
|
|
36464
|
+
nextBlockId: context.nextBlockId,
|
|
36465
|
+
positions: context.positions,
|
|
36466
|
+
defaultFont: context.defaultFont,
|
|
36467
|
+
defaultSize: context.defaultSize,
|
|
36468
|
+
styleContext: context.styleContext,
|
|
36469
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
36470
|
+
bookmarks: context.bookmarks,
|
|
36471
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
36472
|
+
themeColors: context.themeColors,
|
|
36473
|
+
converterContext: context.converterContext,
|
|
36474
|
+
converters: context.converters,
|
|
36475
|
+
enableComments: context.enableComments
|
|
36476
|
+
});
|
|
36412
36477
|
if (tableBlock && tableBlock.kind === "table") {
|
|
36413
36478
|
applySdtMetadataToTableBlock(tableBlock, structuredContentMetadata);
|
|
36414
36479
|
blocks.push(tableBlock);
|
|
@@ -36419,21 +36484,21 @@ const parseTableCell = (args) => {
|
|
|
36419
36484
|
continue;
|
|
36420
36485
|
}
|
|
36421
36486
|
if (childNode.type === "table" && tableNodeToBlock2) {
|
|
36422
|
-
const tableBlock = tableNodeToBlock2(
|
|
36423
|
-
childNode,
|
|
36424
|
-
context.nextBlockId,
|
|
36425
|
-
context.positions,
|
|
36426
|
-
context.defaultFont,
|
|
36427
|
-
context.defaultSize,
|
|
36428
|
-
context.styleContext,
|
|
36429
|
-
context.
|
|
36430
|
-
context.bookmarks,
|
|
36431
|
-
context.hyperlinkConfig,
|
|
36432
|
-
context.themeColors,
|
|
36433
|
-
|
|
36434
|
-
context.
|
|
36435
|
-
|
|
36436
|
-
);
|
|
36487
|
+
const tableBlock = tableNodeToBlock2({
|
|
36488
|
+
node: childNode,
|
|
36489
|
+
nextBlockId: context.nextBlockId,
|
|
36490
|
+
positions: context.positions,
|
|
36491
|
+
defaultFont: context.defaultFont,
|
|
36492
|
+
defaultSize: context.defaultSize,
|
|
36493
|
+
styleContext: context.styleContext,
|
|
36494
|
+
trackedChangesConfig: context.trackedChangesConfig,
|
|
36495
|
+
bookmarks: context.bookmarks,
|
|
36496
|
+
hyperlinkConfig: context.hyperlinkConfig,
|
|
36497
|
+
themeColors: context.themeColors,
|
|
36498
|
+
converterContext: context.converterContext,
|
|
36499
|
+
converters: context.converters,
|
|
36500
|
+
enableComments: context.enableComments
|
|
36501
|
+
});
|
|
36437
36502
|
if (tableBlock && tableBlock.kind === "table") {
|
|
36438
36503
|
blocks.push(tableBlock);
|
|
36439
36504
|
}
|
|
@@ -36441,8 +36506,8 @@ const parseTableCell = (args) => {
|
|
|
36441
36506
|
}
|
|
36442
36507
|
if (childNode.type === "image" && context.converters?.imageNodeToBlock) {
|
|
36443
36508
|
const mergedMarks = [...childNode.marks ?? []];
|
|
36444
|
-
const trackedMeta = context.
|
|
36445
|
-
if (shouldHideTrackedNode(trackedMeta, context.
|
|
36509
|
+
const trackedMeta = context.trackedChangesConfig ? collectTrackedChangeFromMarks(mergedMarks) : void 0;
|
|
36510
|
+
if (shouldHideTrackedNode(trackedMeta, context.trackedChangesConfig)) {
|
|
36446
36511
|
continue;
|
|
36447
36512
|
}
|
|
36448
36513
|
const imageBlock = context.converters.imageNodeToBlock(
|
|
@@ -36450,10 +36515,10 @@ const parseTableCell = (args) => {
|
|
|
36450
36515
|
context.nextBlockId,
|
|
36451
36516
|
context.positions,
|
|
36452
36517
|
trackedMeta,
|
|
36453
|
-
context.
|
|
36518
|
+
context.trackedChangesConfig
|
|
36454
36519
|
);
|
|
36455
36520
|
if (imageBlock && imageBlock.kind === "image") {
|
|
36456
|
-
annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.
|
|
36521
|
+
annotateBlockWithTrackedChange(imageBlock, trackedMeta, context.trackedChangesConfig);
|
|
36457
36522
|
blocks.push(imageBlock);
|
|
36458
36523
|
}
|
|
36459
36524
|
continue;
|
|
@@ -36643,23 +36708,37 @@ function extractFloatingTableAnchorWrap(node) {
|
|
|
36643
36708
|
}
|
|
36644
36709
|
return { anchor, wrap };
|
|
36645
36710
|
}
|
|
36646
|
-
function tableNodeToBlock
|
|
36711
|
+
function tableNodeToBlock({
|
|
36712
|
+
node,
|
|
36713
|
+
nextBlockId,
|
|
36714
|
+
positions,
|
|
36715
|
+
defaultFont,
|
|
36716
|
+
defaultSize,
|
|
36717
|
+
styleContext,
|
|
36718
|
+
trackedChangesConfig,
|
|
36719
|
+
bookmarks,
|
|
36720
|
+
hyperlinkConfig,
|
|
36721
|
+
themeColors,
|
|
36722
|
+
converterContext,
|
|
36723
|
+
converters: converters2,
|
|
36724
|
+
enableComments
|
|
36725
|
+
}) {
|
|
36647
36726
|
if (!Array.isArray(node.content) || node.content.length === 0) return null;
|
|
36648
|
-
const paragraphConverter =
|
|
36727
|
+
const paragraphConverter = converters2.paragraphToFlowBlocks;
|
|
36649
36728
|
if (!paragraphConverter) return null;
|
|
36650
36729
|
const parserDeps = {
|
|
36651
36730
|
nextBlockId,
|
|
36652
36731
|
positions,
|
|
36653
36732
|
defaultFont,
|
|
36654
36733
|
defaultSize,
|
|
36655
|
-
styleContext
|
|
36656
|
-
|
|
36734
|
+
styleContext,
|
|
36735
|
+
trackedChangesConfig,
|
|
36657
36736
|
bookmarks,
|
|
36658
36737
|
hyperlinkConfig,
|
|
36659
36738
|
themeColors,
|
|
36660
|
-
paragraphToFlowBlocks: paragraphConverter,
|
|
36661
36739
|
converterContext,
|
|
36662
|
-
converters:
|
|
36740
|
+
converters: converters2,
|
|
36741
|
+
enableComments
|
|
36663
36742
|
};
|
|
36664
36743
|
const hydratedTableStyle = hydrateTableStyleAttrs(node, converterContext);
|
|
36665
36744
|
const defaultCellPadding = hydratedTableStyle?.cellPadding;
|
|
@@ -36782,10 +36861,11 @@ function handleTableNode(node, context) {
|
|
|
36782
36861
|
trackedChangesConfig,
|
|
36783
36862
|
bookmarks,
|
|
36784
36863
|
hyperlinkConfig,
|
|
36785
|
-
converters,
|
|
36786
|
-
converterContext
|
|
36864
|
+
converters: converters2,
|
|
36865
|
+
converterContext,
|
|
36866
|
+
enableComments
|
|
36787
36867
|
} = context;
|
|
36788
|
-
const tableBlock = tableNodeToBlock
|
|
36868
|
+
const tableBlock = tableNodeToBlock({
|
|
36789
36869
|
node,
|
|
36790
36870
|
nextBlockId,
|
|
36791
36871
|
positions,
|
|
@@ -36795,12 +36875,11 @@ function handleTableNode(node, context) {
|
|
|
36795
36875
|
trackedChangesConfig,
|
|
36796
36876
|
bookmarks,
|
|
36797
36877
|
hyperlinkConfig,
|
|
36798
|
-
void 0,
|
|
36799
|
-
// themeColors
|
|
36800
|
-
converters?.paragraphToFlowBlocks,
|
|
36878
|
+
themeColors: void 0,
|
|
36801
36879
|
converterContext,
|
|
36802
|
-
|
|
36803
|
-
|
|
36880
|
+
converters: converters2,
|
|
36881
|
+
enableComments
|
|
36882
|
+
});
|
|
36804
36883
|
if (tableBlock) {
|
|
36805
36884
|
blocks.push(tableBlock);
|
|
36806
36885
|
recordBlockKind(tableBlock.kind);
|
|
@@ -36859,6 +36938,16 @@ const nodeHandlers = {
|
|
|
36859
36938
|
shapeContainer: handleShapeContainerNode,
|
|
36860
36939
|
shapeTextbox: handleShapeTextboxNode
|
|
36861
36940
|
};
|
|
36941
|
+
const converters = {
|
|
36942
|
+
contentBlockNodeToDrawingBlock,
|
|
36943
|
+
imageNodeToBlock,
|
|
36944
|
+
vectorShapeNodeToDrawingBlock,
|
|
36945
|
+
shapeGroupNodeToDrawingBlock,
|
|
36946
|
+
shapeContainerNodeToDrawingBlock,
|
|
36947
|
+
shapeTextboxNodeToDrawingBlock,
|
|
36948
|
+
tableNodeToBlock,
|
|
36949
|
+
paragraphToFlowBlocks
|
|
36950
|
+
};
|
|
36862
36951
|
function toFlowBlocks(pmDoc, options) {
|
|
36863
36952
|
const defaultFont = options?.defaultFont ?? DEFAULT_FONT;
|
|
36864
36953
|
const defaultSize = options?.defaultSize ?? DEFAULT_SIZE;
|
|
@@ -36893,8 +36982,21 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
36893
36982
|
enableRichHyperlinks: options?.enableRichHyperlinks ?? false
|
|
36894
36983
|
};
|
|
36895
36984
|
const enableComments = options?.enableComments ?? true;
|
|
36896
|
-
const
|
|
36897
|
-
|
|
36985
|
+
const converterContext = options?.converterContext ?? {
|
|
36986
|
+
translatedNumbering: {},
|
|
36987
|
+
translatedLinkedStyles: {
|
|
36988
|
+
docDefaults: {
|
|
36989
|
+
runProperties: {
|
|
36990
|
+
fontFamily: {
|
|
36991
|
+
ascii: defaultFont
|
|
36992
|
+
},
|
|
36993
|
+
fontSize: pxToPt(defaultSize) ?? 12
|
|
36994
|
+
}
|
|
36995
|
+
},
|
|
36996
|
+
latentStyles: {},
|
|
36997
|
+
styles: {}
|
|
36998
|
+
}
|
|
36999
|
+
};
|
|
36898
37000
|
if (!doc2.content) {
|
|
36899
37001
|
return { blocks: [], bookmarks: /* @__PURE__ */ new Map() };
|
|
36900
37002
|
}
|
|
@@ -36914,44 +37016,6 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
36914
37016
|
blocks.push(sectionBreak);
|
|
36915
37017
|
recordBlockKind(sectionBreak.kind);
|
|
36916
37018
|
}
|
|
36917
|
-
const paragraphConverter = (para, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => paragraphToFlowBlocks(
|
|
36918
|
-
para,
|
|
36919
|
-
nextBlockId2,
|
|
36920
|
-
positions2,
|
|
36921
|
-
defaultFont2,
|
|
36922
|
-
defaultSize2,
|
|
36923
|
-
context,
|
|
36924
|
-
trackedChanges,
|
|
36925
|
-
bookmarks2,
|
|
36926
|
-
hyperlinkConfig2,
|
|
36927
|
-
themeColorsParam ?? themeColors,
|
|
36928
|
-
converterCtx ?? converterContext,
|
|
36929
|
-
enableComments
|
|
36930
|
-
);
|
|
36931
|
-
const tableConverter = (node, nextBlockId2, positions2, defaultFont2, defaultSize2, context, trackedChanges, bookmarks2, hyperlinkConfig2, themeColorsParam, converterCtx) => tableNodeToBlock(
|
|
36932
|
-
node,
|
|
36933
|
-
nextBlockId2,
|
|
36934
|
-
positions2,
|
|
36935
|
-
defaultFont2,
|
|
36936
|
-
defaultSize2,
|
|
36937
|
-
context,
|
|
36938
|
-
trackedChanges,
|
|
36939
|
-
bookmarks2,
|
|
36940
|
-
hyperlinkConfig2,
|
|
36941
|
-
themeColorsParam ?? themeColors,
|
|
36942
|
-
paragraphConverter,
|
|
36943
|
-
converterCtx ?? converterContext,
|
|
36944
|
-
{
|
|
36945
|
-
converters: {
|
|
36946
|
-
paragraphToFlowBlocks: paragraphConverter,
|
|
36947
|
-
imageNodeToBlock,
|
|
36948
|
-
vectorShapeNodeToDrawingBlock,
|
|
36949
|
-
shapeGroupNodeToDrawingBlock,
|
|
36950
|
-
shapeContainerNodeToDrawingBlock,
|
|
36951
|
-
shapeTextboxNodeToDrawingBlock
|
|
36952
|
-
}
|
|
36953
|
-
}
|
|
36954
|
-
);
|
|
36955
37019
|
const handlerContext = {
|
|
36956
37020
|
blocks,
|
|
36957
37021
|
recordBlockKind,
|
|
@@ -36970,16 +37034,8 @@ function toFlowBlocks(pmDoc, options) {
|
|
|
36970
37034
|
currentSectionIndex: 0,
|
|
36971
37035
|
currentParagraphIndex: 0
|
|
36972
37036
|
},
|
|
36973
|
-
converters
|
|
36974
|
-
|
|
36975
|
-
paragraphToFlowBlocks: paragraphConverter,
|
|
36976
|
-
tableNodeToBlock: tableConverter,
|
|
36977
|
-
imageNodeToBlock,
|
|
36978
|
-
vectorShapeNodeToDrawingBlock,
|
|
36979
|
-
shapeGroupNodeToDrawingBlock,
|
|
36980
|
-
shapeContainerNodeToDrawingBlock,
|
|
36981
|
-
shapeTextboxNodeToDrawingBlock
|
|
36982
|
-
}
|
|
37037
|
+
converters,
|
|
37038
|
+
themeColors: options?.themeColors
|
|
36983
37039
|
};
|
|
36984
37040
|
doc2.content.forEach((node) => {
|
|
36985
37041
|
const handler = nodeHandlers[node.type];
|
|
@@ -37032,82 +37088,6 @@ function mergeDropCapParagraphs(blocks) {
|
|
|
37032
37088
|
}
|
|
37033
37089
|
return result;
|
|
37034
37090
|
}
|
|
37035
|
-
function paragraphToFlowBlocks(para, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig = DEFAULT_HYPERLINK_CONFIG$1, themeColors, converterContext, enableComments = true) {
|
|
37036
|
-
return paragraphToFlowBlocks$1(
|
|
37037
|
-
para,
|
|
37038
|
-
nextBlockId,
|
|
37039
|
-
positions,
|
|
37040
|
-
defaultFont,
|
|
37041
|
-
defaultSize,
|
|
37042
|
-
styleContext,
|
|
37043
|
-
trackedChanges,
|
|
37044
|
-
bookmarks,
|
|
37045
|
-
hyperlinkConfig,
|
|
37046
|
-
themeColors,
|
|
37047
|
-
{
|
|
37048
|
-
contentBlockNodeToDrawingBlock,
|
|
37049
|
-
imageNodeToBlock,
|
|
37050
|
-
vectorShapeNodeToDrawingBlock,
|
|
37051
|
-
shapeGroupNodeToDrawingBlock,
|
|
37052
|
-
shapeContainerNodeToDrawingBlock,
|
|
37053
|
-
shapeTextboxNodeToDrawingBlock,
|
|
37054
|
-
tableNodeToBlock: (node, nextBlockId2, positions2, defaultFont2, defaultSize2, styleContext2, trackedChanges2, bookmarks2, hyperlinkConfig2, themeColors2, converterCtx) => tableNodeToBlock$1(
|
|
37055
|
-
node,
|
|
37056
|
-
nextBlockId2,
|
|
37057
|
-
positions2,
|
|
37058
|
-
defaultFont2,
|
|
37059
|
-
defaultSize2,
|
|
37060
|
-
styleContext2,
|
|
37061
|
-
trackedChanges2,
|
|
37062
|
-
bookmarks2,
|
|
37063
|
-
hyperlinkConfig2,
|
|
37064
|
-
themeColors2,
|
|
37065
|
-
paragraphToFlowBlocks,
|
|
37066
|
-
converterCtx ?? converterContext,
|
|
37067
|
-
{
|
|
37068
|
-
converters: {
|
|
37069
|
-
// Type assertion needed due to signature mismatch between actual function and type definition
|
|
37070
|
-
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
37071
|
-
imageNodeToBlock,
|
|
37072
|
-
vectorShapeNodeToDrawingBlock,
|
|
37073
|
-
shapeGroupNodeToDrawingBlock,
|
|
37074
|
-
shapeContainerNodeToDrawingBlock,
|
|
37075
|
-
shapeTextboxNodeToDrawingBlock
|
|
37076
|
-
}
|
|
37077
|
-
}
|
|
37078
|
-
)
|
|
37079
|
-
},
|
|
37080
|
-
converterContext,
|
|
37081
|
-
enableComments
|
|
37082
|
-
);
|
|
37083
|
-
}
|
|
37084
|
-
function tableNodeToBlock(node, nextBlockId, positions, defaultFont, defaultSize, styleContext, trackedChanges, bookmarks, hyperlinkConfig, themeColors, _paragraphToFlowBlocksParam, converterContext, options) {
|
|
37085
|
-
return tableNodeToBlock$1(
|
|
37086
|
-
node,
|
|
37087
|
-
nextBlockId,
|
|
37088
|
-
positions,
|
|
37089
|
-
defaultFont,
|
|
37090
|
-
defaultSize,
|
|
37091
|
-
styleContext,
|
|
37092
|
-
trackedChanges,
|
|
37093
|
-
bookmarks,
|
|
37094
|
-
hyperlinkConfig,
|
|
37095
|
-
themeColors,
|
|
37096
|
-
paragraphToFlowBlocks,
|
|
37097
|
-
converterContext,
|
|
37098
|
-
options ?? {
|
|
37099
|
-
converters: {
|
|
37100
|
-
// Type assertion needed due to signature mismatch between actual function and type definition
|
|
37101
|
-
paragraphToFlowBlocks: paragraphToFlowBlocks$1,
|
|
37102
|
-
imageNodeToBlock,
|
|
37103
|
-
vectorShapeNodeToDrawingBlock,
|
|
37104
|
-
shapeGroupNodeToDrawingBlock,
|
|
37105
|
-
shapeContainerNodeToDrawingBlock,
|
|
37106
|
-
shapeTextboxNodeToDrawingBlock
|
|
37107
|
-
}
|
|
37108
|
-
}
|
|
37109
|
-
);
|
|
37110
|
-
}
|
|
37111
37091
|
function buildFootnotesInput(editorState, converter, converterContext, themeColors) {
|
|
37112
37092
|
if (!editorState) return null;
|
|
37113
37093
|
const footnoteNumberById = converterContext?.footnoteNumberById;
|