@harbour-enterprises/superdoc 0.24.0-next.3 → 0.24.0-next.5
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-skWUtg2N.cjs → PdfViewer-D6AmuQ3v.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DEWI6Uts.es.js → PdfViewer-XhwjWR8o.es.js} +1 -1
- package/dist/chunks/blank-docx-ABm6XYAA.es.js +4 -0
- package/dist/chunks/blank-docx-DfW3Eeh2.cjs +3 -0
- package/dist/chunks/{index-2QL0aZ2S.cjs → index-DAdhqIN8.cjs} +76 -12
- package/dist/chunks/{index-C_AMhrHP.es.js → index-OjiyjDUm.es.js} +76 -12
- package/dist/chunks/{super-editor.es-CfK_qBM9.cjs → super-editor.es-BPK2gF1W.cjs} +1489 -986
- package/dist/chunks/{super-editor.es-iMAoOYOw.es.js → super-editor.es-bHlpz8m_.es.js} +1489 -986
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/helpers/export.d.ts +1 -1
- package/dist/core/helpers/export.d.ts.map +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/style.css +37 -27
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BueCftlx.js → converter-D-9mYZ83.js} +1247 -967
- package/dist/super-editor/chunks/{docx-zipper-C9jmfWYZ.js → docx-zipper-C1p3F7Ok.js} +1 -1
- package/dist/super-editor/chunks/{editor-BsuNqVvp.js → editor-lJoa5ADp.js} +292 -47
- package/dist/super-editor/chunks/{toolbar-DxhfgAoa.js → toolbar-B5-QnQ4l.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +10 -0
- package/dist/super-editor/super-editor/src/core/Editor.d.ts +11 -0
- package/dist/super-editor/super-editor/src/core/helpers/canRenderFont.d.ts +12 -0
- package/dist/super-editor/super-editor/src/core/super-converter/SuperConverter.d.ts +6 -1
- package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +5 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +4 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +9 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/gridSpan/gridSpan-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/gridSpan/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/header/header-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/header/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/headers-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/hideMark/hideMark-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/hideMark/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/noWrap/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/noWrap/noWrap-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/shd/shd-translator.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tc/helpers/translate-table-cell.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcBorders/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcBorders/tcBorders-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcFitText/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcFitText/tcFitText-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcMar/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcMar/tcMar-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcPr/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcPr/tcPr-translator.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcW/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tcW/tcW-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textDirection/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textDirection/textDirection-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tl2br/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tl2br/tl2br-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-helpers.d.ts +16 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr2bl/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tr2bl/tr2bl-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vAlign/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vAlign/vAlign-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vMerge/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/vMerge/vMerge-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/extensions/table/TableView.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts +112 -0
- package/dist/super-editor/super-editor.es.js +91 -76
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +1563 -996
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/blank-docx-CPqX9RF5.cjs +0 -3
- package/dist/chunks/blank-docx-iwdyG9RH.es.js +0 -4
|
@@ -15074,6 +15074,7 @@ async function readFromClipboard(state2) {
|
|
|
15074
15074
|
}
|
|
15075
15075
|
return content;
|
|
15076
15076
|
}
|
|
15077
|
+
const PIXELS_PER_INCH = 96;
|
|
15077
15078
|
function inchesToTwips(inches) {
|
|
15078
15079
|
if (inches == null) return;
|
|
15079
15080
|
if (typeof inches === "string") inches = parseFloat(inches);
|
|
@@ -15096,12 +15097,12 @@ function pixelsToTwips(pixels) {
|
|
|
15096
15097
|
}
|
|
15097
15098
|
function inchesToPixels(inches) {
|
|
15098
15099
|
if (inches == null) return;
|
|
15099
|
-
const pixels = inches *
|
|
15100
|
+
const pixels = inches * PIXELS_PER_INCH;
|
|
15100
15101
|
return Math.round(pixels * 1e3) / 1e3;
|
|
15101
15102
|
}
|
|
15102
15103
|
function pixelsToInches(pixels) {
|
|
15103
15104
|
if (pixels == null) return;
|
|
15104
|
-
const inches = Number(pixels) /
|
|
15105
|
+
const inches = Number(pixels) / PIXELS_PER_INCH;
|
|
15105
15106
|
return inches;
|
|
15106
15107
|
}
|
|
15107
15108
|
function twipsToLines(twips) {
|
|
@@ -15119,7 +15120,7 @@ function halfPointToPoints(halfPoints) {
|
|
|
15119
15120
|
function emuToPixels(emu) {
|
|
15120
15121
|
if (emu == null) return;
|
|
15121
15122
|
if (typeof emu === "string") emu = parseFloat(emu);
|
|
15122
|
-
const pixels = emu *
|
|
15123
|
+
const pixels = emu * PIXELS_PER_INCH / 914400;
|
|
15123
15124
|
return Math.round(pixels);
|
|
15124
15125
|
}
|
|
15125
15126
|
function pixelsToEmu(px) {
|
|
@@ -15127,9 +15128,9 @@ function pixelsToEmu(px) {
|
|
|
15127
15128
|
if (typeof px === "string") px = parseFloat(px);
|
|
15128
15129
|
return Math.round(px * 9525);
|
|
15129
15130
|
}
|
|
15130
|
-
function
|
|
15131
|
-
if (
|
|
15132
|
-
const points = parseFloat(
|
|
15131
|
+
function eighthPointsToPixels(eighthPoints) {
|
|
15132
|
+
if (eighthPoints == null) return;
|
|
15133
|
+
const points = parseFloat(eighthPoints) / 8;
|
|
15133
15134
|
const pixels = points * 1.3333;
|
|
15134
15135
|
return pixels;
|
|
15135
15136
|
}
|
|
@@ -15155,12 +15156,12 @@ function degreesToRot(degrees) {
|
|
|
15155
15156
|
}
|
|
15156
15157
|
function pixelsToPolygonUnits(pixels) {
|
|
15157
15158
|
if (pixels == null) return;
|
|
15158
|
-
const pu = pixels *
|
|
15159
|
+
const pu = pixels * PIXELS_PER_INCH;
|
|
15159
15160
|
return Math.round(pu);
|
|
15160
15161
|
}
|
|
15161
15162
|
function polygonUnitsToPixels(pu) {
|
|
15162
15163
|
if (pu == null) return;
|
|
15163
|
-
const pixels = Number(pu) /
|
|
15164
|
+
const pixels = Number(pu) / PIXELS_PER_INCH;
|
|
15164
15165
|
return Math.round(pixels * 1e3) / 1e3;
|
|
15165
15166
|
}
|
|
15166
15167
|
function polygonToObj(polygonNode) {
|
|
@@ -24542,37 +24543,37 @@ const _NodeTranslator = class _NodeTranslator {
|
|
|
24542
24543
|
/** @type {typeof TranslatorTypes} */
|
|
24543
24544
|
__publicField(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
24544
24545
|
let NodeTranslator = _NodeTranslator;
|
|
24545
|
-
const encode$
|
|
24546
|
+
const encode$1b = (attributes) => {
|
|
24546
24547
|
return attributes["w:type"];
|
|
24547
24548
|
};
|
|
24548
|
-
const decode$
|
|
24549
|
+
const decode$13 = (attrs) => {
|
|
24549
24550
|
const { lineBreakType } = attrs;
|
|
24550
24551
|
return lineBreakType;
|
|
24551
24552
|
};
|
|
24552
24553
|
const attrConfig$G = Object.freeze({
|
|
24553
24554
|
xmlName: "w:type",
|
|
24554
24555
|
sdName: "lineBreakType",
|
|
24555
|
-
encode: encode$
|
|
24556
|
-
decode: decode$
|
|
24556
|
+
encode: encode$1b,
|
|
24557
|
+
decode: decode$13
|
|
24557
24558
|
});
|
|
24558
|
-
const encode$
|
|
24559
|
+
const encode$1a = (attributes) => {
|
|
24559
24560
|
const xmlAttrValue = attributes["w:clear"];
|
|
24560
24561
|
return xmlAttrValue;
|
|
24561
24562
|
};
|
|
24562
|
-
const decode$
|
|
24563
|
+
const decode$12 = (attrs) => {
|
|
24563
24564
|
const { clear } = attrs;
|
|
24564
24565
|
return clear;
|
|
24565
24566
|
};
|
|
24566
24567
|
const attrConfig$F = Object.freeze({
|
|
24567
24568
|
xmlName: "w:clear",
|
|
24568
24569
|
sdName: "clear",
|
|
24569
|
-
encode: encode$
|
|
24570
|
-
decode: decode$
|
|
24570
|
+
encode: encode$1a,
|
|
24571
|
+
decode: decode$12
|
|
24571
24572
|
});
|
|
24572
24573
|
const validXmlAttributes$p = [attrConfig$G, attrConfig$F];
|
|
24573
|
-
const XML_NODE_NAME$
|
|
24574
|
+
const XML_NODE_NAME$y = "w:br";
|
|
24574
24575
|
const SD_NODE_NAME$h = "lineBreak";
|
|
24575
|
-
const encode$
|
|
24576
|
+
const encode$19 = (_2, encodedAttrs) => {
|
|
24576
24577
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
24577
24578
|
const translated = {
|
|
24578
24579
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -24582,7 +24583,7 @@ const encode$1c = (_2, encodedAttrs) => {
|
|
|
24582
24583
|
}
|
|
24583
24584
|
return translated;
|
|
24584
24585
|
};
|
|
24585
|
-
const decode$
|
|
24586
|
+
const decode$11 = (params, decodedAttrs) => {
|
|
24586
24587
|
const { node } = params;
|
|
24587
24588
|
if (!node) return;
|
|
24588
24589
|
const wBreak = { name: "w:br" };
|
|
@@ -24599,39 +24600,39 @@ const decode$14 = (params, decodedAttrs) => {
|
|
|
24599
24600
|
};
|
|
24600
24601
|
return translated;
|
|
24601
24602
|
};
|
|
24602
|
-
const config$
|
|
24603
|
-
xmlName: XML_NODE_NAME$
|
|
24603
|
+
const config$x = {
|
|
24604
|
+
xmlName: XML_NODE_NAME$y,
|
|
24604
24605
|
sdNodeOrKeyName: SD_NODE_NAME$h,
|
|
24605
24606
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24606
|
-
encode: encode$
|
|
24607
|
-
decode: decode$
|
|
24607
|
+
encode: encode$19,
|
|
24608
|
+
decode: decode$11,
|
|
24608
24609
|
attributes: validXmlAttributes$p
|
|
24609
24610
|
};
|
|
24610
|
-
const translator$
|
|
24611
|
-
const encode$
|
|
24612
|
-
const decode$
|
|
24611
|
+
const translator$1r = NodeTranslator.from(config$x);
|
|
24612
|
+
const encode$18 = (attributes) => attributes?.["w:val"];
|
|
24613
|
+
const decode$10 = (attrs) => attrs?.highlight;
|
|
24613
24614
|
const attrConfig$E = Object.freeze({
|
|
24614
24615
|
xmlName: "w:val",
|
|
24615
24616
|
sdName: "highlight",
|
|
24616
|
-
encode: encode$
|
|
24617
|
-
decode: decode$
|
|
24617
|
+
encode: encode$18,
|
|
24618
|
+
decode: decode$10
|
|
24618
24619
|
});
|
|
24619
24620
|
const validXmlAttributes$o = [attrConfig$E];
|
|
24620
|
-
const XML_NODE_NAME$
|
|
24621
|
-
const SD_ATTR_KEY$
|
|
24621
|
+
const XML_NODE_NAME$x = "w:highlight";
|
|
24622
|
+
const SD_ATTR_KEY$f = "highlight";
|
|
24622
24623
|
const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
|
|
24623
|
-
const encode$
|
|
24624
|
+
const encode$17 = (params, encodedAttrs = {}) => {
|
|
24624
24625
|
const { nodes } = params;
|
|
24625
24626
|
const node = nodes?.[0];
|
|
24626
24627
|
const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
|
|
24627
24628
|
return {
|
|
24628
24629
|
type: "attr",
|
|
24629
|
-
xmlName: XML_NODE_NAME$
|
|
24630
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
24630
|
+
xmlName: XML_NODE_NAME$x,
|
|
24631
|
+
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
24631
24632
|
attributes: { "w:val": value ?? null }
|
|
24632
24633
|
};
|
|
24633
24634
|
};
|
|
24634
|
-
const decode
|
|
24635
|
+
const decode$$ = (params) => {
|
|
24635
24636
|
const attrs = params?.node?.attrs || {};
|
|
24636
24637
|
const highlightValue = attrs.highlight ?? attrs.color ?? null;
|
|
24637
24638
|
if (!highlightValue) return void 0;
|
|
@@ -24639,14 +24640,14 @@ const decode$12 = (params) => {
|
|
|
24639
24640
|
if (!normalizedValue) return void 0;
|
|
24640
24641
|
if (DISABLED_TOKENS.has(normalizedValue)) {
|
|
24641
24642
|
return {
|
|
24642
|
-
name: XML_NODE_NAME$
|
|
24643
|
+
name: XML_NODE_NAME$x,
|
|
24643
24644
|
attributes: { "w:val": "none" }
|
|
24644
24645
|
};
|
|
24645
24646
|
}
|
|
24646
24647
|
const keyword = getDocxHighlightKeywordFromHex(highlightValue);
|
|
24647
24648
|
if (keyword) {
|
|
24648
24649
|
return {
|
|
24649
|
-
name: XML_NODE_NAME$
|
|
24650
|
+
name: XML_NODE_NAME$x,
|
|
24650
24651
|
attributes: { "w:val": keyword }
|
|
24651
24652
|
};
|
|
24652
24653
|
}
|
|
@@ -24661,63 +24662,63 @@ const decode$12 = (params) => {
|
|
|
24661
24662
|
}
|
|
24662
24663
|
};
|
|
24663
24664
|
};
|
|
24664
|
-
const config$
|
|
24665
|
-
xmlName: XML_NODE_NAME$
|
|
24666
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
24665
|
+
const config$w = {
|
|
24666
|
+
xmlName: XML_NODE_NAME$x,
|
|
24667
|
+
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
24667
24668
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
24668
|
-
encode: encode$
|
|
24669
|
-
decode: decode
|
|
24669
|
+
encode: encode$17,
|
|
24670
|
+
decode: decode$$,
|
|
24670
24671
|
attributes: validXmlAttributes$o
|
|
24671
24672
|
};
|
|
24672
|
-
const translator$
|
|
24673
|
-
const encode$
|
|
24673
|
+
const translator$1q = NodeTranslator.from(config$w);
|
|
24674
|
+
const encode$16 = (attributes) => {
|
|
24674
24675
|
return attributes["w:val"];
|
|
24675
24676
|
};
|
|
24676
|
-
const decode$
|
|
24677
|
+
const decode$_ = (attrs) => {
|
|
24677
24678
|
const { tabSize } = attrs || {};
|
|
24678
24679
|
return tabSize;
|
|
24679
24680
|
};
|
|
24680
24681
|
const attrConfig$D = Object.freeze({
|
|
24681
24682
|
xmlName: "w:val",
|
|
24682
24683
|
sdName: "tabSize",
|
|
24683
|
-
encode: encode$
|
|
24684
|
-
decode: decode$
|
|
24684
|
+
encode: encode$16,
|
|
24685
|
+
decode: decode$_
|
|
24685
24686
|
});
|
|
24686
|
-
const encode$
|
|
24687
|
+
const encode$15 = (attributes) => {
|
|
24687
24688
|
return attributes["w:leader"];
|
|
24688
24689
|
};
|
|
24689
|
-
const decode$
|
|
24690
|
+
const decode$Z = (attrs) => {
|
|
24690
24691
|
const { leader } = attrs || {};
|
|
24691
24692
|
return leader;
|
|
24692
24693
|
};
|
|
24693
24694
|
const attrConfig$C = Object.freeze({
|
|
24694
24695
|
xmlName: "w:leader",
|
|
24695
24696
|
sdName: "leader",
|
|
24696
|
-
encode: encode$
|
|
24697
|
-
decode: decode$
|
|
24697
|
+
encode: encode$15,
|
|
24698
|
+
decode: decode$Z
|
|
24698
24699
|
});
|
|
24699
|
-
const encode$
|
|
24700
|
+
const encode$14 = (attributes) => {
|
|
24700
24701
|
return attributes["w:pos"];
|
|
24701
24702
|
};
|
|
24702
|
-
const decode
|
|
24703
|
+
const decode$Y = (attrs) => {
|
|
24703
24704
|
const { pos } = attrs || {};
|
|
24704
24705
|
return pos;
|
|
24705
24706
|
};
|
|
24706
24707
|
const attrConfig$B = Object.freeze({
|
|
24707
24708
|
xmlName: "w:pos",
|
|
24708
24709
|
sdName: "pos",
|
|
24709
|
-
encode: encode$
|
|
24710
|
-
decode: decode
|
|
24710
|
+
encode: encode$14,
|
|
24711
|
+
decode: decode$Y
|
|
24711
24712
|
});
|
|
24712
24713
|
const validXmlAttributes$n = [attrConfig$D, attrConfig$B, attrConfig$C];
|
|
24713
|
-
const XML_NODE_NAME$
|
|
24714
|
+
const XML_NODE_NAME$w = "w:tab";
|
|
24714
24715
|
const SD_NODE_NAME$g = "tab";
|
|
24715
|
-
const encode$
|
|
24716
|
+
const encode$13 = (_2, encodedAttrs = {}) => {
|
|
24716
24717
|
const translated = { type: "tab" };
|
|
24717
24718
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
24718
24719
|
return translated;
|
|
24719
24720
|
};
|
|
24720
|
-
const decode$
|
|
24721
|
+
const decode$X = (params, decodedAttrs = {}) => {
|
|
24721
24722
|
const { node } = params || {};
|
|
24722
24723
|
if (!node) return;
|
|
24723
24724
|
const wTab = { name: "w:tab" };
|
|
@@ -24733,15 +24734,15 @@ const decode$_ = (params, decodedAttrs = {}) => {
|
|
|
24733
24734
|
}
|
|
24734
24735
|
return translated;
|
|
24735
24736
|
};
|
|
24736
|
-
const config$
|
|
24737
|
-
xmlName: XML_NODE_NAME$
|
|
24737
|
+
const config$v = {
|
|
24738
|
+
xmlName: XML_NODE_NAME$w,
|
|
24738
24739
|
sdNodeOrKeyName: SD_NODE_NAME$g,
|
|
24739
24740
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24740
|
-
encode: encode$
|
|
24741
|
-
decode: decode$
|
|
24741
|
+
encode: encode$13,
|
|
24742
|
+
decode: decode$X,
|
|
24742
24743
|
attributes: validXmlAttributes$n
|
|
24743
24744
|
};
|
|
24744
|
-
const translator$
|
|
24745
|
+
const translator$1p = NodeTranslator.from(config$v);
|
|
24745
24746
|
const mergeTextNodes = (nodes) => {
|
|
24746
24747
|
if (!nodes || !Array.isArray(nodes)) {
|
|
24747
24748
|
return nodes;
|
|
@@ -24967,9 +24968,9 @@ const parseParagraphBorders = (pBdr) => {
|
|
|
24967
24968
|
const { attributes: a } = el;
|
|
24968
24969
|
if (a["w:val"] === "nil" || a["w:val"] === void 0) return;
|
|
24969
24970
|
let sizePx;
|
|
24970
|
-
if (a["w:sz"] !== void 0) sizePx =
|
|
24971
|
+
if (a["w:sz"] !== void 0) sizePx = eighthPointsToPixels(a["w:sz"]);
|
|
24971
24972
|
let spacePx;
|
|
24972
|
-
if (a["w:space"] !== void 0) spacePx =
|
|
24973
|
+
if (a["w:space"] !== void 0) spacePx = eighthPointsToPixels(a["w:space"]);
|
|
24973
24974
|
result[side] = {
|
|
24974
24975
|
val: a["w:val"],
|
|
24975
24976
|
size: sizePx,
|
|
@@ -25259,89 +25260,89 @@ const handleParagraphNode$1 = (params) => {
|
|
|
25259
25260
|
}
|
|
25260
25261
|
return schemaNode;
|
|
25261
25262
|
};
|
|
25262
|
-
const encode$
|
|
25263
|
+
const encode$12 = (attributes) => {
|
|
25263
25264
|
return attributes["w:rsidDel"];
|
|
25264
25265
|
};
|
|
25265
|
-
const decode$
|
|
25266
|
+
const decode$W = (attrs) => {
|
|
25266
25267
|
return attrs.rsidDel;
|
|
25267
25268
|
};
|
|
25268
25269
|
const attrConfig$A = Object.freeze({
|
|
25269
25270
|
xmlName: "w:rsidDel",
|
|
25270
25271
|
sdName: "rsidDel",
|
|
25271
|
-
encode: encode$
|
|
25272
|
-
decode: decode$
|
|
25272
|
+
encode: encode$12,
|
|
25273
|
+
decode: decode$W
|
|
25273
25274
|
});
|
|
25274
|
-
const encode$
|
|
25275
|
+
const encode$11 = (attributes) => {
|
|
25275
25276
|
return attributes["w:rsidP"];
|
|
25276
25277
|
};
|
|
25277
|
-
const decode$
|
|
25278
|
+
const decode$V = (attrs) => {
|
|
25278
25279
|
return attrs.rsidP;
|
|
25279
25280
|
};
|
|
25280
25281
|
const attrConfig$z = Object.freeze({
|
|
25281
25282
|
xmlName: "w:rsidP",
|
|
25282
25283
|
sdName: "rsidP",
|
|
25283
|
-
encode: encode$
|
|
25284
|
-
decode: decode$
|
|
25284
|
+
encode: encode$11,
|
|
25285
|
+
decode: decode$V
|
|
25285
25286
|
});
|
|
25286
|
-
const encode$
|
|
25287
|
+
const encode$10 = (attributes) => {
|
|
25287
25288
|
return attributes["w:rsidR"];
|
|
25288
25289
|
};
|
|
25289
|
-
const decode$
|
|
25290
|
+
const decode$U = (attrs) => {
|
|
25290
25291
|
return attrs.rsidR;
|
|
25291
25292
|
};
|
|
25292
25293
|
const attrConfig$y = Object.freeze({
|
|
25293
25294
|
xmlName: "w:rsidR",
|
|
25294
25295
|
sdName: "rsidR",
|
|
25295
|
-
encode: encode$
|
|
25296
|
-
decode: decode$
|
|
25296
|
+
encode: encode$10,
|
|
25297
|
+
decode: decode$U
|
|
25297
25298
|
});
|
|
25298
|
-
const encode
|
|
25299
|
+
const encode$$ = (attributes) => {
|
|
25299
25300
|
return attributes["w:rsidRPr"];
|
|
25300
25301
|
};
|
|
25301
|
-
const decode$
|
|
25302
|
+
const decode$T = (attrs) => {
|
|
25302
25303
|
return attrs.rsidRPr;
|
|
25303
25304
|
};
|
|
25304
25305
|
const attrConfig$x = Object.freeze({
|
|
25305
25306
|
xmlName: "w:rsidRPr",
|
|
25306
25307
|
sdName: "rsidRPr",
|
|
25307
|
-
encode: encode
|
|
25308
|
-
decode: decode$
|
|
25308
|
+
encode: encode$$,
|
|
25309
|
+
decode: decode$T
|
|
25309
25310
|
});
|
|
25310
|
-
const encode$
|
|
25311
|
+
const encode$_ = (attributes) => {
|
|
25311
25312
|
return attributes["w:rsidRDefault"];
|
|
25312
25313
|
};
|
|
25313
|
-
const decode$
|
|
25314
|
+
const decode$S = (attrs) => {
|
|
25314
25315
|
return attrs.rsidRDefault;
|
|
25315
25316
|
};
|
|
25316
25317
|
const attrConfig$w = Object.freeze({
|
|
25317
25318
|
xmlName: "w:rsidRDefault",
|
|
25318
25319
|
sdName: "rsidRDefault",
|
|
25319
|
-
encode: encode$
|
|
25320
|
-
decode: decode$
|
|
25320
|
+
encode: encode$_,
|
|
25321
|
+
decode: decode$S
|
|
25321
25322
|
});
|
|
25322
|
-
const encode$
|
|
25323
|
+
const encode$Z = (attributes) => {
|
|
25323
25324
|
return attributes["w14:paraId"];
|
|
25324
25325
|
};
|
|
25325
|
-
const decode$
|
|
25326
|
+
const decode$R = (attrs) => {
|
|
25326
25327
|
return attrs.paraId;
|
|
25327
25328
|
};
|
|
25328
25329
|
const attrConfig$v = Object.freeze({
|
|
25329
25330
|
xmlName: "w14:paraId",
|
|
25330
25331
|
sdName: "paraId",
|
|
25331
|
-
encode: encode$
|
|
25332
|
-
decode: decode$
|
|
25332
|
+
encode: encode$Z,
|
|
25333
|
+
decode: decode$R
|
|
25333
25334
|
});
|
|
25334
|
-
const encode
|
|
25335
|
+
const encode$Y = (attributes) => {
|
|
25335
25336
|
return attributes["w14:textId"];
|
|
25336
25337
|
};
|
|
25337
|
-
const decode$
|
|
25338
|
+
const decode$Q = (attrs) => {
|
|
25338
25339
|
return attrs.textId;
|
|
25339
25340
|
};
|
|
25340
25341
|
const attrConfig$u = Object.freeze({
|
|
25341
25342
|
xmlName: "w14:textId",
|
|
25342
25343
|
sdName: "textId",
|
|
25343
|
-
encode: encode
|
|
25344
|
-
decode: decode$
|
|
25344
|
+
encode: encode$Y,
|
|
25345
|
+
decode: decode$Q
|
|
25345
25346
|
});
|
|
25346
25347
|
const validXmlAttributes$m = [
|
|
25347
25348
|
attrConfig$v,
|
|
@@ -25352,9 +25353,9 @@ const validXmlAttributes$m = [
|
|
|
25352
25353
|
attrConfig$x,
|
|
25353
25354
|
attrConfig$A
|
|
25354
25355
|
];
|
|
25355
|
-
const XML_NODE_NAME$
|
|
25356
|
+
const XML_NODE_NAME$v = "w:p";
|
|
25356
25357
|
const SD_NODE_NAME$f = "paragraph";
|
|
25357
|
-
const encode$
|
|
25358
|
+
const encode$X = (params, encodedAttrs = {}) => {
|
|
25358
25359
|
const node = handleParagraphNode$1(params);
|
|
25359
25360
|
if (!node) return void 0;
|
|
25360
25361
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -25362,7 +25363,7 @@ const encode$_ = (params, encodedAttrs = {}) => {
|
|
|
25362
25363
|
}
|
|
25363
25364
|
return node;
|
|
25364
25365
|
};
|
|
25365
|
-
const decode$
|
|
25366
|
+
const decode$P = (params, decodedAttrs = {}) => {
|
|
25366
25367
|
const translated = translateParagraphNode(params);
|
|
25367
25368
|
if (!translated) return void 0;
|
|
25368
25369
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -25370,16 +25371,16 @@ const decode$S = (params, decodedAttrs = {}) => {
|
|
|
25370
25371
|
}
|
|
25371
25372
|
return translated;
|
|
25372
25373
|
};
|
|
25373
|
-
const config$
|
|
25374
|
-
xmlName: XML_NODE_NAME$
|
|
25374
|
+
const config$u = {
|
|
25375
|
+
xmlName: XML_NODE_NAME$v,
|
|
25375
25376
|
sdNodeOrKeyName: SD_NODE_NAME$f,
|
|
25376
25377
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25377
|
-
encode: encode$
|
|
25378
|
-
decode: decode$
|
|
25378
|
+
encode: encode$X,
|
|
25379
|
+
decode: decode$P,
|
|
25379
25380
|
attributes: validXmlAttributes$m
|
|
25380
25381
|
};
|
|
25381
|
-
const translator$
|
|
25382
|
-
const encode$
|
|
25382
|
+
const translator$1o = NodeTranslator.from(config$u);
|
|
25383
|
+
const encode$W = (attributes) => {
|
|
25383
25384
|
const raw = attributes?.["w:val"];
|
|
25384
25385
|
if (raw === void 0 || raw === null) return void 0;
|
|
25385
25386
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25389,24 +25390,24 @@ const encode$Z = (attributes) => {
|
|
|
25389
25390
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25390
25391
|
return void 0;
|
|
25391
25392
|
};
|
|
25392
|
-
const decode$
|
|
25393
|
+
const decode$O = (runProps) => {
|
|
25393
25394
|
if (runProps?.bold === false) return "0";
|
|
25394
25395
|
return void 0;
|
|
25395
25396
|
};
|
|
25396
25397
|
const attrConfig$t = Object.freeze({
|
|
25397
25398
|
xmlName: "w:val",
|
|
25398
25399
|
sdName: "bold",
|
|
25399
|
-
encode: encode$
|
|
25400
|
-
decode: decode$
|
|
25400
|
+
encode: encode$W,
|
|
25401
|
+
decode: decode$O
|
|
25401
25402
|
});
|
|
25402
25403
|
const validXmlAttributes$l = [attrConfig$t];
|
|
25403
|
-
const XML_NODE_NAME$
|
|
25404
|
-
const SD_ATTR_KEY$
|
|
25405
|
-
const encode$
|
|
25404
|
+
const XML_NODE_NAME$u = "w:b";
|
|
25405
|
+
const SD_ATTR_KEY$e = "bold";
|
|
25406
|
+
const encode$V = (params, encodedAttrs = {}) => {
|
|
25406
25407
|
const { nodes } = params;
|
|
25407
25408
|
const node = nodes[0];
|
|
25408
25409
|
if (!node) return void 0;
|
|
25409
|
-
const val = encodedAttrs?.[SD_ATTR_KEY$
|
|
25410
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$e];
|
|
25410
25411
|
let attributes;
|
|
25411
25412
|
if (val === false) attributes = { "w:val": "0" };
|
|
25412
25413
|
else if (val === true)
|
|
@@ -25414,85 +25415,85 @@ const encode$Y = (params, encodedAttrs = {}) => {
|
|
|
25414
25415
|
else attributes = node.attributes || {};
|
|
25415
25416
|
return {
|
|
25416
25417
|
type: "attr",
|
|
25417
|
-
xmlName: XML_NODE_NAME$
|
|
25418
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25418
|
+
xmlName: XML_NODE_NAME$u,
|
|
25419
|
+
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25419
25420
|
attributes
|
|
25420
25421
|
};
|
|
25421
25422
|
};
|
|
25422
|
-
const config$
|
|
25423
|
-
xmlName: XML_NODE_NAME$
|
|
25424
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25423
|
+
const config$t = {
|
|
25424
|
+
xmlName: XML_NODE_NAME$u,
|
|
25425
|
+
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25425
25426
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25426
|
-
encode: encode$
|
|
25427
|
+
encode: encode$V,
|
|
25427
25428
|
attributes: validXmlAttributes$l
|
|
25428
25429
|
};
|
|
25429
|
-
const translator$
|
|
25430
|
-
const XML_NODE_NAME$
|
|
25431
|
-
const SD_ATTR_KEY$
|
|
25432
|
-
const encode$
|
|
25430
|
+
const translator$1n = NodeTranslator.from(config$t);
|
|
25431
|
+
const XML_NODE_NAME$t = "w:i";
|
|
25432
|
+
const SD_ATTR_KEY$d = "italic";
|
|
25433
|
+
const encode$U = (params) => {
|
|
25433
25434
|
const { nodes } = params;
|
|
25434
25435
|
const node = nodes?.[0];
|
|
25435
25436
|
if (!node) return void 0;
|
|
25436
25437
|
return {
|
|
25437
25438
|
type: "attr",
|
|
25438
|
-
xmlName: XML_NODE_NAME$
|
|
25439
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25439
|
+
xmlName: XML_NODE_NAME$t,
|
|
25440
|
+
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25440
25441
|
attributes: {
|
|
25441
25442
|
"w:val": node.attributes?.["w:val"] ?? null
|
|
25442
25443
|
}
|
|
25443
25444
|
};
|
|
25444
25445
|
};
|
|
25445
|
-
const config$
|
|
25446
|
-
xmlName: XML_NODE_NAME$
|
|
25447
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25446
|
+
const config$s = {
|
|
25447
|
+
xmlName: XML_NODE_NAME$t,
|
|
25448
|
+
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25448
25449
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25449
|
-
encode: encode$
|
|
25450
|
+
encode: encode$U
|
|
25450
25451
|
};
|
|
25451
|
-
const translator$
|
|
25452
|
-
const encode$
|
|
25453
|
-
const decode$
|
|
25452
|
+
const translator$1m = NodeTranslator.from(config$s);
|
|
25453
|
+
const encode$T = (attributes) => attributes?.["w:val"];
|
|
25454
|
+
const decode$N = (attrs) => attrs?.underline;
|
|
25454
25455
|
const attrConfig$s = Object.freeze({
|
|
25455
25456
|
xmlName: "w:val",
|
|
25456
25457
|
sdName: "underline",
|
|
25457
|
-
encode: encode$
|
|
25458
|
-
decode: decode$
|
|
25458
|
+
encode: encode$T,
|
|
25459
|
+
decode: decode$N
|
|
25459
25460
|
});
|
|
25460
|
-
const encode$
|
|
25461
|
-
const decode$
|
|
25461
|
+
const encode$S = (attributes) => attributes?.["w:color"];
|
|
25462
|
+
const decode$M = (attrs) => attrs?.color;
|
|
25462
25463
|
const attrConfig$r = Object.freeze({
|
|
25463
25464
|
xmlName: "w:color",
|
|
25464
25465
|
sdName: "color",
|
|
25465
|
-
encode: encode$
|
|
25466
|
-
decode: decode$
|
|
25466
|
+
encode: encode$S,
|
|
25467
|
+
decode: decode$M
|
|
25467
25468
|
});
|
|
25468
|
-
const encode$
|
|
25469
|
-
const decode$
|
|
25469
|
+
const encode$R = (attributes) => attributes?.["w:themeColor"];
|
|
25470
|
+
const decode$L = (attrs) => attrs?.themeColor;
|
|
25470
25471
|
const attrConfig$q = Object.freeze({
|
|
25471
25472
|
xmlName: "w:themeColor",
|
|
25472
25473
|
sdName: "themeColor",
|
|
25473
|
-
encode: encode$
|
|
25474
|
-
decode: decode$
|
|
25474
|
+
encode: encode$R,
|
|
25475
|
+
decode: decode$L
|
|
25475
25476
|
});
|
|
25476
|
-
const encode$
|
|
25477
|
-
const decode$
|
|
25477
|
+
const encode$Q = (attributes) => attributes?.["w:themeTint"];
|
|
25478
|
+
const decode$K = (attrs) => attrs?.themeTint;
|
|
25478
25479
|
const attrConfig$p = Object.freeze({
|
|
25479
25480
|
xmlName: "w:themeTint",
|
|
25480
25481
|
sdName: "themeTint",
|
|
25481
|
-
encode: encode$
|
|
25482
|
-
decode: decode$
|
|
25482
|
+
encode: encode$Q,
|
|
25483
|
+
decode: decode$K
|
|
25483
25484
|
});
|
|
25484
|
-
const encode$
|
|
25485
|
-
const decode$
|
|
25485
|
+
const encode$P = (attributes) => attributes?.["w:themeShade"];
|
|
25486
|
+
const decode$J = (attrs) => attrs?.themeShade;
|
|
25486
25487
|
const attrConfig$o = Object.freeze({
|
|
25487
25488
|
xmlName: "w:themeShade",
|
|
25488
25489
|
sdName: "themeShade",
|
|
25489
|
-
encode: encode$
|
|
25490
|
-
decode: decode$
|
|
25490
|
+
encode: encode$P,
|
|
25491
|
+
decode: decode$J
|
|
25491
25492
|
});
|
|
25492
25493
|
const validXmlAttributes$k = [attrConfig$s, attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o];
|
|
25493
|
-
const XML_NODE_NAME$
|
|
25494
|
-
const SD_ATTR_KEY$
|
|
25495
|
-
const encode$
|
|
25494
|
+
const XML_NODE_NAME$s = "w:u";
|
|
25495
|
+
const SD_ATTR_KEY$c = "underline";
|
|
25496
|
+
const encode$O = (params, encodedAttrs = {}) => {
|
|
25496
25497
|
const { nodes } = params;
|
|
25497
25498
|
const node = nodes?.[0];
|
|
25498
25499
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25508,12 +25509,12 @@ const encode$R = (params, encodedAttrs = {}) => {
|
|
|
25508
25509
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25509
25510
|
return {
|
|
25510
25511
|
type: "attr",
|
|
25511
|
-
xmlName: XML_NODE_NAME$
|
|
25512
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25512
|
+
xmlName: XML_NODE_NAME$s,
|
|
25513
|
+
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25513
25514
|
attributes
|
|
25514
25515
|
};
|
|
25515
25516
|
};
|
|
25516
|
-
const decode$
|
|
25517
|
+
const decode$I = (params) => {
|
|
25517
25518
|
const attrs = params?.node?.attrs || {};
|
|
25518
25519
|
const underlineType = attrs.underlineType ?? attrs.underline ?? null;
|
|
25519
25520
|
const color = attrs.underlineColor ?? attrs.color ?? null;
|
|
@@ -25531,20 +25532,20 @@ const decode$L = (params) => {
|
|
|
25531
25532
|
if (themeTint) attributes["w:themeTint"] = themeTint;
|
|
25532
25533
|
if (themeShade) attributes["w:themeShade"] = themeShade;
|
|
25533
25534
|
return {
|
|
25534
|
-
name: XML_NODE_NAME$
|
|
25535
|
+
name: XML_NODE_NAME$s,
|
|
25535
25536
|
attributes
|
|
25536
25537
|
};
|
|
25537
25538
|
};
|
|
25538
|
-
const config$
|
|
25539
|
-
xmlName: XML_NODE_NAME$
|
|
25540
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25539
|
+
const config$r = {
|
|
25540
|
+
xmlName: XML_NODE_NAME$s,
|
|
25541
|
+
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25541
25542
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25542
|
-
encode: encode$
|
|
25543
|
-
decode: decode$
|
|
25543
|
+
encode: encode$O,
|
|
25544
|
+
decode: decode$I,
|
|
25544
25545
|
attributes: validXmlAttributes$k
|
|
25545
25546
|
};
|
|
25546
|
-
const translator$
|
|
25547
|
-
const encode$
|
|
25547
|
+
const translator$1l = NodeTranslator.from(config$r);
|
|
25548
|
+
const encode$N = (attributes) => {
|
|
25548
25549
|
const raw = attributes?.["w:val"];
|
|
25549
25550
|
if (raw === void 0 || raw === null) return void 0;
|
|
25550
25551
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25554,24 +25555,24 @@ const encode$Q = (attributes) => {
|
|
|
25554
25555
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25555
25556
|
return void 0;
|
|
25556
25557
|
};
|
|
25557
|
-
const decode$
|
|
25558
|
+
const decode$H = (attrs) => {
|
|
25558
25559
|
if (attrs?.strike === false) return "0";
|
|
25559
25560
|
return void 0;
|
|
25560
25561
|
};
|
|
25561
25562
|
const attrConfig$n = Object.freeze({
|
|
25562
25563
|
xmlName: "w:val",
|
|
25563
25564
|
sdName: "strike",
|
|
25564
|
-
encode: encode$
|
|
25565
|
-
decode: decode$
|
|
25565
|
+
encode: encode$N,
|
|
25566
|
+
decode: decode$H
|
|
25566
25567
|
});
|
|
25567
25568
|
const validXmlAttributes$j = [attrConfig$n];
|
|
25568
|
-
const XML_NODE_NAME$
|
|
25569
|
-
const SD_ATTR_KEY$
|
|
25570
|
-
const encode$
|
|
25569
|
+
const XML_NODE_NAME$r = "w:strike";
|
|
25570
|
+
const SD_ATTR_KEY$b = "strike";
|
|
25571
|
+
const encode$M = (params, encodedAttrs = {}) => {
|
|
25571
25572
|
const { nodes } = params;
|
|
25572
25573
|
const node = nodes?.[0];
|
|
25573
25574
|
if (!node) return void 0;
|
|
25574
|
-
const val = encodedAttrs?.[SD_ATTR_KEY$
|
|
25575
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$b];
|
|
25575
25576
|
let attributes;
|
|
25576
25577
|
if (val === false) attributes = { "w:val": "0" };
|
|
25577
25578
|
else if (val === true) attributes = {};
|
|
@@ -25580,55 +25581,55 @@ const encode$P = (params, encodedAttrs = {}) => {
|
|
|
25580
25581
|
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25581
25582
|
return {
|
|
25582
25583
|
type: "attr",
|
|
25583
|
-
xmlName: XML_NODE_NAME$
|
|
25584
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25584
|
+
xmlName: XML_NODE_NAME$r,
|
|
25585
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25585
25586
|
attributes
|
|
25586
25587
|
};
|
|
25587
25588
|
};
|
|
25588
|
-
const config$
|
|
25589
|
-
xmlName: XML_NODE_NAME$
|
|
25590
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25589
|
+
const config$q = {
|
|
25590
|
+
xmlName: XML_NODE_NAME$r,
|
|
25591
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25591
25592
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25592
|
-
encode: encode$
|
|
25593
|
+
encode: encode$M,
|
|
25593
25594
|
attributes: validXmlAttributes$j
|
|
25594
25595
|
};
|
|
25595
|
-
const translator$
|
|
25596
|
-
const encode$
|
|
25597
|
-
const decode$
|
|
25596
|
+
const translator$1k = NodeTranslator.from(config$q);
|
|
25597
|
+
const encode$L = (attributes) => attributes?.["w:val"];
|
|
25598
|
+
const decode$G = (attrs) => attrs?.color;
|
|
25598
25599
|
const attrConfig$m = Object.freeze({
|
|
25599
25600
|
xmlName: "w:val",
|
|
25600
25601
|
sdName: "color",
|
|
25601
|
-
encode: encode$
|
|
25602
|
-
decode: decode$
|
|
25602
|
+
encode: encode$L,
|
|
25603
|
+
decode: decode$G
|
|
25603
25604
|
});
|
|
25604
|
-
const encode$
|
|
25605
|
-
const decode$
|
|
25605
|
+
const encode$K = (attributes) => attributes?.["w:themeColor"];
|
|
25606
|
+
const decode$F = (attrs) => attrs?.themeColor;
|
|
25606
25607
|
const attrConfig$l = Object.freeze({
|
|
25607
25608
|
xmlName: "w:themeColor",
|
|
25608
25609
|
sdName: "themeColor",
|
|
25609
|
-
encode: encode$
|
|
25610
|
-
decode: decode$
|
|
25610
|
+
encode: encode$K,
|
|
25611
|
+
decode: decode$F
|
|
25611
25612
|
});
|
|
25612
|
-
const encode$
|
|
25613
|
-
const decode$
|
|
25613
|
+
const encode$J = (attributes) => attributes?.["w:themeTint"];
|
|
25614
|
+
const decode$E = (attrs) => attrs?.themeTint;
|
|
25614
25615
|
const attrConfig$k = Object.freeze({
|
|
25615
25616
|
xmlName: "w:themeTint",
|
|
25616
25617
|
sdName: "themeTint",
|
|
25617
|
-
encode: encode$
|
|
25618
|
-
decode: decode$
|
|
25618
|
+
encode: encode$J,
|
|
25619
|
+
decode: decode$E
|
|
25619
25620
|
});
|
|
25620
|
-
const encode$
|
|
25621
|
-
const decode$
|
|
25621
|
+
const encode$I = (attributes) => attributes?.["w:themeShade"];
|
|
25622
|
+
const decode$D = (attrs) => attrs?.themeShade;
|
|
25622
25623
|
const attrConfig$j = Object.freeze({
|
|
25623
25624
|
xmlName: "w:themeShade",
|
|
25624
25625
|
sdName: "themeShade",
|
|
25625
|
-
encode: encode$
|
|
25626
|
-
decode: decode$
|
|
25626
|
+
encode: encode$I,
|
|
25627
|
+
decode: decode$D
|
|
25627
25628
|
});
|
|
25628
25629
|
const validXmlAttributes$i = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j];
|
|
25629
|
-
const XML_NODE_NAME$
|
|
25630
|
-
const SD_ATTR_KEY$
|
|
25631
|
-
const encode$
|
|
25630
|
+
const XML_NODE_NAME$q = "w:color";
|
|
25631
|
+
const SD_ATTR_KEY$a = "color";
|
|
25632
|
+
const encode$H = (params, encodedAttrs = {}) => {
|
|
25632
25633
|
const { nodes } = params;
|
|
25633
25634
|
const node = nodes?.[0];
|
|
25634
25635
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25643,63 +25644,63 @@ const encode$K = (params, encodedAttrs = {}) => {
|
|
|
25643
25644
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25644
25645
|
return {
|
|
25645
25646
|
type: "attr",
|
|
25646
|
-
xmlName: XML_NODE_NAME$
|
|
25647
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25647
|
+
xmlName: XML_NODE_NAME$q,
|
|
25648
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25648
25649
|
attributes
|
|
25649
25650
|
};
|
|
25650
25651
|
};
|
|
25651
|
-
const config$
|
|
25652
|
-
xmlName: XML_NODE_NAME$
|
|
25653
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25652
|
+
const config$p = {
|
|
25653
|
+
xmlName: XML_NODE_NAME$q,
|
|
25654
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25654
25655
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25655
|
-
encode: encode$
|
|
25656
|
+
encode: encode$H,
|
|
25656
25657
|
attributes: validXmlAttributes$i
|
|
25657
25658
|
};
|
|
25658
|
-
const translator$
|
|
25659
|
-
const encode$
|
|
25660
|
-
const decode$
|
|
25659
|
+
const translator$1j = NodeTranslator.from(config$p);
|
|
25660
|
+
const encode$G = (attributes) => attributes?.["w:eastAsia"];
|
|
25661
|
+
const decode$C = (attrs) => attrs?.eastAsia;
|
|
25661
25662
|
const attrConfig$i = Object.freeze({
|
|
25662
25663
|
xmlName: "w:eastAsia",
|
|
25663
25664
|
sdName: "eastAsia",
|
|
25664
|
-
encode: encode$
|
|
25665
|
-
decode: decode$
|
|
25665
|
+
encode: encode$G,
|
|
25666
|
+
decode: decode$C
|
|
25666
25667
|
});
|
|
25667
|
-
const encode$
|
|
25668
|
-
const decode$
|
|
25668
|
+
const encode$F = (attributes) => attributes?.["w:ascii"];
|
|
25669
|
+
const decode$B = (attrs) => attrs?.ascii;
|
|
25669
25670
|
const attrConfig$h = Object.freeze({
|
|
25670
25671
|
xmlName: "w:ascii",
|
|
25671
25672
|
sdName: "ascii",
|
|
25672
|
-
encode: encode$
|
|
25673
|
-
decode: decode$
|
|
25673
|
+
encode: encode$F,
|
|
25674
|
+
decode: decode$B
|
|
25674
25675
|
});
|
|
25675
|
-
const encode$
|
|
25676
|
-
const decode$
|
|
25676
|
+
const encode$E = (attributes) => attributes?.["w:hAnsi"];
|
|
25677
|
+
const decode$A = (attrs) => attrs?.hAnsi;
|
|
25677
25678
|
const attrConfig$g = Object.freeze({
|
|
25678
25679
|
xmlName: "w:hAnsi",
|
|
25679
25680
|
sdName: "hAnsi",
|
|
25680
|
-
encode: encode$
|
|
25681
|
-
decode: decode$
|
|
25681
|
+
encode: encode$E,
|
|
25682
|
+
decode: decode$A
|
|
25682
25683
|
});
|
|
25683
|
-
const encode$
|
|
25684
|
-
const decode$
|
|
25684
|
+
const encode$D = (attributes) => attributes?.["w:cs"];
|
|
25685
|
+
const decode$z = (attrs) => attrs?.cs;
|
|
25685
25686
|
const attrConfig$f = Object.freeze({
|
|
25686
25687
|
xmlName: "w:cs",
|
|
25687
25688
|
sdName: "cs",
|
|
25688
|
-
encode: encode$
|
|
25689
|
-
decode: decode$
|
|
25689
|
+
encode: encode$D,
|
|
25690
|
+
decode: decode$z
|
|
25690
25691
|
});
|
|
25691
|
-
const encode$
|
|
25692
|
-
const decode$
|
|
25692
|
+
const encode$C = (attributes) => attributes?.["w:val"];
|
|
25693
|
+
const decode$y = (attrs) => attrs?.value;
|
|
25693
25694
|
const attrConfig$e = Object.freeze({
|
|
25694
25695
|
xmlName: "w:val",
|
|
25695
25696
|
sdName: "value",
|
|
25696
|
-
encode: encode$
|
|
25697
|
-
decode: decode$
|
|
25697
|
+
encode: encode$C,
|
|
25698
|
+
decode: decode$y
|
|
25698
25699
|
});
|
|
25699
25700
|
const validXmlAttributes$h = [attrConfig$i, attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e];
|
|
25700
|
-
const XML_NODE_NAME$
|
|
25701
|
-
const SD_ATTR_KEY$
|
|
25702
|
-
const encode$
|
|
25701
|
+
const XML_NODE_NAME$p = "w:rFonts";
|
|
25702
|
+
const SD_ATTR_KEY$9 = "fontFamily";
|
|
25703
|
+
const encode$B = (params, encodedAttrs = {}) => {
|
|
25703
25704
|
const { nodes } = params;
|
|
25704
25705
|
const node = nodes?.[0];
|
|
25705
25706
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25723,111 +25724,119 @@ const encode$E = (params, encodedAttrs = {}) => {
|
|
|
25723
25724
|
attributes["w:val"] = attributes["w:eastAsia"];
|
|
25724
25725
|
}
|
|
25725
25726
|
if (attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25727
|
+
if (params.inlineDocumentFonts) {
|
|
25728
|
+
const font = attributes["w:ascii"];
|
|
25729
|
+
if (font) {
|
|
25730
|
+
if (!params.inlineDocumentFonts.includes(font)) {
|
|
25731
|
+
params.inlineDocumentFonts.push(font);
|
|
25732
|
+
}
|
|
25733
|
+
}
|
|
25734
|
+
}
|
|
25726
25735
|
return {
|
|
25727
25736
|
type: "attr",
|
|
25728
|
-
xmlName: XML_NODE_NAME$
|
|
25729
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25737
|
+
xmlName: XML_NODE_NAME$p,
|
|
25738
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25730
25739
|
attributes
|
|
25731
25740
|
};
|
|
25732
25741
|
};
|
|
25733
|
-
const config$
|
|
25734
|
-
xmlName: XML_NODE_NAME$
|
|
25735
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25742
|
+
const config$o = {
|
|
25743
|
+
xmlName: XML_NODE_NAME$p,
|
|
25744
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25736
25745
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25737
|
-
encode: encode$
|
|
25746
|
+
encode: encode$B,
|
|
25738
25747
|
attributes: validXmlAttributes$h
|
|
25739
25748
|
};
|
|
25740
|
-
const translator$
|
|
25741
|
-
const encode$
|
|
25742
|
-
const decode$
|
|
25749
|
+
const translator$1i = NodeTranslator.from(config$o);
|
|
25750
|
+
const encode$A = (attributes) => attributes?.["w:val"];
|
|
25751
|
+
const decode$x = (attrs) => attrs?.styleId;
|
|
25743
25752
|
const attrConfig$d = Object.freeze({
|
|
25744
25753
|
xmlName: "w:val",
|
|
25745
25754
|
sdName: "styleId",
|
|
25746
|
-
encode: encode$
|
|
25747
|
-
decode: decode$
|
|
25755
|
+
encode: encode$A,
|
|
25756
|
+
decode: decode$x
|
|
25748
25757
|
});
|
|
25749
25758
|
const validXmlAttributes$g = [attrConfig$d];
|
|
25750
|
-
const XML_NODE_NAME$
|
|
25751
|
-
const SD_ATTR_KEY$
|
|
25752
|
-
const encode$
|
|
25759
|
+
const XML_NODE_NAME$o = "w:rStyle";
|
|
25760
|
+
const SD_ATTR_KEY$8 = "styleId";
|
|
25761
|
+
const encode$z = (params, encodedAttrs = {}) => {
|
|
25753
25762
|
const { nodes } = params;
|
|
25754
25763
|
const node = nodes?.[0];
|
|
25755
25764
|
const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
|
|
25756
25765
|
return {
|
|
25757
25766
|
type: "attr",
|
|
25758
|
-
xmlName: XML_NODE_NAME$
|
|
25759
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25767
|
+
xmlName: XML_NODE_NAME$o,
|
|
25768
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25760
25769
|
attributes: { "w:val": value ?? null }
|
|
25761
25770
|
};
|
|
25762
25771
|
};
|
|
25763
|
-
const config$
|
|
25764
|
-
xmlName: XML_NODE_NAME$
|
|
25765
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25772
|
+
const config$n = {
|
|
25773
|
+
xmlName: XML_NODE_NAME$o,
|
|
25774
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25766
25775
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25767
|
-
encode: encode$
|
|
25776
|
+
encode: encode$z,
|
|
25768
25777
|
attributes: validXmlAttributes$g
|
|
25769
25778
|
};
|
|
25770
|
-
const translator$
|
|
25771
|
-
const encode$
|
|
25772
|
-
const decode$
|
|
25779
|
+
const translator$1h = NodeTranslator.from(config$n);
|
|
25780
|
+
const encode$y = (attributes) => attributes?.["w:val"];
|
|
25781
|
+
const decode$w = (attrs) => attrs?.fontSize;
|
|
25773
25782
|
const attrConfig$c = Object.freeze({
|
|
25774
25783
|
xmlName: "w:val",
|
|
25775
25784
|
sdName: "fontSize",
|
|
25776
|
-
encode: encode$
|
|
25777
|
-
decode: decode$
|
|
25785
|
+
encode: encode$y,
|
|
25786
|
+
decode: decode$w
|
|
25778
25787
|
});
|
|
25779
25788
|
const validXmlAttributes$f = [attrConfig$c];
|
|
25780
|
-
const XML_NODE_NAME$
|
|
25781
|
-
const SD_ATTR_KEY$
|
|
25782
|
-
const encode$
|
|
25789
|
+
const XML_NODE_NAME$n = "w:sz";
|
|
25790
|
+
const SD_ATTR_KEY$7 = "fontSize";
|
|
25791
|
+
const encode$x = (params, encodedAttrs = {}) => {
|
|
25783
25792
|
const { nodes } = params;
|
|
25784
25793
|
const node = nodes?.[0];
|
|
25785
25794
|
const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
|
|
25786
25795
|
return {
|
|
25787
25796
|
type: "attr",
|
|
25788
|
-
xmlName: XML_NODE_NAME$
|
|
25789
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25797
|
+
xmlName: XML_NODE_NAME$n,
|
|
25798
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25790
25799
|
attributes: { "w:val": value ?? null }
|
|
25791
25800
|
};
|
|
25792
25801
|
};
|
|
25793
|
-
const config$
|
|
25794
|
-
xmlName: XML_NODE_NAME$
|
|
25795
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25802
|
+
const config$m = {
|
|
25803
|
+
xmlName: XML_NODE_NAME$n,
|
|
25804
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25796
25805
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25797
|
-
encode: encode$
|
|
25806
|
+
encode: encode$x,
|
|
25798
25807
|
attributes: validXmlAttributes$f
|
|
25799
25808
|
};
|
|
25800
|
-
const translator$
|
|
25801
|
-
const encode$
|
|
25802
|
-
const decode$
|
|
25809
|
+
const translator$1g = NodeTranslator.from(config$m);
|
|
25810
|
+
const encode$w = (attributes) => attributes?.["w:val"];
|
|
25811
|
+
const decode$v = (attrs) => attrs?.fontSizeCs;
|
|
25803
25812
|
const attrConfig$b = Object.freeze({
|
|
25804
25813
|
xmlName: "w:val",
|
|
25805
25814
|
sdName: "fontSizeCs",
|
|
25806
|
-
encode: encode$
|
|
25807
|
-
decode: decode$
|
|
25815
|
+
encode: encode$w,
|
|
25816
|
+
decode: decode$v
|
|
25808
25817
|
});
|
|
25809
25818
|
const validXmlAttributes$e = [attrConfig$b];
|
|
25810
|
-
const XML_NODE_NAME$
|
|
25811
|
-
const SD_ATTR_KEY$
|
|
25812
|
-
const encode$
|
|
25819
|
+
const XML_NODE_NAME$m = "w:szCs";
|
|
25820
|
+
const SD_ATTR_KEY$6 = "fontSizeCs";
|
|
25821
|
+
const encode$v = (params, encodedAttrs = {}) => {
|
|
25813
25822
|
const { nodes } = params;
|
|
25814
25823
|
const node = nodes?.[0];
|
|
25815
25824
|
const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
|
|
25816
25825
|
return {
|
|
25817
25826
|
type: "attr",
|
|
25818
|
-
xmlName: XML_NODE_NAME$
|
|
25819
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25827
|
+
xmlName: XML_NODE_NAME$m,
|
|
25828
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25820
25829
|
attributes: { "w:val": value ?? null }
|
|
25821
25830
|
};
|
|
25822
25831
|
};
|
|
25823
|
-
const config$
|
|
25824
|
-
xmlName: XML_NODE_NAME$
|
|
25825
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25832
|
+
const config$l = {
|
|
25833
|
+
xmlName: XML_NODE_NAME$m,
|
|
25834
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25826
25835
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25827
|
-
encode: encode$
|
|
25836
|
+
encode: encode$v,
|
|
25828
25837
|
attributes: validXmlAttributes$e
|
|
25829
25838
|
};
|
|
25830
|
-
const translator$
|
|
25839
|
+
const translator$1f = NodeTranslator.from(config$l);
|
|
25831
25840
|
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
25832
25841
|
handlerName,
|
|
25833
25842
|
handler: (params) => {
|
|
@@ -25851,7 +25860,7 @@ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:v
|
|
|
25851
25860
|
xmlName,
|
|
25852
25861
|
sdNodeOrKeyName: sdName,
|
|
25853
25862
|
encode: ({ nodes }) => {
|
|
25854
|
-
return transformEncode(nodes[0]
|
|
25863
|
+
return transformEncode(nodes[0]?.attributes?.[attrName]) ?? void 0;
|
|
25855
25864
|
},
|
|
25856
25865
|
decode: ({ node }) => {
|
|
25857
25866
|
const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
|
|
@@ -25883,8 +25892,32 @@ function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
|
25883
25892
|
xmlName,
|
|
25884
25893
|
sdNodeOrKeyName: sdName,
|
|
25885
25894
|
attributes: [
|
|
25886
|
-
createAttributeHandler(
|
|
25887
|
-
|
|
25895
|
+
createAttributeHandler(
|
|
25896
|
+
"w:val",
|
|
25897
|
+
"val",
|
|
25898
|
+
(v2) => v2 === "nil" ? "none" : v2,
|
|
25899
|
+
(v2) => v2 === "none" ? "nil" : v2
|
|
25900
|
+
),
|
|
25901
|
+
createAttributeHandler(
|
|
25902
|
+
"w:color",
|
|
25903
|
+
"color",
|
|
25904
|
+
(v2) => {
|
|
25905
|
+
if (v2 === "auto") {
|
|
25906
|
+
return null;
|
|
25907
|
+
} else if (v2) {
|
|
25908
|
+
return `#${v2}`;
|
|
25909
|
+
} else {
|
|
25910
|
+
return void 0;
|
|
25911
|
+
}
|
|
25912
|
+
},
|
|
25913
|
+
(v2) => {
|
|
25914
|
+
if (v2) {
|
|
25915
|
+
return v2.replace("#", "");
|
|
25916
|
+
} else {
|
|
25917
|
+
return void 0;
|
|
25918
|
+
}
|
|
25919
|
+
}
|
|
25920
|
+
),
|
|
25888
25921
|
createAttributeHandler("w:themeColor"),
|
|
25889
25922
|
createAttributeHandler("w:themeTint"),
|
|
25890
25923
|
createAttributeHandler("w:themeShade"),
|
|
@@ -25950,6 +25983,37 @@ function decodeProperties(translatorsBySdName, properties) {
|
|
|
25950
25983
|
});
|
|
25951
25984
|
return elements;
|
|
25952
25985
|
}
|
|
25986
|
+
function createNestedPropertiesTranslator(xmlName, sdName, propertyTranslators2, defaultEncodedAttrs = {}) {
|
|
25987
|
+
const propertyTranslatorsByXmlName = {};
|
|
25988
|
+
const propertyTranslatorsBySdName = {};
|
|
25989
|
+
propertyTranslators2.forEach((translator2) => {
|
|
25990
|
+
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
25991
|
+
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
25992
|
+
});
|
|
25993
|
+
return {
|
|
25994
|
+
xmlName,
|
|
25995
|
+
sdNodeOrKeyName: sdName,
|
|
25996
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
25997
|
+
attributes: [],
|
|
25998
|
+
encode: (params) => {
|
|
25999
|
+
const { nodes } = params;
|
|
26000
|
+
const node = nodes[0];
|
|
26001
|
+
const attributes = { ...defaultEncodedAttrs, ...encodeProperties(node, propertyTranslatorsByXmlName) };
|
|
26002
|
+
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
26003
|
+
},
|
|
26004
|
+
decode: (params) => {
|
|
26005
|
+
const currentValue = params.node.attrs?.[sdName];
|
|
26006
|
+
const elements = decodeProperties(propertyTranslatorsBySdName, currentValue);
|
|
26007
|
+
const newNode = {
|
|
26008
|
+
name: xmlName,
|
|
26009
|
+
type: "element",
|
|
26010
|
+
attributes: {},
|
|
26011
|
+
elements
|
|
26012
|
+
};
|
|
26013
|
+
return newNode;
|
|
26014
|
+
}
|
|
26015
|
+
};
|
|
26016
|
+
}
|
|
25953
26017
|
const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
|
|
25954
26018
|
const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
|
|
25955
26019
|
const parseInteger = (value) => {
|
|
@@ -25961,9 +26025,9 @@ const integerToString = (value) => {
|
|
|
25961
26025
|
const intValue = parseInteger(value);
|
|
25962
26026
|
return intValue != void 0 ? String(intValue) : void 0;
|
|
25963
26027
|
};
|
|
25964
|
-
const XML_NODE_NAME$
|
|
25965
|
-
const SD_ATTR_KEY$
|
|
25966
|
-
const encode$
|
|
26028
|
+
const XML_NODE_NAME$l = "w:caps";
|
|
26029
|
+
const SD_ATTR_KEY$5 = "textTransform";
|
|
26030
|
+
const encode$u = (params, encodedAttrs = {}) => {
|
|
25967
26031
|
const { nodes } = params;
|
|
25968
26032
|
const node = nodes[0];
|
|
25969
26033
|
if (!node) return void 0;
|
|
@@ -25975,31 +26039,31 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
25975
26039
|
}
|
|
25976
26040
|
return {
|
|
25977
26041
|
type: "attr",
|
|
25978
|
-
xmlName: XML_NODE_NAME$
|
|
25979
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
25980
|
-
attributes: { [SD_ATTR_KEY$
|
|
26042
|
+
xmlName: XML_NODE_NAME$l,
|
|
26043
|
+
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
26044
|
+
attributes: { [SD_ATTR_KEY$5]: result }
|
|
25981
26045
|
};
|
|
25982
26046
|
};
|
|
25983
|
-
const config$
|
|
25984
|
-
xmlName: XML_NODE_NAME$
|
|
25985
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
26047
|
+
const config$k = {
|
|
26048
|
+
xmlName: XML_NODE_NAME$l,
|
|
26049
|
+
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
25986
26050
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25987
|
-
encode: encode$
|
|
26051
|
+
encode: encode$u,
|
|
25988
26052
|
attributes: [createAttributeHandler("w:val")]
|
|
25989
26053
|
};
|
|
25990
|
-
const translator
|
|
26054
|
+
const translator$1e = NodeTranslator.from(config$k);
|
|
25991
26055
|
const runPropertyTranslators = Object.freeze({
|
|
25992
|
-
"w:b": translator$
|
|
25993
|
-
"w:i": translator$
|
|
25994
|
-
"w:u": translator$
|
|
25995
|
-
"w:strike": translator$
|
|
25996
|
-
"w:color": translator$
|
|
25997
|
-
"w:highlight": translator$
|
|
25998
|
-
"w:rFonts": translator$
|
|
25999
|
-
"w:rStyle": translator$
|
|
26000
|
-
"w:sz": translator$
|
|
26001
|
-
"w:szCs": translator$
|
|
26002
|
-
"w:caps": translator
|
|
26056
|
+
"w:b": translator$1n,
|
|
26057
|
+
"w:i": translator$1m,
|
|
26058
|
+
"w:u": translator$1l,
|
|
26059
|
+
"w:strike": translator$1k,
|
|
26060
|
+
"w:color": translator$1j,
|
|
26061
|
+
"w:highlight": translator$1q,
|
|
26062
|
+
"w:rFonts": translator$1i,
|
|
26063
|
+
"w:rStyle": translator$1h,
|
|
26064
|
+
"w:sz": translator$1g,
|
|
26065
|
+
"w:szCs": translator$1f,
|
|
26066
|
+
"w:caps": translator$1e
|
|
26003
26067
|
});
|
|
26004
26068
|
const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
|
|
26005
26069
|
const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
|
|
@@ -26013,9 +26077,9 @@ const toRunPropertyEntry = (candidate) => {
|
|
|
26013
26077
|
attributes: { ...candidate.attributes || {} }
|
|
26014
26078
|
};
|
|
26015
26079
|
};
|
|
26016
|
-
const XML_NODE_NAME$
|
|
26017
|
-
const SD_ATTR_KEY$
|
|
26018
|
-
const encode$
|
|
26080
|
+
const XML_NODE_NAME$k = "w:rPr";
|
|
26081
|
+
const SD_ATTR_KEY$4 = "runProperties";
|
|
26082
|
+
const encode$t = (params) => {
|
|
26019
26083
|
const { nodes } = params;
|
|
26020
26084
|
const node = nodes?.[0] || {};
|
|
26021
26085
|
const contents = Array.isArray(node.elements) ? node.elements : [];
|
|
@@ -26049,16 +26113,16 @@ const encode$w = (params) => {
|
|
|
26049
26113
|
attributes: runPropsArray
|
|
26050
26114
|
};
|
|
26051
26115
|
};
|
|
26052
|
-
const config$
|
|
26053
|
-
xmlName: XML_NODE_NAME$
|
|
26054
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
26116
|
+
const config$j = {
|
|
26117
|
+
xmlName: XML_NODE_NAME$k,
|
|
26118
|
+
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
26055
26119
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
26056
|
-
encode: encode$
|
|
26120
|
+
encode: encode$t
|
|
26057
26121
|
};
|
|
26058
|
-
const translator$
|
|
26122
|
+
const translator$1d = NodeTranslator.from(config$j);
|
|
26059
26123
|
const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
|
|
26060
26124
|
const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
|
|
26061
|
-
const collectRunProperties = (params, rPrNode, translator2 = translator$
|
|
26125
|
+
const collectRunProperties = (params, rPrNode, translator2 = translator$1d) => {
|
|
26062
26126
|
if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
|
|
26063
26127
|
const result = translator2.encode({ ...params, nodes: [rPrNode] }) || {};
|
|
26064
26128
|
let entries = [];
|
|
@@ -26531,7 +26595,7 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
|
|
|
26531
26595
|
}
|
|
26532
26596
|
return runs;
|
|
26533
26597
|
};
|
|
26534
|
-
const XML_NODE_NAME$
|
|
26598
|
+
const XML_NODE_NAME$j = "w:hyperlink";
|
|
26535
26599
|
const SD_NODE_NAME$e = "link";
|
|
26536
26600
|
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
26537
26601
|
xmlName,
|
|
@@ -26552,7 +26616,7 @@ const validXmlAttributes$d = [
|
|
|
26552
26616
|
_createAttributeHandler("r:id", "rId"),
|
|
26553
26617
|
_createAttributeHandler("w:tgtFrame", "target")
|
|
26554
26618
|
];
|
|
26555
|
-
const encode$
|
|
26619
|
+
const encode$s = (params, encodedAttrs) => {
|
|
26556
26620
|
const { nodes, docx, nodeListHandler } = params;
|
|
26557
26621
|
const node = nodes[0];
|
|
26558
26622
|
let href = _resolveHref(docx, encodedAttrs);
|
|
@@ -26586,7 +26650,7 @@ const _resolveHref = (docx, encodedAttrs) => {
|
|
|
26586
26650
|
}
|
|
26587
26651
|
return href;
|
|
26588
26652
|
};
|
|
26589
|
-
function decode$
|
|
26653
|
+
function decode$u(params) {
|
|
26590
26654
|
const { hyperlinkGroup = [params.node] } = params.extraParams || {};
|
|
26591
26655
|
const node = hyperlinkGroup[0];
|
|
26592
26656
|
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
@@ -26635,55 +26699,55 @@ function _addNewLinkRelationship(params, link) {
|
|
|
26635
26699
|
});
|
|
26636
26700
|
return id;
|
|
26637
26701
|
}
|
|
26638
|
-
const config$
|
|
26639
|
-
xmlName: XML_NODE_NAME$
|
|
26702
|
+
const config$i = {
|
|
26703
|
+
xmlName: XML_NODE_NAME$j,
|
|
26640
26704
|
sdNodeOrKeyName: SD_NODE_NAME$e,
|
|
26641
26705
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26642
|
-
encode: encode$
|
|
26643
|
-
decode: decode$
|
|
26706
|
+
encode: encode$s,
|
|
26707
|
+
decode: decode$u,
|
|
26644
26708
|
attributes: validXmlAttributes$d
|
|
26645
26709
|
};
|
|
26646
|
-
const translator$
|
|
26647
|
-
const encode$
|
|
26710
|
+
const translator$1c = NodeTranslator.from(config$i);
|
|
26711
|
+
const encode$r = (attributes) => {
|
|
26648
26712
|
return attributes["w:rsidR"];
|
|
26649
26713
|
};
|
|
26650
|
-
const decode$
|
|
26714
|
+
const decode$t = (attrs) => {
|
|
26651
26715
|
return attrs.rsidR;
|
|
26652
26716
|
};
|
|
26653
26717
|
const attrConfig$a = Object.freeze({
|
|
26654
26718
|
xmlName: "w:rsidR",
|
|
26655
26719
|
sdName: "rsidR",
|
|
26656
|
-
encode: encode$
|
|
26657
|
-
decode: decode$
|
|
26720
|
+
encode: encode$r,
|
|
26721
|
+
decode: decode$t
|
|
26658
26722
|
});
|
|
26659
|
-
const encode$
|
|
26723
|
+
const encode$q = (attributes) => {
|
|
26660
26724
|
return attributes["w:rsidRPr"];
|
|
26661
26725
|
};
|
|
26662
|
-
const decode$
|
|
26726
|
+
const decode$s = (attrs) => {
|
|
26663
26727
|
return attrs.rsidRPr;
|
|
26664
26728
|
};
|
|
26665
26729
|
const attrConfig$9 = Object.freeze({
|
|
26666
26730
|
xmlName: "w:rsidRPr",
|
|
26667
26731
|
sdName: "rsidRPr",
|
|
26668
|
-
encode: encode$
|
|
26669
|
-
decode: decode$
|
|
26732
|
+
encode: encode$q,
|
|
26733
|
+
decode: decode$s
|
|
26670
26734
|
});
|
|
26671
|
-
const encode$
|
|
26735
|
+
const encode$p = (attributes) => {
|
|
26672
26736
|
return attributes["w:rsidDel"];
|
|
26673
26737
|
};
|
|
26674
|
-
const decode$
|
|
26738
|
+
const decode$r = (attrs) => {
|
|
26675
26739
|
return attrs.rsidDel;
|
|
26676
26740
|
};
|
|
26677
26741
|
const attrConfig$8 = Object.freeze({
|
|
26678
26742
|
xmlName: "w:rsidDel",
|
|
26679
26743
|
sdName: "rsidDel",
|
|
26680
|
-
encode: encode$
|
|
26681
|
-
decode: decode$
|
|
26744
|
+
encode: encode$p,
|
|
26745
|
+
decode: decode$r
|
|
26682
26746
|
});
|
|
26683
26747
|
const validXmlAttributes$c = [attrConfig$a, attrConfig$9, attrConfig$8];
|
|
26684
|
-
const XML_NODE_NAME$
|
|
26748
|
+
const XML_NODE_NAME$i = "w:r";
|
|
26685
26749
|
const SD_KEY_NAME = "run";
|
|
26686
|
-
const encode$
|
|
26750
|
+
const encode$o = (params, encodedAttrs = {}) => {
|
|
26687
26751
|
const { nodes = [], nodeListHandler } = params || {};
|
|
26688
26752
|
const runNode = nodes[0];
|
|
26689
26753
|
if (!runNode) return void 0;
|
|
@@ -26731,7 +26795,7 @@ const encode$r = (params, encodedAttrs = {}) => {
|
|
|
26731
26795
|
}
|
|
26732
26796
|
return runNodeResult;
|
|
26733
26797
|
};
|
|
26734
|
-
const decode$
|
|
26798
|
+
const decode$q = (params, decodedAttrs = {}) => {
|
|
26735
26799
|
const { node } = params || {};
|
|
26736
26800
|
if (!node) return void 0;
|
|
26737
26801
|
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
@@ -26740,7 +26804,7 @@ const decode$t = (params, decodedAttrs = {}) => {
|
|
|
26740
26804
|
...params.extraParams,
|
|
26741
26805
|
linkProcessed: true
|
|
26742
26806
|
};
|
|
26743
|
-
return translator$
|
|
26807
|
+
return translator$1c.decode({ ...params, extraParams });
|
|
26744
26808
|
}
|
|
26745
26809
|
const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
|
|
26746
26810
|
const runAttrs = runNodeForExport.attrs || {};
|
|
@@ -26796,7 +26860,7 @@ const decode$t = (params, decodedAttrs = {}) => {
|
|
|
26796
26860
|
runs.push(trackedClone);
|
|
26797
26861
|
return;
|
|
26798
26862
|
}
|
|
26799
|
-
const runWrapper = { name: XML_NODE_NAME$
|
|
26863
|
+
const runWrapper = { name: XML_NODE_NAME$i, elements: [] };
|
|
26800
26864
|
applyBaseRunProps(runWrapper);
|
|
26801
26865
|
if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
|
|
26802
26866
|
runWrapper.elements.push(cloneXmlNode(child));
|
|
@@ -26804,7 +26868,7 @@ const decode$t = (params, decodedAttrs = {}) => {
|
|
|
26804
26868
|
});
|
|
26805
26869
|
const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
|
|
26806
26870
|
if (!trackedRuns.length) {
|
|
26807
|
-
const emptyRun = { name: XML_NODE_NAME$
|
|
26871
|
+
const emptyRun = { name: XML_NODE_NAME$i, elements: [] };
|
|
26808
26872
|
applyBaseRunProps(emptyRun);
|
|
26809
26873
|
trackedRuns.push(emptyRun);
|
|
26810
26874
|
}
|
|
@@ -26818,15 +26882,15 @@ const decode$t = (params, decodedAttrs = {}) => {
|
|
|
26818
26882
|
}
|
|
26819
26883
|
return trackedRuns;
|
|
26820
26884
|
};
|
|
26821
|
-
const config$
|
|
26822
|
-
xmlName: XML_NODE_NAME$
|
|
26885
|
+
const config$h = {
|
|
26886
|
+
xmlName: XML_NODE_NAME$i,
|
|
26823
26887
|
sdNodeOrKeyName: SD_KEY_NAME,
|
|
26824
26888
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26825
|
-
encode: encode$
|
|
26826
|
-
decode: decode$
|
|
26889
|
+
encode: encode$o,
|
|
26890
|
+
decode: decode$q,
|
|
26827
26891
|
attributes: validXmlAttributes$c
|
|
26828
26892
|
};
|
|
26829
|
-
const translator$
|
|
26893
|
+
const translator$1b = NodeTranslator.from(config$h);
|
|
26830
26894
|
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
26831
26895
|
if (!table || !Array.isArray(table.content)) {
|
|
26832
26896
|
return table;
|
|
@@ -26867,13 +26931,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
|
26867
26931
|
}
|
|
26868
26932
|
return table;
|
|
26869
26933
|
}
|
|
26870
|
-
const translator$
|
|
26934
|
+
const translator$1a = NodeTranslator.from({
|
|
26871
26935
|
xmlName: "w:cantSplit",
|
|
26872
26936
|
sdNodeOrKeyName: "cantSplit",
|
|
26873
26937
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26874
26938
|
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
26875
26939
|
});
|
|
26876
|
-
const translator$
|
|
26940
|
+
const translator$19 = NodeTranslator.from({
|
|
26877
26941
|
xmlName: "w:cnfStyle",
|
|
26878
26942
|
sdNodeOrKeyName: "cnfStyle",
|
|
26879
26943
|
attributes: [
|
|
@@ -26899,8 +26963,8 @@ const translator$W = NodeTranslator.from({
|
|
|
26899
26963
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26900
26964
|
}
|
|
26901
26965
|
});
|
|
26902
|
-
const translator$
|
|
26903
|
-
const translator$
|
|
26966
|
+
const translator$18 = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
26967
|
+
const translator$17 = NodeTranslator.from(
|
|
26904
26968
|
createSingleAttrPropertyHandler(
|
|
26905
26969
|
"w:gridAfter",
|
|
26906
26970
|
null,
|
|
@@ -26909,7 +26973,7 @@ const translator$U = NodeTranslator.from(
|
|
|
26909
26973
|
(v2) => integerToString(v2)
|
|
26910
26974
|
)
|
|
26911
26975
|
);
|
|
26912
|
-
const translator$
|
|
26976
|
+
const translator$16 = NodeTranslator.from(
|
|
26913
26977
|
createSingleAttrPropertyHandler(
|
|
26914
26978
|
"w:gridBefore",
|
|
26915
26979
|
null,
|
|
@@ -26918,21 +26982,21 @@ const translator$T = NodeTranslator.from(
|
|
|
26918
26982
|
(v2) => integerToString(v2)
|
|
26919
26983
|
)
|
|
26920
26984
|
);
|
|
26921
|
-
const translator$
|
|
26985
|
+
const translator$15 = NodeTranslator.from({
|
|
26922
26986
|
xmlName: "w:hidden",
|
|
26923
26987
|
sdNodeOrKeyName: "hidden",
|
|
26924
26988
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26925
26989
|
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
26926
26990
|
});
|
|
26927
|
-
const translator$
|
|
26928
|
-
const translator$
|
|
26929
|
-
const translator$
|
|
26991
|
+
const translator$14 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
26992
|
+
const translator$13 = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
26993
|
+
const translator$12 = NodeTranslator.from({
|
|
26930
26994
|
xmlName: "w:tblHeader",
|
|
26931
26995
|
sdNodeOrKeyName: "repeatHeader",
|
|
26932
26996
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26933
26997
|
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
26934
26998
|
});
|
|
26935
|
-
const translator$
|
|
26999
|
+
const translator$11 = NodeTranslator.from({
|
|
26936
27000
|
xmlName: "w:trHeight",
|
|
26937
27001
|
sdNodeOrKeyName: "rowHeight",
|
|
26938
27002
|
encode: ({ nodes }) => {
|
|
@@ -26959,108 +27023,164 @@ const translator$O = NodeTranslator.from({
|
|
|
26959
27023
|
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
26960
27024
|
}
|
|
26961
27025
|
});
|
|
26962
|
-
const translator$
|
|
26963
|
-
const translator
|
|
26964
|
-
const
|
|
26965
|
-
|
|
26966
|
-
|
|
26967
|
-
|
|
26968
|
-
|
|
26969
|
-
|
|
27026
|
+
const translator$10 = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
27027
|
+
const translator$$ = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
27028
|
+
const propertyTranslators$6 = [
|
|
27029
|
+
translator$1a,
|
|
27030
|
+
translator$19,
|
|
27031
|
+
translator$18,
|
|
27032
|
+
translator$17,
|
|
27033
|
+
translator$16,
|
|
27034
|
+
translator$15,
|
|
27035
|
+
translator$14,
|
|
27036
|
+
translator$13,
|
|
27037
|
+
translator$12,
|
|
27038
|
+
translator$11,
|
|
27039
|
+
translator$10,
|
|
27040
|
+
translator$$
|
|
27041
|
+
];
|
|
27042
|
+
const translator$_ = NodeTranslator.from(
|
|
27043
|
+
createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$6, {
|
|
26970
27044
|
cantSplit: false,
|
|
26971
27045
|
hidden: false,
|
|
26972
27046
|
repeatHeader: false
|
|
26973
|
-
}
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
|
|
26977
|
-
};
|
|
27047
|
+
})
|
|
27048
|
+
);
|
|
27049
|
+
const createPlaceholderCell = (gridWidth, reason) => {
|
|
27050
|
+
const safeWidth = Number.isFinite(gridWidth) ? gridWidth : 0;
|
|
27051
|
+
const noBorder = { val: "none", size: 0 };
|
|
26978
27052
|
return {
|
|
26979
|
-
type:
|
|
26980
|
-
|
|
26981
|
-
|
|
26982
|
-
|
|
26983
|
-
|
|
26984
|
-
|
|
26985
|
-
|
|
26986
|
-
|
|
26987
|
-
|
|
26988
|
-
|
|
26989
|
-
|
|
26990
|
-
|
|
26991
|
-
|
|
26992
|
-
|
|
26993
|
-
};
|
|
26994
|
-
|
|
27053
|
+
type: "tableCell",
|
|
27054
|
+
attrs: {
|
|
27055
|
+
colspan: 1,
|
|
27056
|
+
rowspan: 1,
|
|
27057
|
+
colwidth: [safeWidth],
|
|
27058
|
+
__placeholder: reason,
|
|
27059
|
+
borders: {
|
|
27060
|
+
top: { ...noBorder },
|
|
27061
|
+
right: { ...noBorder },
|
|
27062
|
+
bottom: { ...noBorder },
|
|
27063
|
+
left: { ...noBorder }
|
|
27064
|
+
}
|
|
27065
|
+
},
|
|
27066
|
+
content: [{ type: "paragraph", content: [] }]
|
|
27067
|
+
};
|
|
27068
|
+
};
|
|
27069
|
+
const advancePastRowSpans = (pendingRowSpans, startIndex, totalColumns) => {
|
|
27070
|
+
let index2 = startIndex;
|
|
27071
|
+
while (index2 < totalColumns && pendingRowSpans[index2] > 0) {
|
|
27072
|
+
pendingRowSpans[index2] -= 1;
|
|
27073
|
+
index2 += 1;
|
|
27074
|
+
}
|
|
27075
|
+
return index2;
|
|
27076
|
+
};
|
|
27077
|
+
const fillPlaceholderColumns = ({
|
|
27078
|
+
content,
|
|
27079
|
+
pendingRowSpans,
|
|
27080
|
+
currentIndex,
|
|
27081
|
+
targetIndex,
|
|
27082
|
+
totalColumns,
|
|
27083
|
+
gridColumnWidths,
|
|
27084
|
+
reason
|
|
27085
|
+
}) => {
|
|
27086
|
+
let index2 = currentIndex;
|
|
27087
|
+
while (index2 < targetIndex && index2 < totalColumns) {
|
|
27088
|
+
if (pendingRowSpans[index2] > 0) {
|
|
27089
|
+
pendingRowSpans[index2] -= 1;
|
|
27090
|
+
index2 += 1;
|
|
27091
|
+
continue;
|
|
27092
|
+
}
|
|
27093
|
+
const width = Array.isArray(gridColumnWidths) ? gridColumnWidths[index2] ?? 0 : 0;
|
|
27094
|
+
content.push(createPlaceholderCell(width, reason));
|
|
27095
|
+
index2 += 1;
|
|
27096
|
+
}
|
|
27097
|
+
return index2;
|
|
26995
27098
|
};
|
|
26996
|
-
const
|
|
26997
|
-
|
|
26998
|
-
|
|
26999
|
-
|
|
27000
|
-
|
|
27001
|
-
|
|
27002
|
-
|
|
27003
|
-
|
|
27004
|
-
|
|
27005
|
-
|
|
27006
|
-
|
|
27007
|
-
translator$N,
|
|
27008
|
-
translator$M
|
|
27009
|
-
];
|
|
27010
|
-
const propertyTranslatorsByXmlName$2 = {};
|
|
27011
|
-
propertyTranslators$3.forEach((translator2) => {
|
|
27012
|
-
propertyTranslatorsByXmlName$2[translator2.xmlName] = translator2;
|
|
27013
|
-
});
|
|
27014
|
-
const propertyTranslatorsBySdName$2 = {};
|
|
27015
|
-
propertyTranslators$3.forEach((translator2) => {
|
|
27016
|
-
propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
|
|
27017
|
-
});
|
|
27018
|
-
const config$h = {
|
|
27019
|
-
xmlName: XML_NODE_NAME$k,
|
|
27020
|
-
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
27021
|
-
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
27022
|
-
encode: encode$q,
|
|
27023
|
-
decode: decode$s
|
|
27099
|
+
const isPlaceholderCell = (cell) => {
|
|
27100
|
+
if (!cell) return false;
|
|
27101
|
+
if (cell.attrs?.__placeholder) return true;
|
|
27102
|
+
const widths = cell.attrs?.colwidth;
|
|
27103
|
+
if (Array.isArray(widths) && widths.length > 0) {
|
|
27104
|
+
const hasMeaningfulWidth = widths.some(
|
|
27105
|
+
(value) => typeof value === "number" && Number.isFinite(value) && Math.abs(value) > 1
|
|
27106
|
+
);
|
|
27107
|
+
if (!hasMeaningfulWidth) return true;
|
|
27108
|
+
}
|
|
27109
|
+
return false;
|
|
27024
27110
|
};
|
|
27025
|
-
const
|
|
27026
|
-
const XML_NODE_NAME$j = "w:tr";
|
|
27111
|
+
const XML_NODE_NAME$h = "w:tr";
|
|
27027
27112
|
const SD_NODE_NAME$d = "tableRow";
|
|
27028
27113
|
const validXmlAttributes$b = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
27029
27114
|
(xmlName) => createAttributeHandler(xmlName)
|
|
27030
27115
|
);
|
|
27031
|
-
const encode$
|
|
27116
|
+
const encode$n = (params, encodedAttrs) => {
|
|
27032
27117
|
const { row } = params.extraParams;
|
|
27033
27118
|
let tableRowProperties = {};
|
|
27034
27119
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
27035
27120
|
if (tPr) {
|
|
27036
|
-
|
|
27121
|
+
tableRowProperties = translator$_.encode({
|
|
27037
27122
|
...params,
|
|
27038
27123
|
nodes: [tPr]
|
|
27039
|
-
})
|
|
27124
|
+
});
|
|
27040
27125
|
}
|
|
27126
|
+
const gridBeforeRaw = tableRowProperties?.["gridBefore"];
|
|
27127
|
+
const safeGridBefore = typeof gridBeforeRaw === "number" && Number.isFinite(gridBeforeRaw) && gridBeforeRaw > 0 ? gridBeforeRaw : 0;
|
|
27041
27128
|
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
27042
27129
|
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
27043
27130
|
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
27044
|
-
const { columnWidths: gridColumnWidths } = params.extraParams;
|
|
27131
|
+
const { columnWidths: gridColumnWidths, activeRowSpans = [] } = params.extraParams;
|
|
27132
|
+
const totalColumns = Array.isArray(gridColumnWidths) ? gridColumnWidths.length : 0;
|
|
27133
|
+
const pendingRowSpans = Array.isArray(activeRowSpans) ? activeRowSpans.slice() : [];
|
|
27134
|
+
while (pendingRowSpans.length < totalColumns) pendingRowSpans.push(0);
|
|
27045
27135
|
const cellNodes = row.elements.filter((el) => el.name === "w:tc");
|
|
27136
|
+
const content = [];
|
|
27046
27137
|
let currentColumnIndex = 0;
|
|
27047
|
-
const
|
|
27048
|
-
|
|
27138
|
+
const fillUntil = (target, reason) => {
|
|
27139
|
+
currentColumnIndex = fillPlaceholderColumns({
|
|
27140
|
+
content,
|
|
27141
|
+
pendingRowSpans,
|
|
27142
|
+
currentIndex: currentColumnIndex,
|
|
27143
|
+
targetIndex: target,
|
|
27144
|
+
totalColumns,
|
|
27145
|
+
gridColumnWidths,
|
|
27146
|
+
reason
|
|
27147
|
+
});
|
|
27148
|
+
};
|
|
27149
|
+
const skipOccupiedColumns = () => {
|
|
27150
|
+
currentColumnIndex = advancePastRowSpans(pendingRowSpans, currentColumnIndex, totalColumns);
|
|
27151
|
+
};
|
|
27152
|
+
fillUntil(safeGridBefore, "gridBefore");
|
|
27153
|
+
skipOccupiedColumns();
|
|
27154
|
+
cellNodes?.forEach((node) => {
|
|
27155
|
+
skipOccupiedColumns();
|
|
27156
|
+
const startColumn = currentColumnIndex;
|
|
27157
|
+
const columnWidth = gridColumnWidths?.[startColumn] || null;
|
|
27049
27158
|
const result = translator$c.encode({
|
|
27050
27159
|
...params,
|
|
27051
27160
|
extraParams: {
|
|
27052
27161
|
...params.extraParams,
|
|
27053
|
-
node
|
|
27054
|
-
columnIndex:
|
|
27162
|
+
node,
|
|
27163
|
+
columnIndex: startColumn,
|
|
27055
27164
|
columnWidth
|
|
27056
27165
|
}
|
|
27057
27166
|
});
|
|
27058
|
-
|
|
27059
|
-
|
|
27060
|
-
|
|
27061
|
-
|
|
27062
|
-
|
|
27063
|
-
|
|
27167
|
+
if (result) {
|
|
27168
|
+
content.push(result);
|
|
27169
|
+
const colspan = Math.max(1, result.attrs?.colspan || 1);
|
|
27170
|
+
const rowspan = Math.max(1, result.attrs?.rowspan || 1);
|
|
27171
|
+
if (rowspan > 1) {
|
|
27172
|
+
for (let offset = 0; offset < colspan; offset += 1) {
|
|
27173
|
+
const target = startColumn + offset;
|
|
27174
|
+
if (target < pendingRowSpans.length) {
|
|
27175
|
+
pendingRowSpans[target] = Math.max(pendingRowSpans[target], rowspan - 1);
|
|
27176
|
+
}
|
|
27177
|
+
}
|
|
27178
|
+
}
|
|
27179
|
+
currentColumnIndex = startColumn + colspan;
|
|
27180
|
+
}
|
|
27181
|
+
});
|
|
27182
|
+
skipOccupiedColumns();
|
|
27183
|
+
fillUntil(totalColumns, "gridAfter");
|
|
27064
27184
|
const newNode = {
|
|
27065
27185
|
type: "tableRow",
|
|
27066
27186
|
content,
|
|
@@ -27068,11 +27188,39 @@ const encode$p = (params, encodedAttrs) => {
|
|
|
27068
27188
|
};
|
|
27069
27189
|
return newNode;
|
|
27070
27190
|
};
|
|
27071
|
-
const decode$
|
|
27191
|
+
const decode$p = (params, decodedAttrs) => {
|
|
27072
27192
|
const { node } = params;
|
|
27073
|
-
const
|
|
27193
|
+
const cells = node.content || [];
|
|
27194
|
+
let leadingPlaceholders = 0;
|
|
27195
|
+
while (leadingPlaceholders < cells.length && isPlaceholderCell(cells[leadingPlaceholders])) {
|
|
27196
|
+
leadingPlaceholders += 1;
|
|
27197
|
+
}
|
|
27198
|
+
let trailingPlaceholders = 0;
|
|
27199
|
+
while (trailingPlaceholders < cells.length - leadingPlaceholders && isPlaceholderCell(cells[cells.length - 1 - trailingPlaceholders])) {
|
|
27200
|
+
trailingPlaceholders += 1;
|
|
27201
|
+
}
|
|
27202
|
+
const trimmedSlice = cells.slice(leadingPlaceholders, cells.length - trailingPlaceholders);
|
|
27203
|
+
const sanitizedCells = trimmedSlice.map((cell) => {
|
|
27204
|
+
if (cell?.attrs && "__placeholder" in cell.attrs) {
|
|
27205
|
+
const { __placeholder, ...rest } = cell.attrs;
|
|
27206
|
+
return { ...cell, attrs: rest };
|
|
27207
|
+
}
|
|
27208
|
+
return cell;
|
|
27209
|
+
});
|
|
27210
|
+
const trimmedContent = sanitizedCells.filter((_2, index2) => !isPlaceholderCell(trimmedSlice[index2]));
|
|
27211
|
+
const translateParams = {
|
|
27212
|
+
...params,
|
|
27213
|
+
node: { ...node, content: trimmedContent }
|
|
27214
|
+
};
|
|
27215
|
+
const elements = translateChildNodes(translateParams);
|
|
27074
27216
|
if (node.attrs?.tableRowProperties) {
|
|
27075
27217
|
const tableRowProperties = { ...node.attrs.tableRowProperties };
|
|
27218
|
+
if (leadingPlaceholders > 0) {
|
|
27219
|
+
tableRowProperties.gridBefore = leadingPlaceholders;
|
|
27220
|
+
}
|
|
27221
|
+
if (trailingPlaceholders > 0) {
|
|
27222
|
+
tableRowProperties.gridAfter = trailingPlaceholders;
|
|
27223
|
+
}
|
|
27076
27224
|
if (node.attrs.rowHeight != null) {
|
|
27077
27225
|
const rowHeightPixels = twipsToPixels(node.attrs.tableRowProperties["rowHeight"]?.value);
|
|
27078
27226
|
if (rowHeightPixels !== node.attrs.rowHeight) {
|
|
@@ -27080,7 +27228,7 @@ const decode$r = (params, decodedAttrs) => {
|
|
|
27080
27228
|
}
|
|
27081
27229
|
}
|
|
27082
27230
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
27083
|
-
const trPr = translator$
|
|
27231
|
+
const trPr = translator$_.decode({
|
|
27084
27232
|
...params,
|
|
27085
27233
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
27086
27234
|
});
|
|
@@ -27093,21 +27241,21 @@ const decode$r = (params, decodedAttrs) => {
|
|
|
27093
27241
|
};
|
|
27094
27242
|
};
|
|
27095
27243
|
const config$g = {
|
|
27096
|
-
xmlName: XML_NODE_NAME$
|
|
27244
|
+
xmlName: XML_NODE_NAME$h,
|
|
27097
27245
|
sdNodeOrKeyName: SD_NODE_NAME$d,
|
|
27098
27246
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27099
|
-
encode: encode$
|
|
27100
|
-
decode: decode$
|
|
27247
|
+
encode: encode$n,
|
|
27248
|
+
decode: decode$p,
|
|
27101
27249
|
attributes: validXmlAttributes$b
|
|
27102
27250
|
};
|
|
27103
|
-
const translator$
|
|
27104
|
-
const translator$
|
|
27251
|
+
const translator$Z = NodeTranslator.from(config$g);
|
|
27252
|
+
const translator$Y = NodeTranslator.from({
|
|
27105
27253
|
xmlName: "w:bidiVisual",
|
|
27106
27254
|
sdNodeOrKeyName: "rightToLeft",
|
|
27107
27255
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
27108
27256
|
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
27109
27257
|
});
|
|
27110
|
-
const translator$
|
|
27258
|
+
const translator$X = NodeTranslator.from({
|
|
27111
27259
|
xmlName: "w:shd",
|
|
27112
27260
|
sdNodeOrKeyName: "shading",
|
|
27113
27261
|
attributes: [
|
|
@@ -27129,11 +27277,11 @@ const translator$I = NodeTranslator.from({
|
|
|
27129
27277
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
27130
27278
|
}
|
|
27131
27279
|
});
|
|
27132
|
-
const translator$
|
|
27133
|
-
const translator$
|
|
27134
|
-
const translator$
|
|
27135
|
-
const translator$
|
|
27136
|
-
const translator$
|
|
27280
|
+
const translator$W = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
27281
|
+
const translator$V = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
27282
|
+
const translator$U = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
27283
|
+
const translator$T = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
27284
|
+
const translator$S = NodeTranslator.from({
|
|
27137
27285
|
xmlName: "w:tblLook",
|
|
27138
27286
|
sdNodeOrKeyName: "tblLook",
|
|
27139
27287
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
@@ -27145,16 +27293,16 @@ const translator$D = NodeTranslator.from({
|
|
|
27145
27293
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
27146
27294
|
}
|
|
27147
27295
|
});
|
|
27148
|
-
const translator$
|
|
27149
|
-
const translator$
|
|
27150
|
-
const translator$
|
|
27296
|
+
const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
27297
|
+
const translator$Q = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
27298
|
+
const translator$P = NodeTranslator.from(
|
|
27151
27299
|
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
27152
27300
|
);
|
|
27153
|
-
const translator$
|
|
27301
|
+
const translator$O = NodeTranslator.from(
|
|
27154
27302
|
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
27155
27303
|
);
|
|
27156
|
-
const translator$
|
|
27157
|
-
const translator$
|
|
27304
|
+
const translator$N = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
27305
|
+
const translator$M = NodeTranslator.from({
|
|
27158
27306
|
xmlName: "w:tblpPr",
|
|
27159
27307
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
27160
27308
|
attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
|
|
@@ -27166,160 +27314,67 @@ const translator$x = NodeTranslator.from({
|
|
|
27166
27314
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
27167
27315
|
}
|
|
27168
27316
|
});
|
|
27169
|
-
const translator$
|
|
27170
|
-
const translator$
|
|
27171
|
-
const translator$
|
|
27172
|
-
const translator$
|
|
27173
|
-
const translator$
|
|
27174
|
-
const translator$
|
|
27175
|
-
const translator$
|
|
27176
|
-
const translator$
|
|
27177
|
-
const translator$
|
|
27178
|
-
const translator$
|
|
27179
|
-
const translator$
|
|
27180
|
-
const translator$
|
|
27181
|
-
const translator$
|
|
27182
|
-
const translator$
|
|
27183
|
-
const
|
|
27184
|
-
|
|
27185
|
-
const encode$o = (params) => {
|
|
27186
|
-
const { nodes } = params;
|
|
27187
|
-
const node = nodes[0];
|
|
27188
|
-
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
27189
|
-
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
27190
|
-
};
|
|
27191
|
-
const decode$q = (params) => {
|
|
27192
|
-
const { borders = {} } = params.node.attrs || {};
|
|
27193
|
-
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
27194
|
-
const newNode = {
|
|
27195
|
-
name: "w:tblBorders",
|
|
27196
|
-
type: "element",
|
|
27197
|
-
attributes: {},
|
|
27198
|
-
elements
|
|
27199
|
-
};
|
|
27200
|
-
return newNode;
|
|
27201
|
-
};
|
|
27202
|
-
const propertyTranslators$2 = [
|
|
27203
|
-
translator$w,
|
|
27204
|
-
translator$u,
|
|
27205
|
-
translator$s,
|
|
27206
|
-
translator$r,
|
|
27207
|
-
translator$q,
|
|
27208
|
-
translator$o,
|
|
27209
|
-
translator$m,
|
|
27210
|
-
translator$k
|
|
27211
|
-
];
|
|
27212
|
-
const tblBordersTranslatorsByXmlName = {};
|
|
27213
|
-
const tblBordersTranslatorsBySdName = {};
|
|
27214
|
-
propertyTranslators$2.forEach((translator2) => {
|
|
27215
|
-
tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
27216
|
-
tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
27217
|
-
});
|
|
27218
|
-
const translator$i = NodeTranslator.from({
|
|
27219
|
-
xmlName: XML_NODE_NAME$i,
|
|
27220
|
-
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
27221
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
27222
|
-
attributes: [],
|
|
27223
|
-
encode: encode$o,
|
|
27224
|
-
decode: decode$q
|
|
27225
|
-
});
|
|
27226
|
-
const XML_NODE_NAME$h = "w:tblCellMar";
|
|
27227
|
-
const SD_ATTR_KEY$4 = "cellMargins";
|
|
27228
|
-
const encode$n = (params) => {
|
|
27229
|
-
const { nodes } = params;
|
|
27230
|
-
const node = nodes[0];
|
|
27231
|
-
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
27232
|
-
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
27233
|
-
};
|
|
27234
|
-
const decode$p = (params) => {
|
|
27235
|
-
const { cellMargins = {} } = params.node.attrs || {};
|
|
27236
|
-
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
27237
|
-
const newNode = {
|
|
27238
|
-
name: XML_NODE_NAME$h,
|
|
27239
|
-
type: "element",
|
|
27240
|
-
attributes: {},
|
|
27241
|
-
elements
|
|
27242
|
-
};
|
|
27243
|
-
return newNode;
|
|
27244
|
-
};
|
|
27245
|
-
const propertyTranslators$1 = [
|
|
27246
|
-
translator$v,
|
|
27247
|
-
translator$t,
|
|
27248
|
-
translator$p,
|
|
27249
|
-
translator$n,
|
|
27250
|
-
translator$l,
|
|
27251
|
-
translator$j
|
|
27252
|
-
];
|
|
27253
|
-
const propertyTranslatorsByXmlName$1 = {};
|
|
27254
|
-
const propertyTranslatorsBySdName$1 = {};
|
|
27255
|
-
propertyTranslators$1.forEach((translator2) => {
|
|
27256
|
-
propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
|
|
27257
|
-
propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
|
|
27258
|
-
});
|
|
27259
|
-
const translator$h = NodeTranslator.from({
|
|
27260
|
-
xmlName: XML_NODE_NAME$h,
|
|
27261
|
-
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
27262
|
-
type: NodeTranslator.translatorTypes.NODE,
|
|
27263
|
-
attributes: [],
|
|
27264
|
-
encode: encode$n,
|
|
27265
|
-
decode: decode$p
|
|
27266
|
-
});
|
|
27267
|
-
const XML_NODE_NAME$g = "w:tblPr";
|
|
27268
|
-
const SD_ATTR_KEY$3 = "tableProperties";
|
|
27269
|
-
const encode$m = (params) => {
|
|
27270
|
-
const { nodes } = params;
|
|
27271
|
-
const node = nodes[0];
|
|
27272
|
-
const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
|
|
27273
|
-
return {
|
|
27274
|
-
xmlName: XML_NODE_NAME$g,
|
|
27275
|
-
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
27276
|
-
attributes
|
|
27277
|
-
};
|
|
27278
|
-
};
|
|
27279
|
-
const decode$o = (params) => {
|
|
27280
|
-
const { tableProperties = {} } = params.node.attrs || {};
|
|
27281
|
-
const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
|
|
27282
|
-
const newNode = {
|
|
27283
|
-
name: "w:tblPr",
|
|
27284
|
-
type: "element",
|
|
27285
|
-
attributes: {},
|
|
27286
|
-
elements
|
|
27287
|
-
};
|
|
27288
|
-
return newNode;
|
|
27289
|
-
};
|
|
27290
|
-
const propertyTranslators = [
|
|
27317
|
+
const translator$L = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
27318
|
+
const translator$K = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
27319
|
+
const translator$J = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
27320
|
+
const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
27321
|
+
const translator$H = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
27322
|
+
const translator$G = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
27323
|
+
const translator$F = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
27324
|
+
const translator$E = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
27325
|
+
const translator$D = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
27326
|
+
const translator$C = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
27327
|
+
const translator$B = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
27328
|
+
const translator$A = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
27329
|
+
const translator$z = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
27330
|
+
const translator$y = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
27331
|
+
const propertyTranslators$5 = [
|
|
27332
|
+
translator$L,
|
|
27291
27333
|
translator$J,
|
|
27292
|
-
translator$R,
|
|
27293
|
-
translator$I,
|
|
27294
27334
|
translator$H,
|
|
27295
|
-
translator$Q,
|
|
27296
27335
|
translator$G,
|
|
27297
27336
|
translator$F,
|
|
27298
|
-
translator$E,
|
|
27299
27337
|
translator$D,
|
|
27300
|
-
translator$C,
|
|
27301
27338
|
translator$B,
|
|
27339
|
+
translator$z
|
|
27340
|
+
];
|
|
27341
|
+
const translator$x = NodeTranslator.from(
|
|
27342
|
+
createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$5)
|
|
27343
|
+
);
|
|
27344
|
+
const propertyTranslators$4 = [
|
|
27345
|
+
translator$K,
|
|
27346
|
+
translator$I,
|
|
27347
|
+
translator$E,
|
|
27348
|
+
translator$C,
|
|
27302
27349
|
translator$A,
|
|
27303
|
-
translator$
|
|
27304
|
-
|
|
27350
|
+
translator$y
|
|
27351
|
+
];
|
|
27352
|
+
const translator$w = NodeTranslator.from(
|
|
27353
|
+
createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$4)
|
|
27354
|
+
);
|
|
27355
|
+
const propertyTranslators$3 = [
|
|
27356
|
+
translator$Y,
|
|
27357
|
+
translator$14,
|
|
27358
|
+
translator$X,
|
|
27359
|
+
translator$W,
|
|
27360
|
+
translator$13,
|
|
27361
|
+
translator$V,
|
|
27362
|
+
translator$U,
|
|
27363
|
+
translator$T,
|
|
27364
|
+
translator$S,
|
|
27365
|
+
translator$R,
|
|
27366
|
+
translator$Q,
|
|
27367
|
+
translator$P,
|
|
27368
|
+
translator$O,
|
|
27369
|
+
translator$N,
|
|
27370
|
+
translator$M,
|
|
27305
27371
|
translator$x,
|
|
27306
|
-
translator$
|
|
27307
|
-
translator$h
|
|
27372
|
+
translator$w
|
|
27308
27373
|
];
|
|
27309
|
-
const
|
|
27310
|
-
|
|
27311
|
-
|
|
27312
|
-
|
|
27313
|
-
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
27314
|
-
});
|
|
27315
|
-
const config$f = {
|
|
27316
|
-
xmlName: XML_NODE_NAME$g,
|
|
27317
|
-
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
27318
|
-
encode: encode$m,
|
|
27319
|
-
decode: decode$o
|
|
27320
|
-
};
|
|
27321
|
-
const translator$g = NodeTranslator.from(config$f);
|
|
27322
|
-
const translator$f = NodeTranslator.from(
|
|
27374
|
+
const translator$v = NodeTranslator.from(
|
|
27375
|
+
createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators$3)
|
|
27376
|
+
);
|
|
27377
|
+
const translator$u = NodeTranslator.from(
|
|
27323
27378
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
27324
27379
|
);
|
|
27325
27380
|
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
@@ -27369,20 +27424,20 @@ const resolveFallbackColumnWidthTwips = (params, totalColumns, cellMinWidthTwips
|
|
|
27369
27424
|
}
|
|
27370
27425
|
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
27371
27426
|
};
|
|
27372
|
-
const XML_NODE_NAME$
|
|
27373
|
-
const SD_ATTR_KEY$
|
|
27427
|
+
const XML_NODE_NAME$g = "w:tblGrid";
|
|
27428
|
+
const SD_ATTR_KEY$3 = "grid";
|
|
27374
27429
|
const cellMinWidth = pixelsToTwips(10);
|
|
27375
|
-
const encode$
|
|
27430
|
+
const encode$m = (params) => {
|
|
27376
27431
|
const { nodes } = params;
|
|
27377
27432
|
const node = nodes[0];
|
|
27378
|
-
const attributes = encodeProperties(node, { [translator$
|
|
27433
|
+
const attributes = encodeProperties(node, { [translator$u.xmlName]: translator$u }, true);
|
|
27379
27434
|
return {
|
|
27380
|
-
xmlName: XML_NODE_NAME$
|
|
27381
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
27435
|
+
xmlName: XML_NODE_NAME$g,
|
|
27436
|
+
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
27382
27437
|
attributes
|
|
27383
27438
|
};
|
|
27384
27439
|
};
|
|
27385
|
-
const decode$
|
|
27440
|
+
const decode$o = (params) => {
|
|
27386
27441
|
const { grid: rawGrid } = params.node.attrs || {};
|
|
27387
27442
|
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
27388
27443
|
const { firstRow = {} } = params.extraParams || {};
|
|
@@ -27395,17 +27450,21 @@ const decode$n = (params) => {
|
|
|
27395
27450
|
const fallbackColumnWidthTwips = resolveFallbackColumnWidthTwips(params, totalColumns, cellMinWidth);
|
|
27396
27451
|
const elements = [];
|
|
27397
27452
|
let columnIndex = 0;
|
|
27398
|
-
const pushColumn = (widthTwips) => {
|
|
27453
|
+
const pushColumn = (widthTwips, { enforceMinimum = false } = {}) => {
|
|
27399
27454
|
let numericWidth = typeof widthTwips === "string" ? parseInt(widthTwips, 10) : widthTwips;
|
|
27455
|
+
let shouldEnforceMinimum = enforceMinimum;
|
|
27400
27456
|
if (numericWidth == null || Number.isNaN(numericWidth) || numericWidth <= 0) {
|
|
27401
27457
|
numericWidth = fallbackColumnWidthTwips;
|
|
27458
|
+
shouldEnforceMinimum = true;
|
|
27402
27459
|
}
|
|
27403
|
-
|
|
27404
|
-
const
|
|
27460
|
+
const roundedWidth = Math.round(numericWidth);
|
|
27461
|
+
const minimumWidth = shouldEnforceMinimum ? cellMinWidth : 1;
|
|
27462
|
+
const safeWidth = Math.max(roundedWidth, minimumWidth);
|
|
27463
|
+
const decoded = translator$u.decode({
|
|
27405
27464
|
node: { type: (
|
|
27406
27465
|
/** @type {string} */
|
|
27407
|
-
translator$
|
|
27408
|
-
), attrs: { col:
|
|
27466
|
+
translator$u.sdNodeOrKeyName
|
|
27467
|
+
), attrs: { col: safeWidth } }
|
|
27409
27468
|
});
|
|
27410
27469
|
if (decoded) elements.push(decoded);
|
|
27411
27470
|
};
|
|
@@ -27413,13 +27472,17 @@ const decode$n = (params) => {
|
|
|
27413
27472
|
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
27414
27473
|
const spanCount = Math.max(1, colspan);
|
|
27415
27474
|
for (let span = 0; span < spanCount; span++) {
|
|
27416
|
-
const
|
|
27475
|
+
const rawWidth = Array.isArray(colwidth) ? colwidth[span] : void 0;
|
|
27476
|
+
const cellWidthPixels = typeof rawWidth === "number" && Number.isFinite(rawWidth) ? rawWidth : Number(rawWidth);
|
|
27477
|
+
const hasCellWidth = Number.isFinite(cellWidthPixels) && cellWidthPixels > 0;
|
|
27417
27478
|
const colGridAttrs = grid?.[columnIndex] || {};
|
|
27418
27479
|
const gridWidthTwips = normalizeTwipWidth(colGridAttrs.col);
|
|
27419
27480
|
const gridWidthPixels = gridWidthTwips != null ? twipsToPixels(gridWidthTwips) : null;
|
|
27420
27481
|
let cellWidthTwips;
|
|
27421
|
-
|
|
27422
|
-
|
|
27482
|
+
let enforceMinimum = false;
|
|
27483
|
+
if (hasCellWidth) {
|
|
27484
|
+
const tolerance = 0.5;
|
|
27485
|
+
if (gridWidthTwips != null && gridWidthPixels != null && Math.abs(gridWidthPixels - cellWidthPixels) <= tolerance) {
|
|
27423
27486
|
cellWidthTwips = gridWidthTwips;
|
|
27424
27487
|
} else {
|
|
27425
27488
|
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
@@ -27428,8 +27491,9 @@ const decode$n = (params) => {
|
|
|
27428
27491
|
cellWidthTwips = gridWidthTwips;
|
|
27429
27492
|
} else {
|
|
27430
27493
|
cellWidthTwips = fallbackColumnWidthTwips;
|
|
27494
|
+
enforceMinimum = true;
|
|
27431
27495
|
}
|
|
27432
|
-
pushColumn(cellWidthTwips);
|
|
27496
|
+
pushColumn(cellWidthTwips, { enforceMinimum });
|
|
27433
27497
|
columnIndex++;
|
|
27434
27498
|
}
|
|
27435
27499
|
});
|
|
@@ -27439,19 +27503,19 @@ const decode$n = (params) => {
|
|
|
27439
27503
|
columnIndex++;
|
|
27440
27504
|
}
|
|
27441
27505
|
const newNode = {
|
|
27442
|
-
name: XML_NODE_NAME$
|
|
27506
|
+
name: XML_NODE_NAME$g,
|
|
27443
27507
|
attributes: {},
|
|
27444
27508
|
elements
|
|
27445
27509
|
};
|
|
27446
27510
|
return newNode;
|
|
27447
27511
|
};
|
|
27448
|
-
const config$
|
|
27449
|
-
xmlName: XML_NODE_NAME$
|
|
27450
|
-
sdNodeOrKeyName: SD_ATTR_KEY$
|
|
27451
|
-
encode: encode$
|
|
27452
|
-
decode: decode$
|
|
27512
|
+
const config$f = {
|
|
27513
|
+
xmlName: XML_NODE_NAME$g,
|
|
27514
|
+
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
27515
|
+
encode: encode$m,
|
|
27516
|
+
decode: decode$o
|
|
27453
27517
|
};
|
|
27454
|
-
const translator$
|
|
27518
|
+
const translator$t = NodeTranslator.from(config$f);
|
|
27455
27519
|
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
27456
27520
|
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
27457
27521
|
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
@@ -27514,19 +27578,19 @@ const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasure
|
|
|
27514
27578
|
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27515
27579
|
};
|
|
27516
27580
|
};
|
|
27517
|
-
const XML_NODE_NAME$
|
|
27581
|
+
const XML_NODE_NAME$f = "w:tbl";
|
|
27518
27582
|
const SD_NODE_NAME$c = "table";
|
|
27519
|
-
const encode$
|
|
27583
|
+
const encode$l = (params, encodedAttrs) => {
|
|
27520
27584
|
const { nodes } = params;
|
|
27521
27585
|
const node = nodes[0];
|
|
27522
27586
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
27523
27587
|
if (tblPr) {
|
|
27524
|
-
const encodedProperties = translator$
|
|
27525
|
-
encodedAttrs["tableProperties"] = encodedProperties
|
|
27588
|
+
const encodedProperties = translator$v.encode({ ...params, nodes: [tblPr] });
|
|
27589
|
+
encodedAttrs["tableProperties"] = encodedProperties || {};
|
|
27526
27590
|
}
|
|
27527
27591
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
27528
27592
|
if (tblGrid) {
|
|
27529
|
-
encodedAttrs["grid"] = translator$
|
|
27593
|
+
encodedAttrs["grid"] = translator$t.encode({ ...params, nodes: [tblGrid] }).attributes;
|
|
27530
27594
|
}
|
|
27531
27595
|
[
|
|
27532
27596
|
"tableStyleId",
|
|
@@ -27592,8 +27656,10 @@ const encode$k = (params, encodedAttrs) => {
|
|
|
27592
27656
|
}
|
|
27593
27657
|
}
|
|
27594
27658
|
const content = [];
|
|
27595
|
-
|
|
27596
|
-
|
|
27659
|
+
const totalColumns = columnWidths.length;
|
|
27660
|
+
const activeRowSpans = totalColumns > 0 ? new Array(totalColumns).fill(0) : [];
|
|
27661
|
+
rows.forEach((row, rowIndex) => {
|
|
27662
|
+
const result = translator$Z.encode({
|
|
27597
27663
|
...params,
|
|
27598
27664
|
nodes: [row],
|
|
27599
27665
|
extraParams: {
|
|
@@ -27601,10 +27667,45 @@ const encode$k = (params, encodedAttrs) => {
|
|
|
27601
27667
|
table: node,
|
|
27602
27668
|
rowBorders: borderRowData,
|
|
27603
27669
|
styleTag: tblStyleTag,
|
|
27604
|
-
columnWidths
|
|
27670
|
+
columnWidths,
|
|
27671
|
+
activeRowSpans: activeRowSpans.slice(),
|
|
27672
|
+
rowIndex
|
|
27605
27673
|
}
|
|
27606
27674
|
});
|
|
27607
|
-
if (result)
|
|
27675
|
+
if (result) {
|
|
27676
|
+
content.push(result);
|
|
27677
|
+
if (totalColumns > 0) {
|
|
27678
|
+
const activeRowSpansForCurrentRow = activeRowSpans.slice();
|
|
27679
|
+
for (let col = 0; col < totalColumns; col++) {
|
|
27680
|
+
if (activeRowSpans[col] > 0) {
|
|
27681
|
+
activeRowSpans[col] -= 1;
|
|
27682
|
+
}
|
|
27683
|
+
}
|
|
27684
|
+
let columnIndex = 0;
|
|
27685
|
+
const advanceColumnIndex = () => {
|
|
27686
|
+
while (columnIndex < totalColumns && activeRowSpansForCurrentRow[columnIndex] > 0) {
|
|
27687
|
+
columnIndex += 1;
|
|
27688
|
+
}
|
|
27689
|
+
};
|
|
27690
|
+
advanceColumnIndex();
|
|
27691
|
+
result.content?.forEach((cell) => {
|
|
27692
|
+
advanceColumnIndex();
|
|
27693
|
+
const colspan = Math.max(1, cell.attrs?.colspan || 1);
|
|
27694
|
+
const rowspan = Math.max(1, cell.attrs?.rowspan || 1);
|
|
27695
|
+
if (rowspan > 1) {
|
|
27696
|
+
for (let offset = 0; offset < colspan && columnIndex + offset < totalColumns; offset++) {
|
|
27697
|
+
const targetIndex = columnIndex + offset;
|
|
27698
|
+
const remainingRows = rowspan - 1;
|
|
27699
|
+
if (remainingRows > 0 && remainingRows > activeRowSpans[targetIndex]) {
|
|
27700
|
+
activeRowSpans[targetIndex] = remainingRows;
|
|
27701
|
+
}
|
|
27702
|
+
}
|
|
27703
|
+
}
|
|
27704
|
+
columnIndex += colspan;
|
|
27705
|
+
advanceColumnIndex();
|
|
27706
|
+
});
|
|
27707
|
+
}
|
|
27708
|
+
}
|
|
27608
27709
|
});
|
|
27609
27710
|
return {
|
|
27610
27711
|
type: "table",
|
|
@@ -27612,13 +27713,13 @@ const encode$k = (params, encodedAttrs) => {
|
|
|
27612
27713
|
attrs: encodedAttrs
|
|
27613
27714
|
};
|
|
27614
27715
|
};
|
|
27615
|
-
const decode$
|
|
27716
|
+
const decode$n = (params, decodedAttrs) => {
|
|
27616
27717
|
params.node = preProcessVerticalMergeCells(params.node, params);
|
|
27617
27718
|
const { node } = params;
|
|
27618
27719
|
const elements = translateChildNodes(params);
|
|
27619
27720
|
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
27620
27721
|
const properties = node.attrs.grid;
|
|
27621
|
-
const element = translator$
|
|
27722
|
+
const element = translator$t.decode({
|
|
27622
27723
|
...params,
|
|
27623
27724
|
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
27624
27725
|
extraParams: {
|
|
@@ -27628,7 +27729,7 @@ const decode$m = (params, decodedAttrs) => {
|
|
|
27628
27729
|
if (element) elements.unshift(element);
|
|
27629
27730
|
if (node.attrs?.tableProperties) {
|
|
27630
27731
|
const properties2 = { ...node.attrs.tableProperties };
|
|
27631
|
-
const element2 = translator$
|
|
27732
|
+
const element2 = translator$v.decode({
|
|
27632
27733
|
...params,
|
|
27633
27734
|
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
27634
27735
|
});
|
|
@@ -27648,7 +27749,7 @@ function _processTableBorders(rawBorders) {
|
|
|
27648
27749
|
const color = attributes.color;
|
|
27649
27750
|
const size = attributes.size;
|
|
27650
27751
|
if (color && color !== "auto") attrs["color"] = color.startsWith("#") ? color : `#${color}`;
|
|
27651
|
-
if (size && size !== "auto") attrs["size"] =
|
|
27752
|
+
if (size && size !== "auto") attrs["size"] = eighthPointsToPixels(size);
|
|
27652
27753
|
const rowBorderNames = ["insideH", "insideV"];
|
|
27653
27754
|
if (rowBorderNames.includes(name)) rowBorders[name] = attrs;
|
|
27654
27755
|
borders[name] = attrs;
|
|
@@ -27694,7 +27795,7 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
27694
27795
|
if (baseTblPr && baseTblPr.elements) {
|
|
27695
27796
|
tblPr.elements.push(...baseTblPr.elements);
|
|
27696
27797
|
}
|
|
27697
|
-
const tableProperties = translator$
|
|
27798
|
+
const tableProperties = translator$v.encode({ ...params, nodes: [tblPr] });
|
|
27698
27799
|
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
27699
27800
|
if (borders) stylesToReturn.borders = borders;
|
|
27700
27801
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
@@ -27711,16 +27812,16 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
27711
27812
|
}
|
|
27712
27813
|
return stylesToReturn;
|
|
27713
27814
|
}
|
|
27714
|
-
const config$
|
|
27715
|
-
xmlName: XML_NODE_NAME$
|
|
27815
|
+
const config$e = {
|
|
27816
|
+
xmlName: XML_NODE_NAME$f,
|
|
27716
27817
|
sdNodeOrKeyName: SD_NODE_NAME$c,
|
|
27717
27818
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27718
|
-
encode: encode$
|
|
27719
|
-
decode: decode$
|
|
27819
|
+
encode: encode$l,
|
|
27820
|
+
decode: decode$n,
|
|
27720
27821
|
attributes: []
|
|
27721
27822
|
};
|
|
27722
|
-
const translator$
|
|
27723
|
-
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$
|
|
27823
|
+
const translator$s = NodeTranslator.from(config$e);
|
|
27824
|
+
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$s);
|
|
27724
27825
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
27725
27826
|
if (!tblStyleTag) return null;
|
|
27726
27827
|
const stylesToReturn = {};
|
|
@@ -27791,7 +27892,7 @@ function processTableBorders(borderElements) {
|
|
|
27791
27892
|
const color = attributes["w:color"];
|
|
27792
27893
|
const size = attributes["w:sz"];
|
|
27793
27894
|
if (color && color !== "auto") attrs["color"] = color.startsWith("#") ? color : `#${color}`;
|
|
27794
|
-
if (size && size !== "auto") attrs["size"] =
|
|
27895
|
+
if (size && size !== "auto") attrs["size"] = eighthPointsToPixels(size);
|
|
27795
27896
|
const rowBorderNames = ["insideH", "insideV"];
|
|
27796
27897
|
if (rowBorderNames.includes(borderName)) rowBorders[borderName] = attrs;
|
|
27797
27898
|
borders[borderName] = attrs;
|
|
@@ -27801,6 +27902,125 @@ function processTableBorders(borderElements) {
|
|
|
27801
27902
|
rowBorders
|
|
27802
27903
|
};
|
|
27803
27904
|
}
|
|
27905
|
+
const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
|
|
27906
|
+
const translator$q = NodeTranslator.from(
|
|
27907
|
+
createSingleAttrPropertyHandler(
|
|
27908
|
+
"w:gridSpan",
|
|
27909
|
+
null,
|
|
27910
|
+
"w:val",
|
|
27911
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
27912
|
+
(v2) => integerToString(v2)
|
|
27913
|
+
)
|
|
27914
|
+
);
|
|
27915
|
+
const translator$p = NodeTranslator.from(createSingleAttrPropertyHandler("w:vMerge"));
|
|
27916
|
+
const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:tl2br"));
|
|
27917
|
+
const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:tr2bl"));
|
|
27918
|
+
const propertyTranslators$2 = [
|
|
27919
|
+
translator$z,
|
|
27920
|
+
translator$B,
|
|
27921
|
+
translator$F,
|
|
27922
|
+
translator$L,
|
|
27923
|
+
translator$J,
|
|
27924
|
+
translator$D,
|
|
27925
|
+
translator$H,
|
|
27926
|
+
translator$G,
|
|
27927
|
+
translator$o,
|
|
27928
|
+
translator$n
|
|
27929
|
+
];
|
|
27930
|
+
const translator$m = NodeTranslator.from(
|
|
27931
|
+
createNestedPropertiesTranslator("w:tcBorders", "borders", propertyTranslators$2)
|
|
27932
|
+
);
|
|
27933
|
+
const translator$l = NodeTranslator.from(
|
|
27934
|
+
createSingleAttrPropertyHandler(
|
|
27935
|
+
"w:noWrap",
|
|
27936
|
+
null,
|
|
27937
|
+
"w:val",
|
|
27938
|
+
(v2) => parseBoolean(v2 ?? "true"),
|
|
27939
|
+
(v2) => booleanToString(v2)
|
|
27940
|
+
)
|
|
27941
|
+
);
|
|
27942
|
+
const propertyTranslators$1 = [
|
|
27943
|
+
translator$K,
|
|
27944
|
+
translator$I,
|
|
27945
|
+
translator$E,
|
|
27946
|
+
translator$C,
|
|
27947
|
+
translator$A,
|
|
27948
|
+
translator$y
|
|
27949
|
+
];
|
|
27950
|
+
const translator$k = NodeTranslator.from(
|
|
27951
|
+
createNestedPropertiesTranslator("w:tcMar", "cellMargins", propertyTranslators$1)
|
|
27952
|
+
);
|
|
27953
|
+
const translator$j = NodeTranslator.from(createSingleAttrPropertyHandler("w:textDirection"));
|
|
27954
|
+
const translator$i = NodeTranslator.from(
|
|
27955
|
+
createSingleAttrPropertyHandler(
|
|
27956
|
+
"w:tcFitText",
|
|
27957
|
+
null,
|
|
27958
|
+
"w:val",
|
|
27959
|
+
(v2) => parseBoolean(v2 ?? "true"),
|
|
27960
|
+
(v2) => booleanToString(v2)
|
|
27961
|
+
)
|
|
27962
|
+
);
|
|
27963
|
+
const translator$h = NodeTranslator.from(createSingleAttrPropertyHandler("w:vAlign"));
|
|
27964
|
+
const translator$g = NodeTranslator.from(
|
|
27965
|
+
createSingleAttrPropertyHandler(
|
|
27966
|
+
"w:hideMark",
|
|
27967
|
+
null,
|
|
27968
|
+
"w:val",
|
|
27969
|
+
(v2) => parseBoolean(v2 ?? "true"),
|
|
27970
|
+
(v2) => booleanToString(v2)
|
|
27971
|
+
)
|
|
27972
|
+
);
|
|
27973
|
+
const translator$f = NodeTranslator.from(createSingleAttrPropertyHandler("w:header"));
|
|
27974
|
+
const XML_NODE_NAME$e = "w:headers";
|
|
27975
|
+
const SD_ATTR_KEY$2 = "headers";
|
|
27976
|
+
const encode$k = (params) => {
|
|
27977
|
+
const { nodes } = params;
|
|
27978
|
+
const node = nodes[0];
|
|
27979
|
+
const attributes = encodeProperties(node, { [translator$f.xmlName]: translator$f }, true);
|
|
27980
|
+
return {
|
|
27981
|
+
xmlName: XML_NODE_NAME$e,
|
|
27982
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
27983
|
+
attributes
|
|
27984
|
+
};
|
|
27985
|
+
};
|
|
27986
|
+
const decode$m = (params) => {
|
|
27987
|
+
const { headers = [] } = params.node.attrs || {};
|
|
27988
|
+
const newNode = {
|
|
27989
|
+
name: XML_NODE_NAME$e,
|
|
27990
|
+
attributes: {},
|
|
27991
|
+
elements: headers.map(
|
|
27992
|
+
(header) => translator$f.decode({
|
|
27993
|
+
node: { type: "header", attrs: header }
|
|
27994
|
+
})
|
|
27995
|
+
)
|
|
27996
|
+
};
|
|
27997
|
+
return newNode;
|
|
27998
|
+
};
|
|
27999
|
+
const config$d = {
|
|
28000
|
+
xmlName: XML_NODE_NAME$e,
|
|
28001
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
28002
|
+
encode: encode$k,
|
|
28003
|
+
decode: decode$m
|
|
28004
|
+
};
|
|
28005
|
+
const translator$e = NodeTranslator.from(config$d);
|
|
28006
|
+
const propertyTranslators = [
|
|
28007
|
+
translator$19,
|
|
28008
|
+
translator$r,
|
|
28009
|
+
translator$q,
|
|
28010
|
+
translator$p,
|
|
28011
|
+
translator$m,
|
|
28012
|
+
translator$X,
|
|
28013
|
+
translator$l,
|
|
28014
|
+
translator$k,
|
|
28015
|
+
translator$j,
|
|
28016
|
+
translator$i,
|
|
28017
|
+
translator$h,
|
|
28018
|
+
translator$g,
|
|
28019
|
+
translator$e
|
|
28020
|
+
];
|
|
28021
|
+
const translator$d = NodeTranslator.from(
|
|
28022
|
+
createNestedPropertiesTranslator("w:tcPr", "tableCellProperties", propertyTranslators)
|
|
28023
|
+
);
|
|
27804
28024
|
function handleTableCellNode({
|
|
27805
28025
|
params,
|
|
27806
28026
|
node,
|
|
@@ -27813,8 +28033,10 @@ function handleTableCellNode({
|
|
|
27813
28033
|
allColumnWidths = []
|
|
27814
28034
|
}) {
|
|
27815
28035
|
const { docx, nodeListHandler } = params;
|
|
28036
|
+
const attributes = {};
|
|
27816
28037
|
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
27817
|
-
const
|
|
28038
|
+
const tableCellProperties = tcPr ? translator$d.encode({ ...params, nodes: [tcPr] }) ?? {} : {};
|
|
28039
|
+
attributes["tableCellProperties"] = tableCellProperties;
|
|
27818
28040
|
if (rowBorders?.insideH) {
|
|
27819
28041
|
rowBorders["bottom"] = rowBorders.insideH;
|
|
27820
28042
|
delete rowBorders.insideH;
|
|
@@ -27823,33 +28045,20 @@ function handleTableCellNode({
|
|
|
27823
28045
|
rowBorders["right"] = rowBorders.insideV;
|
|
27824
28046
|
delete rowBorders?.insideV;
|
|
27825
28047
|
}
|
|
27826
|
-
|
|
27827
|
-
const
|
|
27828
|
-
|
|
27829
|
-
|
|
27830
|
-
|
|
28048
|
+
if (rowBorders) attributes["borders"] = { ...rowBorders };
|
|
28049
|
+
const inlineBorders = processInlineCellBorders(tableCellProperties.borders, rowBorders);
|
|
28050
|
+
if (inlineBorders) attributes["borders"] = Object.assign(attributes["borders"] || {}, inlineBorders);
|
|
28051
|
+
const colspan = tableCellProperties.gridSpan;
|
|
28052
|
+
if (colspan && !isNaN(parseInt(colspan, 10))) attributes["colspan"] = parseInt(colspan, 10);
|
|
28053
|
+
let width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
|
|
28054
|
+
const widthType = tableCellProperties.cellWidth?.type;
|
|
28055
|
+
if (widthType) attributes["widthType"] = widthType;
|
|
27831
28056
|
if (!width && columnWidth) width = columnWidth;
|
|
27832
|
-
const vMerge = getTableCellMergeTag(node);
|
|
27833
|
-
const { attributes: vMergeAttrs } = vMerge || {};
|
|
27834
|
-
const backgroundColor = tcPr?.elements?.find((el) => el.name === "w:shd");
|
|
27835
|
-
const background = {
|
|
27836
|
-
color: backgroundColor?.attributes["w:fill"]
|
|
27837
|
-
};
|
|
27838
|
-
const colspanTag = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27839
|
-
const colspan = colspanTag?.attributes["w:val"];
|
|
27840
|
-
const marginTag = tcPr?.elements?.find((el) => el.name === "w:tcMar");
|
|
27841
|
-
const verticalAlignTag = tcPr?.elements?.find((el) => el.name === "w:vAlign");
|
|
27842
|
-
const verticalAlign = verticalAlignTag?.attributes["w:val"] || "top";
|
|
27843
|
-
const attributes = {};
|
|
27844
|
-
const referencedStyles = getReferencedTableStyles(styleTag, docx) || {};
|
|
27845
|
-
attributes.cellMargins = getTableCellMargins(marginTag, referencedStyles);
|
|
27846
|
-
const { fontSize, fonts = {} } = referencedStyles;
|
|
27847
|
-
const fontFamily = fonts["ascii"];
|
|
27848
28057
|
if (width) {
|
|
27849
28058
|
attributes["colwidth"] = [width];
|
|
27850
28059
|
attributes["widthUnit"] = "px";
|
|
27851
|
-
const defaultColWidths =
|
|
27852
|
-
const hasDefaultColWidths =
|
|
28060
|
+
const defaultColWidths = allColumnWidths;
|
|
28061
|
+
const hasDefaultColWidths = allColumnWidths && allColumnWidths.length > 0;
|
|
27853
28062
|
const colspanNum = parseInt(colspan || 1, 10);
|
|
27854
28063
|
if (colspanNum && colspanNum > 1 && hasDefaultColWidths) {
|
|
27855
28064
|
let colwidth = [];
|
|
@@ -27867,15 +28076,19 @@ function handleTableCellNode({
|
|
|
27867
28076
|
}
|
|
27868
28077
|
}
|
|
27869
28078
|
}
|
|
27870
|
-
|
|
27871
|
-
|
|
27872
|
-
|
|
27873
|
-
attributes["
|
|
28079
|
+
const background = {
|
|
28080
|
+
color: tableCellProperties.shading?.fill
|
|
28081
|
+
};
|
|
28082
|
+
if (background.color) attributes["background"] = background;
|
|
28083
|
+
const verticalAlign = tableCellProperties.vAlign;
|
|
28084
|
+
if (verticalAlign) attributes["verticalAlign"] = verticalAlign;
|
|
28085
|
+
const referencedStyles = getReferencedTableStyles(styleTag, docx) || { fontSize: null, fonts: {}, cellMargins: {} };
|
|
28086
|
+
attributes.cellMargins = getTableCellMargins(tableCellProperties.cellMargins, referencedStyles);
|
|
28087
|
+
const { fontSize, fonts = {} } = referencedStyles;
|
|
28088
|
+
const fontFamily = fonts["ascii"];
|
|
27874
28089
|
if (fontSize) attributes["fontSize"] = fontSize;
|
|
27875
|
-
if (fontFamily) attributes["fontFamily"] = fontFamily
|
|
27876
|
-
if (
|
|
27877
|
-
if (inlineBorders) attributes["borders"] = Object.assign(attributes["borders"] || {}, inlineBorders);
|
|
27878
|
-
if (vMergeAttrs && vMergeAttrs["w:val"] === "restart") {
|
|
28090
|
+
if (fontFamily) attributes["fontFamily"] = fontFamily;
|
|
28091
|
+
if (tableCellProperties.vMerge === "restart") {
|
|
27879
28092
|
const rows = table.elements.filter((el) => el.name === "w:tr");
|
|
27880
28093
|
const currentRowIndex = rows.findIndex((r) => r === row);
|
|
27881
28094
|
const remainingRows = rows.slice(currentRowIndex + 1);
|
|
@@ -27886,9 +28099,8 @@ function handleTableCellNode({
|
|
|
27886
28099
|
const firstCell = remainingRow.elements.findIndex((el) => el.name === "w:tc");
|
|
27887
28100
|
const cellAtIndex = remainingRow.elements[firstCell + cellIndex];
|
|
27888
28101
|
if (!cellAtIndex) break;
|
|
27889
|
-
const
|
|
27890
|
-
|
|
27891
|
-
if (!vMerge2 && !currentCellMergeAttrs || currentCellMergeAttrs && currentCellMergeAttrs["w:val"] === "restart") {
|
|
28102
|
+
const vMerge = getTableCellVMerge(cellAtIndex);
|
|
28103
|
+
if (!vMerge || vMerge === "restart") {
|
|
27892
28104
|
break;
|
|
27893
28105
|
}
|
|
27894
28106
|
rowspan++;
|
|
@@ -27908,69 +28120,52 @@ function handleTableCellNode({
|
|
|
27908
28120
|
}
|
|
27909
28121
|
const processInlineCellBorders = (borders, rowBorders) => {
|
|
27910
28122
|
if (!borders) return null;
|
|
27911
|
-
|
|
27912
|
-
|
|
27913
|
-
|
|
27914
|
-
|
|
27915
|
-
|
|
27916
|
-
|
|
27917
|
-
|
|
27918
|
-
|
|
27919
|
-
|
|
27920
|
-
|
|
27921
|
-
|
|
27922
|
-
const
|
|
27923
|
-
|
|
27924
|
-
|
|
27925
|
-
|
|
27926
|
-
|
|
27927
|
-
|
|
27928
|
-
|
|
27929
|
-
|
|
27930
|
-
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
const border = Object.assign({}, rowBorders[direction] || {});
|
|
27934
|
-
if (!Object.keys(border)) return null;
|
|
27935
|
-
border["val"] = "none";
|
|
27936
|
-
return border;
|
|
27937
|
-
}
|
|
27938
|
-
return null;
|
|
28123
|
+
return ["bottom", "top", "left", "right"].reduce((acc, direction) => {
|
|
28124
|
+
const borderAttrs = borders[direction];
|
|
28125
|
+
const rowBorderAttrs = rowBorders[direction];
|
|
28126
|
+
if (borderAttrs && borderAttrs["val"] !== "nil") {
|
|
28127
|
+
const color = borderAttrs["color"];
|
|
28128
|
+
let size = borderAttrs["size"];
|
|
28129
|
+
if (size) size = eighthPointsToPixels(size);
|
|
28130
|
+
acc[direction] = { color, size, val: borderAttrs["val"] };
|
|
28131
|
+
return acc;
|
|
28132
|
+
}
|
|
28133
|
+
if (borderAttrs && borderAttrs["val"] === "nil") {
|
|
28134
|
+
const border = Object.assign({}, rowBorderAttrs || {});
|
|
28135
|
+
if (!Object.keys(border).length) {
|
|
28136
|
+
return acc;
|
|
28137
|
+
} else {
|
|
28138
|
+
border["val"] = "none";
|
|
28139
|
+
acc[direction] = border;
|
|
28140
|
+
return acc;
|
|
28141
|
+
}
|
|
28142
|
+
}
|
|
28143
|
+
return acc;
|
|
28144
|
+
}, {});
|
|
27939
28145
|
};
|
|
27940
|
-
const
|
|
28146
|
+
const getTableCellVMerge = (node) => {
|
|
27941
28147
|
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
27942
28148
|
const vMerge = tcPr?.elements?.find((el) => el.name === "w:vMerge");
|
|
27943
|
-
return
|
|
27944
|
-
|
|
27945
|
-
|
|
27946
|
-
|
|
27947
|
-
const inlineMarginRightTag = marginTag?.elements?.find((el) => el.name === "w:right");
|
|
27948
|
-
const inlineMarginTopTag = marginTag?.elements?.find((el) => el.name === "w:top");
|
|
27949
|
-
const inlineMarginBottomTag = marginTag?.elements?.find((el) => el.name === "w:bottom");
|
|
27950
|
-
const inlineMarginLeftValue = inlineMarginLeftTag?.attributes["w:w"];
|
|
27951
|
-
const inlineMarginRightValue = inlineMarginRightTag?.attributes["w:w"];
|
|
27952
|
-
const inlineMarginTopValue = inlineMarginTopTag?.attributes["w:w"];
|
|
27953
|
-
const inlineMarginBottomValue = inlineMarginBottomTag?.attributes["w:w"];
|
|
28149
|
+
if (!vMerge) return null;
|
|
28150
|
+
return vMerge.attributes?.["w:val"] || "continue";
|
|
28151
|
+
};
|
|
28152
|
+
const getTableCellMargins = (inlineMargins, referencedStyles) => {
|
|
27954
28153
|
const { cellMargins = {} } = referencedStyles;
|
|
27955
|
-
|
|
27956
|
-
|
|
27957
|
-
|
|
27958
|
-
|
|
27959
|
-
|
|
27960
|
-
|
|
27961
|
-
|
|
27962
|
-
|
|
27963
|
-
if (styleValue
|
|
27964
|
-
|
|
27965
|
-
|
|
27966
|
-
|
|
27967
|
-
|
|
27968
|
-
|
|
27969
|
-
|
|
27970
|
-
top: twipsToPixels(resolveMargin(inlineMarginTopValue, marginTopStyle)),
|
|
27971
|
-
bottom: twipsToPixels(resolveMargin(inlineMarginBottomValue, marginBottomStyle))
|
|
27972
|
-
};
|
|
27973
|
-
return margins;
|
|
28154
|
+
return ["left", "right", "top", "bottom"].reduce((acc, direction) => {
|
|
28155
|
+
const key = `margin${direction.charAt(0).toUpperCase() + direction.slice(1)}`;
|
|
28156
|
+
const inlineValue = inlineMargins ? inlineMargins?.[key]?.value : null;
|
|
28157
|
+
const styleValue = cellMargins ? cellMargins[key] : null;
|
|
28158
|
+
if (inlineValue != null) {
|
|
28159
|
+
acc[direction] = twipsToPixels(inlineValue);
|
|
28160
|
+
} else if (styleValue == null) {
|
|
28161
|
+
acc[direction] = void 0;
|
|
28162
|
+
} else if (typeof styleValue === "object") {
|
|
28163
|
+
acc[direction] = twipsToPixels(styleValue.value);
|
|
28164
|
+
} else {
|
|
28165
|
+
acc[direction] = twipsToPixels(styleValue);
|
|
28166
|
+
}
|
|
28167
|
+
return acc;
|
|
28168
|
+
}, {});
|
|
27974
28169
|
};
|
|
27975
28170
|
function translateTableCell(params) {
|
|
27976
28171
|
const elements = translateChildNodes({
|
|
@@ -27985,102 +28180,86 @@ function translateTableCell(params) {
|
|
|
27985
28180
|
};
|
|
27986
28181
|
}
|
|
27987
28182
|
function generateTableCellProperties(node) {
|
|
27988
|
-
const
|
|
28183
|
+
const tableCellProperties = { ...node.attrs?.tableCellProperties || {} };
|
|
27989
28184
|
const { attrs } = node;
|
|
27990
|
-
const { colwidth = [], cellWidthType = "dxa",
|
|
28185
|
+
const { colwidth = [], cellWidthType = "dxa", widthUnit } = attrs;
|
|
27991
28186
|
const colwidthSum = colwidth.reduce((acc, curr) => acc + curr, 0);
|
|
27992
|
-
const
|
|
27993
|
-
|
|
27994
|
-
|
|
27995
|
-
|
|
27996
|
-
|
|
27997
|
-
}
|
|
27998
|
-
};
|
|
27999
|
-
elements.push(cellWidthElement);
|
|
28000
|
-
if (colspan) {
|
|
28001
|
-
const gridSpanElement = {
|
|
28002
|
-
name: "w:gridSpan",
|
|
28003
|
-
attributes: { "w:val": `${colspan}` }
|
|
28187
|
+
const propertiesWidthPixels = twipsToPixels(tableCellProperties.cellWidth?.value);
|
|
28188
|
+
if (propertiesWidthPixels !== colwidthSum) {
|
|
28189
|
+
tableCellProperties["cellWidth"] = {
|
|
28190
|
+
value: widthUnit === "px" ? pixelsToTwips(colwidthSum) : inchesToTwips(colwidthSum),
|
|
28191
|
+
type: cellWidthType
|
|
28004
28192
|
};
|
|
28005
|
-
elements.push(gridSpanElement);
|
|
28006
28193
|
}
|
|
28007
|
-
const {
|
|
28008
|
-
if (
|
|
28009
|
-
|
|
28010
|
-
|
|
28011
|
-
|
|
28012
|
-
|
|
28013
|
-
|
|
28194
|
+
const { colspan } = attrs;
|
|
28195
|
+
if (colspan > 1 && tableCellProperties.gridSpan !== colspan) {
|
|
28196
|
+
tableCellProperties["gridSpan"] = colspan;
|
|
28197
|
+
} else if (!colspan || tableCellProperties?.gridSpan === 1) {
|
|
28198
|
+
delete tableCellProperties.gridSpan;
|
|
28199
|
+
}
|
|
28200
|
+
const { background = {} } = attrs;
|
|
28201
|
+
if (background?.color && tableCellProperties.shading?.fill !== background?.color) {
|
|
28202
|
+
tableCellProperties["shading"] = { fill: background.color };
|
|
28203
|
+
} else if (!background?.color && tableCellProperties?.shading?.fill) {
|
|
28204
|
+
delete tableCellProperties.shading;
|
|
28014
28205
|
}
|
|
28015
28206
|
const { cellMargins } = attrs;
|
|
28016
28207
|
if (cellMargins) {
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
-
|
|
28020
|
-
|
|
28021
|
-
|
|
28208
|
+
["left", "right", "top", "bottom"].forEach((side) => {
|
|
28209
|
+
const key = `margin${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
28210
|
+
if (cellMargins[side] != null) {
|
|
28211
|
+
if (!tableCellProperties.cellMargins) tableCellProperties["cellMargins"] = {};
|
|
28212
|
+
let currentPropertyValuePixels = twipsToPixels(tableCellProperties.cellMargins?.[key]?.value);
|
|
28213
|
+
if (currentPropertyValuePixels !== cellMargins[side]) {
|
|
28214
|
+
tableCellProperties.cellMargins[key] = { value: pixelsToTwips(cellMargins[side]), type: "dxa" };
|
|
28215
|
+
}
|
|
28216
|
+
} else if (tableCellProperties?.cellMargins?.[key]) {
|
|
28217
|
+
delete tableCellProperties.cellMargins[key];
|
|
28218
|
+
}
|
|
28219
|
+
});
|
|
28022
28220
|
}
|
|
28023
28221
|
const { verticalAlign } = attrs;
|
|
28024
|
-
if (verticalAlign) {
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
|
|
28028
|
-
|
|
28029
|
-
|
|
28030
|
-
|
|
28031
|
-
|
|
28032
|
-
const vMergeElement = {
|
|
28033
|
-
name: "w:vMerge",
|
|
28034
|
-
type: "element",
|
|
28035
|
-
attributes: { "w:val": "restart" }
|
|
28036
|
-
};
|
|
28037
|
-
elements.push(vMergeElement);
|
|
28222
|
+
if (verticalAlign && verticalAlign !== tableCellProperties.vAlign) {
|
|
28223
|
+
tableCellProperties["vAlign"] = verticalAlign;
|
|
28224
|
+
} else if (!verticalAlign && tableCellProperties?.vAlign) {
|
|
28225
|
+
delete tableCellProperties.vAlign;
|
|
28226
|
+
}
|
|
28227
|
+
const { rowspan } = attrs;
|
|
28228
|
+
if (rowspan && rowspan > 1 && tableCellProperties.vMerge !== "restart") {
|
|
28229
|
+
tableCellProperties["vMerge"] = "restart";
|
|
28038
28230
|
} else if (attrs.continueMerge) {
|
|
28039
|
-
|
|
28040
|
-
|
|
28041
|
-
|
|
28042
|
-
};
|
|
28043
|
-
elements.push(vMergeElement);
|
|
28231
|
+
tableCellProperties["vMerge"] = "continue";
|
|
28232
|
+
} else if (tableCellProperties?.vMerge) {
|
|
28233
|
+
delete tableCellProperties.vMerge;
|
|
28044
28234
|
}
|
|
28045
28235
|
const { borders = {} } = attrs;
|
|
28046
28236
|
if (!!borders && Object.keys(borders).length) {
|
|
28047
|
-
|
|
28048
|
-
|
|
28049
|
-
|
|
28050
|
-
|
|
28051
|
-
|
|
28052
|
-
|
|
28053
|
-
|
|
28054
|
-
|
|
28055
|
-
|
|
28237
|
+
["top", "bottom", "left", "right"].forEach((side) => {
|
|
28238
|
+
if (borders[side]) {
|
|
28239
|
+
let currentPropertyValue = tableCellProperties.borders?.[side];
|
|
28240
|
+
let currentPropertySizePixels = eighthPointsToPixels(currentPropertyValue?.size);
|
|
28241
|
+
let color = borders[side].color;
|
|
28242
|
+
if (borders[side].color && color === "#000000") {
|
|
28243
|
+
color = "auto";
|
|
28244
|
+
}
|
|
28245
|
+
if (currentPropertySizePixels !== borders[side].size || currentPropertyValue?.color !== color || borders[side].val !== currentPropertyValue?.val) {
|
|
28246
|
+
if (!tableCellProperties.borders) tableCellProperties["borders"] = {};
|
|
28247
|
+
tableCellProperties.borders[side] = {
|
|
28248
|
+
size: pixelsToEightPoints(borders[side].size || 0),
|
|
28249
|
+
color,
|
|
28250
|
+
space: borders[side].space || 0,
|
|
28251
|
+
val: borders[side].val || "single"
|
|
28056
28252
|
};
|
|
28057
28253
|
}
|
|
28058
|
-
|
|
28059
|
-
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
"w:space": value.space || 0
|
|
28065
|
-
}
|
|
28066
|
-
};
|
|
28067
|
-
})
|
|
28068
|
-
};
|
|
28069
|
-
elements.push(cellBordersElement);
|
|
28254
|
+
} else if (tableCellProperties.borders?.[side]) {
|
|
28255
|
+
delete tableCellProperties.borders[side];
|
|
28256
|
+
}
|
|
28257
|
+
});
|
|
28258
|
+
} else if (tableCellProperties?.borders) {
|
|
28259
|
+
delete tableCellProperties.borders;
|
|
28070
28260
|
}
|
|
28071
|
-
|
|
28072
|
-
|
|
28073
|
-
elements
|
|
28074
|
-
};
|
|
28075
|
-
}
|
|
28076
|
-
function generateCellMargins(cellMargins) {
|
|
28077
|
-
const elements = [];
|
|
28078
|
-
const { top, right, bottom, left } = cellMargins;
|
|
28079
|
-
if (top != null) elements.push({ name: "w:top", attributes: { "w:w": pixelsToTwips(top) } });
|
|
28080
|
-
if (right != null) elements.push({ name: "w:right", attributes: { "w:w": pixelsToTwips(right) } });
|
|
28081
|
-
if (bottom != null) elements.push({ name: "w:bottom", attributes: { "w:w": pixelsToTwips(bottom) } });
|
|
28082
|
-
if (left != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left) } });
|
|
28083
|
-
return elements;
|
|
28261
|
+
const result = translator$d.decode({ node: { ...node, attrs: { ...node.attrs, tableCellProperties } } });
|
|
28262
|
+
return result;
|
|
28084
28263
|
}
|
|
28085
28264
|
const XML_NODE_NAME$d = "w:tc";
|
|
28086
28265
|
const SD_NODE_NAME$b = "tableCell";
|
|
@@ -28492,6 +28671,7 @@ function sdtNodeTypeStrategy(node) {
|
|
|
28492
28671
|
}
|
|
28493
28672
|
return { type: "unknown", handler: null };
|
|
28494
28673
|
}
|
|
28674
|
+
const DRAWING_XML_TAG = "w:drawing";
|
|
28495
28675
|
function handleImageNode(node, params, isAnchor) {
|
|
28496
28676
|
const { docx, filename } = params;
|
|
28497
28677
|
const { attributes } = node;
|
|
@@ -28503,32 +28683,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28503
28683
|
};
|
|
28504
28684
|
const extent = node.elements.find((el) => el.name === "wp:extent");
|
|
28505
28685
|
const size = {
|
|
28506
|
-
width: emuToPixels(extent
|
|
28507
|
-
height: emuToPixels(extent
|
|
28686
|
+
width: emuToPixels(extent?.attributes?.cx),
|
|
28687
|
+
height: emuToPixels(extent?.attributes?.cy)
|
|
28508
28688
|
};
|
|
28509
|
-
const graphic = node.elements.find((el) => el.name === "a:graphic");
|
|
28510
|
-
const graphicData = graphic.elements.find((el) => el.name === "a:graphicData");
|
|
28511
|
-
const { uri: uri2 } = graphicData?.attributes || {};
|
|
28512
|
-
const shapeURI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
|
28513
|
-
if (!!uri2 && uri2 === shapeURI) {
|
|
28514
|
-
return handleShapeDrawing(params, node, graphicData);
|
|
28515
|
-
}
|
|
28516
|
-
const picture = graphicData.elements.find((el) => el.name === "pic:pic");
|
|
28517
|
-
if (!picture || !picture.elements) return null;
|
|
28518
|
-
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
28519
|
-
const blip = blipFill.elements.find((el) => el.name === "a:blip");
|
|
28520
|
-
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
28521
28689
|
let transformData = {};
|
|
28522
|
-
if (spPr) {
|
|
28523
|
-
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
28524
|
-
if (xfrm?.attributes) {
|
|
28525
|
-
transformData = {
|
|
28526
|
-
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
28527
|
-
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
28528
|
-
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
28529
|
-
};
|
|
28530
|
-
}
|
|
28531
|
-
}
|
|
28532
28690
|
const effectExtent = node.elements.find((el) => el.name === "wp:effectExtent");
|
|
28533
28691
|
if (effectExtent) {
|
|
28534
28692
|
const sanitizeEmuValue = (value) => {
|
|
@@ -28537,22 +28695,26 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28537
28695
|
return Number.isFinite(numeric) ? numeric : 0;
|
|
28538
28696
|
};
|
|
28539
28697
|
transformData.sizeExtension = {
|
|
28540
|
-
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes["l"])),
|
|
28541
|
-
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes["t"])),
|
|
28542
|
-
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes["r"])),
|
|
28543
|
-
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes["b"]))
|
|
28698
|
+
left: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["l"])),
|
|
28699
|
+
top: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["t"])),
|
|
28700
|
+
right: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["r"])),
|
|
28701
|
+
bottom: emuToPixels(sanitizeEmuValue(effectExtent.attributes?.["b"]))
|
|
28544
28702
|
};
|
|
28545
28703
|
}
|
|
28546
28704
|
const positionHTag = node.elements.find((el) => el.name === "wp:positionH");
|
|
28547
28705
|
const positionH = positionHTag?.elements.find((el) => el.name === "wp:posOffset");
|
|
28548
28706
|
const positionHValue = emuToPixels(positionH?.elements[0]?.text);
|
|
28549
|
-
const hRelativeFrom = positionHTag?.attributes
|
|
28550
|
-
const alignH = positionHTag?.elements.find((el) => el.name === "wp:align")?.elements[0]?.text;
|
|
28707
|
+
const hRelativeFrom = positionHTag?.attributes?.relativeFrom;
|
|
28708
|
+
const alignH = positionHTag?.elements.find((el) => el.name === "wp:align")?.elements?.[0]?.text;
|
|
28551
28709
|
const positionVTag = node.elements.find((el) => el.name === "wp:positionV");
|
|
28552
28710
|
const positionV = positionVTag?.elements?.find((el) => el.name === "wp:posOffset");
|
|
28553
28711
|
const positionVValue = emuToPixels(positionV?.elements[0]?.text);
|
|
28554
|
-
const vRelativeFrom = positionVTag?.attributes
|
|
28555
|
-
const alignV = positionVTag?.elements?.find((el) => el.name === "wp:align")?.elements[0]?.text;
|
|
28712
|
+
const vRelativeFrom = positionVTag?.attributes?.relativeFrom;
|
|
28713
|
+
const alignV = positionVTag?.elements?.find((el) => el.name === "wp:align")?.elements?.[0]?.text;
|
|
28714
|
+
const marginOffset = {
|
|
28715
|
+
horizontal: positionHValue,
|
|
28716
|
+
top: positionVValue
|
|
28717
|
+
};
|
|
28556
28718
|
const simplePos = node.elements.find((el) => el.name === "wp:simplePos");
|
|
28557
28719
|
const wrapNode = isAnchor ? node.elements.find(
|
|
28558
28720
|
(el) => ["wp:wrapNone", "wp:wrapSquare", "wp:wrapThrough", "wp:wrapTight", "wp:wrapTopAndBottom"].includes(el.name)
|
|
@@ -28560,38 +28722,40 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28560
28722
|
const wrap2 = isAnchor ? { type: wrapNode?.name.slice(7) || "None", attrs: {} } : { type: "Inline" };
|
|
28561
28723
|
switch (wrap2.type) {
|
|
28562
28724
|
case "Square":
|
|
28563
|
-
|
|
28564
|
-
|
|
28725
|
+
if (wrapNode?.attributes?.wrapText) {
|
|
28726
|
+
wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
|
|
28727
|
+
}
|
|
28728
|
+
if ("distB" in (wrapNode?.attributes || {})) {
|
|
28565
28729
|
wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
|
|
28566
28730
|
}
|
|
28567
|
-
if ("distL" in (wrapNode
|
|
28731
|
+
if ("distL" in (wrapNode?.attributes || {})) {
|
|
28568
28732
|
wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
|
|
28569
28733
|
}
|
|
28570
|
-
if ("distR" in (wrapNode
|
|
28734
|
+
if ("distR" in (wrapNode?.attributes || {})) {
|
|
28571
28735
|
wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
|
|
28572
28736
|
}
|
|
28573
|
-
if ("distT" in (wrapNode
|
|
28737
|
+
if ("distT" in (wrapNode?.attributes || {})) {
|
|
28574
28738
|
wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
|
|
28575
28739
|
}
|
|
28576
28740
|
break;
|
|
28577
28741
|
case "Tight":
|
|
28578
28742
|
case "Through": {
|
|
28579
|
-
if ("distL" in (wrapNode
|
|
28743
|
+
if ("distL" in (wrapNode?.attributes || {})) {
|
|
28580
28744
|
wrap2.attrs.distLeft = emuToPixels(wrapNode.attributes.distL);
|
|
28581
28745
|
}
|
|
28582
|
-
if ("distR" in (wrapNode
|
|
28746
|
+
if ("distR" in (wrapNode?.attributes || {})) {
|
|
28583
28747
|
wrap2.attrs.distRight = emuToPixels(wrapNode.attributes.distR);
|
|
28584
28748
|
}
|
|
28585
|
-
if ("distT" in (wrapNode
|
|
28749
|
+
if ("distT" in (wrapNode?.attributes || {})) {
|
|
28586
28750
|
wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
|
|
28587
28751
|
}
|
|
28588
|
-
if ("distB" in (wrapNode
|
|
28752
|
+
if ("distB" in (wrapNode?.attributes || {})) {
|
|
28589
28753
|
wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
|
|
28590
28754
|
}
|
|
28591
|
-
if ("wrapText" in (wrapNode
|
|
28755
|
+
if ("wrapText" in (wrapNode?.attributes || {})) {
|
|
28592
28756
|
wrap2.attrs.wrapText = wrapNode.attributes.wrapText;
|
|
28593
28757
|
}
|
|
28594
|
-
const polygon = wrapNode
|
|
28758
|
+
const polygon = wrapNode?.elements?.find((el) => el.name === "wp:wrapPolygon");
|
|
28595
28759
|
if (polygon) {
|
|
28596
28760
|
wrap2.attrs.polygon = polygonToObj(polygon);
|
|
28597
28761
|
if (polygon.attributes?.edited !== void 0) {
|
|
@@ -28601,10 +28765,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28601
28765
|
break;
|
|
28602
28766
|
}
|
|
28603
28767
|
case "TopAndBottom":
|
|
28604
|
-
if ("distB" in (wrapNode
|
|
28768
|
+
if ("distB" in (wrapNode?.attributes || {})) {
|
|
28605
28769
|
wrap2.attrs.distBottom = emuToPixels(wrapNode.attributes.distB);
|
|
28606
28770
|
}
|
|
28607
|
-
if ("distT" in (wrapNode
|
|
28771
|
+
if ("distT" in (wrapNode?.attributes || {})) {
|
|
28608
28772
|
wrap2.attrs.distTop = emuToPixels(wrapNode.attributes.distT);
|
|
28609
28773
|
}
|
|
28610
28774
|
break;
|
|
@@ -28622,17 +28786,42 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28622
28786
|
alignV
|
|
28623
28787
|
};
|
|
28624
28788
|
}
|
|
28625
|
-
const
|
|
28626
|
-
|
|
28627
|
-
|
|
28628
|
-
|
|
28789
|
+
const graphic = node.elements.find((el) => el.name === "a:graphic");
|
|
28790
|
+
const graphicData = graphic?.elements.find((el) => el.name === "a:graphicData");
|
|
28791
|
+
const { uri: uri2 } = graphicData?.attributes || {};
|
|
28792
|
+
const shapeURI = "http://schemas.microsoft.com/office/word/2010/wordprocessingShape";
|
|
28793
|
+
if (!!uri2 && uri2 === shapeURI) {
|
|
28794
|
+
const shapeMarginOffset = {
|
|
28795
|
+
left: positionHValue,
|
|
28796
|
+
horizontal: positionHValue,
|
|
28797
|
+
top: positionVValue
|
|
28798
|
+
};
|
|
28799
|
+
return handleShapeDrawing(params, node, graphicData, size, padding, shapeMarginOffset);
|
|
28800
|
+
}
|
|
28801
|
+
const picture = graphicData?.elements.find((el) => el.name === "pic:pic");
|
|
28802
|
+
if (!picture || !picture.elements) return null;
|
|
28803
|
+
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
28804
|
+
const blip = blipFill?.elements.find((el) => el.name === "a:blip");
|
|
28805
|
+
if (!blip) return null;
|
|
28806
|
+
const spPr = picture.elements.find((el) => el.name === "pic:spPr");
|
|
28807
|
+
if (spPr) {
|
|
28808
|
+
const xfrm = spPr.elements.find((el) => el.name === "a:xfrm");
|
|
28809
|
+
if (xfrm?.attributes) {
|
|
28810
|
+
transformData = {
|
|
28811
|
+
...transformData,
|
|
28812
|
+
rotation: rotToDegrees(xfrm.attributes["rot"]),
|
|
28813
|
+
verticalFlip: xfrm.attributes["flipV"] === "1",
|
|
28814
|
+
horizontalFlip: xfrm.attributes["flipH"] === "1"
|
|
28815
|
+
};
|
|
28816
|
+
}
|
|
28817
|
+
}
|
|
28629
28818
|
const { attributes: blipAttributes = {} } = blip;
|
|
28630
28819
|
const rEmbed = blipAttributes["r:embed"];
|
|
28631
28820
|
if (!rEmbed) return null;
|
|
28632
28821
|
const currentFile = filename || "document.xml";
|
|
28633
28822
|
let rels = docx[`word/_rels/${currentFile}.rels`];
|
|
28634
28823
|
if (!rels) rels = docx[`word/_rels/document.xml.rels`];
|
|
28635
|
-
const relationships = rels
|
|
28824
|
+
const relationships = rels?.elements.find((el) => el.name === "Relationships");
|
|
28636
28825
|
const { elements } = relationships || [];
|
|
28637
28826
|
const rel = elements?.find((el) => el.attributes["Id"] === rEmbed);
|
|
28638
28827
|
if (!rel) return null;
|
|
@@ -28645,10 +28834,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28645
28834
|
type: "image",
|
|
28646
28835
|
attrs: {
|
|
28647
28836
|
src: path,
|
|
28648
|
-
alt: ["emf", "wmf"].includes(extension) ? "Unable to render EMF/WMF image" : docPr?.attributes
|
|
28837
|
+
alt: ["emf", "wmf"].includes(extension) ? "Unable to render EMF/WMF image" : docPr?.attributes?.name || "Image",
|
|
28649
28838
|
extension,
|
|
28650
|
-
id: docPr?.attributes
|
|
28651
|
-
title: docPr?.attributes
|
|
28839
|
+
id: docPr?.attributes?.id || "",
|
|
28840
|
+
title: docPr?.attributes?.descr || "Image",
|
|
28652
28841
|
inline: true,
|
|
28653
28842
|
padding,
|
|
28654
28843
|
marginOffset,
|
|
@@ -28663,6 +28852,10 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28663
28852
|
}
|
|
28664
28853
|
},
|
|
28665
28854
|
wrap: wrap2,
|
|
28855
|
+
...wrap2.type === "Square" && wrap2.attrs.wrapText ? {
|
|
28856
|
+
wrapText: wrap2.attrs.wrapText
|
|
28857
|
+
} : {},
|
|
28858
|
+
wrapTopAndBottom: wrap2.type === "TopAndBottom",
|
|
28666
28859
|
originalPadding: {
|
|
28667
28860
|
distT: attributes["distT"],
|
|
28668
28861
|
distB: attributes["distB"],
|
|
@@ -28674,7 +28867,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
28674
28867
|
}
|
|
28675
28868
|
};
|
|
28676
28869
|
}
|
|
28677
|
-
const handleShapeDrawing = (params, node, graphicData) => {
|
|
28870
|
+
const handleShapeDrawing = (params, node, graphicData, size, padding, marginOffset) => {
|
|
28678
28871
|
const wsp = graphicData.elements.find((el) => el.name === "wps:wsp");
|
|
28679
28872
|
const textBox = wsp.elements.find((el) => el.name === "wps:txbx");
|
|
28680
28873
|
const textBoxContent = textBox?.elements?.find((el) => el.name === "w:txbxContent");
|
|
@@ -28685,21 +28878,14 @@ const handleShapeDrawing = (params, node, graphicData) => {
|
|
|
28685
28878
|
return getRectangleShape(params, spPr);
|
|
28686
28879
|
}
|
|
28687
28880
|
if (!textBoxContent) {
|
|
28688
|
-
return
|
|
28881
|
+
return buildShapePlaceholder(node, size, padding, marginOffset, "drawing");
|
|
28689
28882
|
}
|
|
28690
|
-
|
|
28691
|
-
const translatedElement = nodeListHandler.handler({
|
|
28692
|
-
...params,
|
|
28693
|
-
node: textBoxContent.elements[0],
|
|
28694
|
-
nodes: textBoxContent.elements,
|
|
28695
|
-
path: [...params.path || [], textBoxContent]
|
|
28696
|
-
});
|
|
28697
|
-
return translatedElement[0];
|
|
28883
|
+
return buildShapePlaceholder(node, size, padding, marginOffset, "textbox");
|
|
28698
28884
|
};
|
|
28699
28885
|
const getRectangleShape = (params, node) => {
|
|
28700
28886
|
const schemaAttrs = {};
|
|
28701
28887
|
const [drawingNode] = params.nodes;
|
|
28702
|
-
if (drawingNode?.name ===
|
|
28888
|
+
if (drawingNode?.name === DRAWING_XML_TAG) {
|
|
28703
28889
|
schemaAttrs.drawingContent = drawingNode;
|
|
28704
28890
|
}
|
|
28705
28891
|
const xfrm = node.elements.find((el) => el.name === "a:xfrm");
|
|
@@ -28723,6 +28909,52 @@ const getRectangleShape = (params, node) => {
|
|
|
28723
28909
|
attrs: schemaAttrs
|
|
28724
28910
|
};
|
|
28725
28911
|
};
|
|
28912
|
+
const buildShapePlaceholder = (node, size, padding, marginOffset, shapeType) => {
|
|
28913
|
+
const attrs = {
|
|
28914
|
+
drawingContent: {
|
|
28915
|
+
name: DRAWING_XML_TAG,
|
|
28916
|
+
elements: [carbonCopy(node)]
|
|
28917
|
+
},
|
|
28918
|
+
attributes: {
|
|
28919
|
+
"data-shape-type": shapeType
|
|
28920
|
+
}
|
|
28921
|
+
};
|
|
28922
|
+
if (size && (Number.isFinite(size.width) || Number.isFinite(size.height))) {
|
|
28923
|
+
attrs.size = {
|
|
28924
|
+
...Number.isFinite(size.width) ? { width: size.width } : {},
|
|
28925
|
+
...Number.isFinite(size.height) ? { height: size.height } : {}
|
|
28926
|
+
};
|
|
28927
|
+
}
|
|
28928
|
+
if (padding) {
|
|
28929
|
+
const paddingData = {};
|
|
28930
|
+
if (Number.isFinite(padding.top)) paddingData["data-padding-top"] = padding.top;
|
|
28931
|
+
if (Number.isFinite(padding.right)) paddingData["data-padding-right"] = padding.right;
|
|
28932
|
+
if (Number.isFinite(padding.bottom)) paddingData["data-padding-bottom"] = padding.bottom;
|
|
28933
|
+
if (Number.isFinite(padding.left)) paddingData["data-padding-left"] = padding.left;
|
|
28934
|
+
if (Object.keys(paddingData).length) {
|
|
28935
|
+
attrs.attributes = {
|
|
28936
|
+
...attrs.attributes,
|
|
28937
|
+
...paddingData
|
|
28938
|
+
};
|
|
28939
|
+
}
|
|
28940
|
+
}
|
|
28941
|
+
if (marginOffset) {
|
|
28942
|
+
const offsetData = {};
|
|
28943
|
+
const horizontal = Number.isFinite(marginOffset.horizontal) ? marginOffset.horizontal : Number.isFinite(marginOffset.left) ? marginOffset.left : void 0;
|
|
28944
|
+
if (Number.isFinite(horizontal)) offsetData["data-offset-x"] = horizontal;
|
|
28945
|
+
if (Number.isFinite(marginOffset.top)) offsetData["data-offset-y"] = marginOffset.top;
|
|
28946
|
+
if (Object.keys(offsetData).length) {
|
|
28947
|
+
attrs.attributes = {
|
|
28948
|
+
...attrs.attributes,
|
|
28949
|
+
...offsetData
|
|
28950
|
+
};
|
|
28951
|
+
}
|
|
28952
|
+
}
|
|
28953
|
+
return {
|
|
28954
|
+
type: "contentBlock",
|
|
28955
|
+
attrs
|
|
28956
|
+
};
|
|
28957
|
+
};
|
|
28726
28958
|
function handleAnchorNode(params) {
|
|
28727
28959
|
const { node } = params.extraParams;
|
|
28728
28960
|
if (node.name !== "wp:anchor") {
|
|
@@ -31692,8 +31924,8 @@ const trackChangeNodeHandlerEntity = {
|
|
|
31692
31924
|
handlerName: "trackChangeNodeHandler",
|
|
31693
31925
|
handler: handleTrackChangeNode
|
|
31694
31926
|
};
|
|
31695
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
31696
|
-
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$
|
|
31927
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$1c);
|
|
31928
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$1b);
|
|
31697
31929
|
function parseProperties(node) {
|
|
31698
31930
|
const marks = [];
|
|
31699
31931
|
const unknownMarks = [];
|
|
@@ -31785,7 +32017,7 @@ const handleParagraphNode = (params) => {
|
|
|
31785
32017
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
31786
32018
|
return { nodes: [], consumed: 0 };
|
|
31787
32019
|
}
|
|
31788
|
-
const schemaNode = translator$
|
|
32020
|
+
const schemaNode = translator$1o.encode(params);
|
|
31789
32021
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
31790
32022
|
return { nodes: newNodes, consumed: 1 };
|
|
31791
32023
|
};
|
|
@@ -31888,7 +32120,7 @@ const handler = (params) => {
|
|
|
31888
32120
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
31889
32121
|
return { nodes: [], consumed: 0 };
|
|
31890
32122
|
}
|
|
31891
|
-
const result = translator$
|
|
32123
|
+
const result = translator$1r.encode(params);
|
|
31892
32124
|
if (!result) return { nodes: [], consumed: 0 };
|
|
31893
32125
|
return {
|
|
31894
32126
|
nodes: [result],
|
|
@@ -32514,7 +32746,7 @@ const handleTabNode = (params) => {
|
|
|
32514
32746
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
32515
32747
|
return { nodes: [], consumed: 0 };
|
|
32516
32748
|
}
|
|
32517
|
-
const node = translator$
|
|
32749
|
+
const node = translator$1p.encode(params);
|
|
32518
32750
|
return { nodes: [node], consumed: 1 };
|
|
32519
32751
|
};
|
|
32520
32752
|
const tabNodeEntityHandler = {
|
|
@@ -32766,12 +32998,14 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
32766
32998
|
const content = pruneIgnoredNodes(contentElements);
|
|
32767
32999
|
const comments = importCommentData({ docx, converter, editor });
|
|
32768
33000
|
const lists = {};
|
|
33001
|
+
const inlineDocumentFonts = [];
|
|
32769
33002
|
let parsedContent = nodeListHandler.handler({
|
|
32770
33003
|
nodes: content,
|
|
32771
33004
|
nodeListHandler,
|
|
32772
33005
|
docx,
|
|
32773
33006
|
converter,
|
|
32774
33007
|
editor,
|
|
33008
|
+
inlineDocumentFonts,
|
|
32775
33009
|
lists,
|
|
32776
33010
|
path: []
|
|
32777
33011
|
});
|
|
@@ -32794,6 +33028,7 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
32794
33028
|
savedTagsToRestore: node,
|
|
32795
33029
|
pageStyles: getDocumentStyles(node, docx, converter, editor),
|
|
32796
33030
|
comments,
|
|
33031
|
+
inlineDocumentFonts,
|
|
32797
33032
|
linkedStyles: getStyleDefinitions(docx),
|
|
32798
33033
|
numbering: getNumberingDefinitions(docx)
|
|
32799
33034
|
};
|
|
@@ -32857,6 +33092,7 @@ const createNodeListHandler = (nodeHandlers) => {
|
|
|
32857
33092
|
filename,
|
|
32858
33093
|
parentStyleId,
|
|
32859
33094
|
lists,
|
|
33095
|
+
inlineDocumentFonts,
|
|
32860
33096
|
path = []
|
|
32861
33097
|
}) => {
|
|
32862
33098
|
if (!elements || !elements.length) return [];
|
|
@@ -32883,6 +33119,7 @@ const createNodeListHandler = (nodeHandlers) => {
|
|
|
32883
33119
|
filename,
|
|
32884
33120
|
parentStyleId,
|
|
32885
33121
|
lists,
|
|
33122
|
+
inlineDocumentFonts,
|
|
32886
33123
|
path
|
|
32887
33124
|
});
|
|
32888
33125
|
},
|
|
@@ -33570,21 +33807,21 @@ function exportSchemaToJson(params) {
|
|
|
33570
33807
|
doc: translateDocumentNode,
|
|
33571
33808
|
body: translateBodyNode,
|
|
33572
33809
|
heading: translateHeadingNode,
|
|
33573
|
-
paragraph: translator$
|
|
33574
|
-
run: translator$
|
|
33810
|
+
paragraph: translator$1o,
|
|
33811
|
+
run: translator$1b,
|
|
33575
33812
|
text: translateTextNode,
|
|
33576
33813
|
bulletList: translateList,
|
|
33577
33814
|
orderedList: translateList,
|
|
33578
|
-
lineBreak: translator$
|
|
33579
|
-
table: translator$
|
|
33580
|
-
tableRow: translator$
|
|
33815
|
+
lineBreak: translator$1r,
|
|
33816
|
+
table: translator$s,
|
|
33817
|
+
tableRow: translator$Z,
|
|
33581
33818
|
tableCell: translator$c,
|
|
33582
33819
|
bookmarkStart: translator$7,
|
|
33583
33820
|
bookmarkEnd: translator$6,
|
|
33584
33821
|
fieldAnnotation: translator$8,
|
|
33585
|
-
tab: translator$
|
|
33822
|
+
tab: translator$1p,
|
|
33586
33823
|
image: translator$9,
|
|
33587
|
-
hardBreak: translator$
|
|
33824
|
+
hardBreak: translator$1r,
|
|
33588
33825
|
commentRangeStart: commentRangeStartTranslator,
|
|
33589
33826
|
commentRangeEnd: commentRangeEndTranslator,
|
|
33590
33827
|
commentReference: () => null,
|
|
@@ -33945,7 +34182,7 @@ function translateTextNode(params) {
|
|
|
33945
34182
|
}
|
|
33946
34183
|
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
33947
34184
|
if (isLinkNode && !extraParams?.linkProcessed) {
|
|
33948
|
-
return translator$
|
|
34185
|
+
return translator$1c.decode(params);
|
|
33949
34186
|
}
|
|
33950
34187
|
const { text, marks = [] } = node;
|
|
33951
34188
|
return getTextNodeForExport(text, marks, params);
|
|
@@ -34205,7 +34442,7 @@ function translateMark(mark) {
|
|
|
34205
34442
|
markElement.type = "element";
|
|
34206
34443
|
break;
|
|
34207
34444
|
case "underline": {
|
|
34208
|
-
const translated = translator$
|
|
34445
|
+
const translated = translator$1l.decode({
|
|
34209
34446
|
node: {
|
|
34210
34447
|
attrs: {
|
|
34211
34448
|
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
@@ -34269,7 +34506,7 @@ function translateMark(mark) {
|
|
|
34269
34506
|
break;
|
|
34270
34507
|
case "highlight": {
|
|
34271
34508
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
34272
|
-
const translated = translator$
|
|
34509
|
+
const translated = translator$1q.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
34273
34510
|
return translated || {};
|
|
34274
34511
|
}
|
|
34275
34512
|
case "link":
|
|
@@ -34648,6 +34885,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
34648
34885
|
this.fonts = params?.fonts || {};
|
|
34649
34886
|
this.addedMedia = {};
|
|
34650
34887
|
this.comments = [];
|
|
34888
|
+
this.inlineDocumentFonts = [];
|
|
34651
34889
|
this.docHiglightColors = /* @__PURE__ */ new Set([]);
|
|
34652
34890
|
this.xml = params?.xml;
|
|
34653
34891
|
this.declaration = null;
|
|
@@ -34934,6 +35172,23 @@ const _SuperConverter = class _SuperConverter {
|
|
|
34934
35172
|
return result;
|
|
34935
35173
|
}
|
|
34936
35174
|
getDocumentFonts() {
|
|
35175
|
+
const inlineDocumentFonts = [...new Set(this.inlineDocumentFonts || [])];
|
|
35176
|
+
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
35177
|
+
if (!fontTable) {
|
|
35178
|
+
return inlineDocumentFonts;
|
|
35179
|
+
}
|
|
35180
|
+
const wFonts = fontTable.elements?.find((element) => element.name === "w:fonts");
|
|
35181
|
+
if (!wFonts) {
|
|
35182
|
+
return inlineDocumentFonts;
|
|
35183
|
+
}
|
|
35184
|
+
if (!wFonts.elements) {
|
|
35185
|
+
return inlineDocumentFonts;
|
|
35186
|
+
}
|
|
35187
|
+
const fontsInFontTable = wFonts.elements.filter((element) => element.name === "w:font").map((element) => element.attributes["w:name"]);
|
|
35188
|
+
const allFonts = [...inlineDocumentFonts, ...fontsInFontTable];
|
|
35189
|
+
return [...new Set(allFonts)];
|
|
35190
|
+
}
|
|
35191
|
+
getFontFaceImportString() {
|
|
34937
35192
|
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
34938
35193
|
if (!fontTable || !Object.keys(this.fonts).length) return;
|
|
34939
35194
|
const fonts = fontTable.elements.find((el) => el.name === "w:fonts");
|
|
@@ -34947,6 +35202,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
34947
35202
|
const rels = this.convertedXml["word/_rels/fontTable.xml.rels"];
|
|
34948
35203
|
const relationships = rels?.elements.find((el) => el.name === "Relationships") || {};
|
|
34949
35204
|
const { elements } = relationships;
|
|
35205
|
+
const fontsImported = [];
|
|
34950
35206
|
let styleString = "";
|
|
34951
35207
|
for (const font of fontsToInclude) {
|
|
34952
35208
|
const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
|
|
@@ -34963,6 +35219,9 @@ const _SuperConverter = class _SuperConverter {
|
|
|
34963
35219
|
const isItalic = font.name.includes("Italic");
|
|
34964
35220
|
const isLight = font.name.includes("Light");
|
|
34965
35221
|
const fontWeight = isNormal ? "normal" : isBold ? "bold" : isLight ? "200" : "normal";
|
|
35222
|
+
if (!fontsImported.includes(font.fontFamily)) {
|
|
35223
|
+
fontsImported.push(font.fontFamily);
|
|
35224
|
+
}
|
|
34966
35225
|
styleString += `
|
|
34967
35226
|
@font-face {
|
|
34968
35227
|
font-style: ${isItalic ? "italic" : "normal"};
|
|
@@ -34973,7 +35232,10 @@ const _SuperConverter = class _SuperConverter {
|
|
|
34973
35232
|
}
|
|
34974
35233
|
`;
|
|
34975
35234
|
}
|
|
34976
|
-
return
|
|
35235
|
+
return {
|
|
35236
|
+
styleString,
|
|
35237
|
+
fontsImported
|
|
35238
|
+
};
|
|
34977
35239
|
}
|
|
34978
35240
|
getDocumentInternalId() {
|
|
34979
35241
|
const settingsLocation = "word/settings.xml";
|
|
@@ -35028,6 +35290,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
35028
35290
|
this.numbering = result.numbering;
|
|
35029
35291
|
this.comments = result.comments;
|
|
35030
35292
|
this.linkedStyles = result.linkedStyles;
|
|
35293
|
+
this.inlineDocumentFonts = result.inlineDocumentFonts;
|
|
35031
35294
|
return result.pmDoc;
|
|
35032
35295
|
} else {
|
|
35033
35296
|
return null;
|
|
@@ -35403,7 +35666,7 @@ export {
|
|
|
35403
35666
|
objectIncludes as Z,
|
|
35404
35667
|
AddMarkStep as _,
|
|
35405
35668
|
Plugin as a,
|
|
35406
|
-
translator$
|
|
35669
|
+
translator$b as a$,
|
|
35407
35670
|
twipsToLines as a0,
|
|
35408
35671
|
pixelsToTwips as a1,
|
|
35409
35672
|
helpers as a2,
|
|
@@ -35414,33 +35677,33 @@ export {
|
|
|
35414
35677
|
createDocFromMarkdown as a7,
|
|
35415
35678
|
createDocFromHTML as a8,
|
|
35416
35679
|
EditorState as a9,
|
|
35417
|
-
|
|
35418
|
-
|
|
35419
|
-
|
|
35420
|
-
|
|
35421
|
-
|
|
35422
|
-
|
|
35423
|
-
|
|
35424
|
-
|
|
35425
|
-
|
|
35426
|
-
translator$
|
|
35427
|
-
translator$
|
|
35428
|
-
translator$
|
|
35429
|
-
translator$
|
|
35430
|
-
translator$
|
|
35431
|
-
translator$
|
|
35432
|
-
translator$
|
|
35433
|
-
translator$
|
|
35434
|
-
translator$
|
|
35435
|
-
translator$
|
|
35436
|
-
translator$
|
|
35437
|
-
translator$
|
|
35438
|
-
translator$
|
|
35439
|
-
translator$
|
|
35440
|
-
translator$
|
|
35441
|
-
|
|
35442
|
-
|
|
35443
|
-
translator$
|
|
35680
|
+
getDefaultExportFromCjs$2 as aA,
|
|
35681
|
+
getContentTypesFromXml as aB,
|
|
35682
|
+
xmljs as aC,
|
|
35683
|
+
vClickOutside as aD,
|
|
35684
|
+
getActiveFormatting as aE,
|
|
35685
|
+
readFromClipboard as aF,
|
|
35686
|
+
handleClipboardPaste as aG,
|
|
35687
|
+
getFileObject as aH,
|
|
35688
|
+
runPropertyTranslators as aI,
|
|
35689
|
+
translator$d as aJ,
|
|
35690
|
+
translator$k as aK,
|
|
35691
|
+
translator$m as aL,
|
|
35692
|
+
translator$e as aM,
|
|
35693
|
+
translator$f as aN,
|
|
35694
|
+
translator$n as aO,
|
|
35695
|
+
translator$o as aP,
|
|
35696
|
+
translator$j as aQ,
|
|
35697
|
+
translator$g as aR,
|
|
35698
|
+
translator$r as aS,
|
|
35699
|
+
translator$i as aT,
|
|
35700
|
+
translator$l as aU,
|
|
35701
|
+
translator$h as aV,
|
|
35702
|
+
translator$q as aW,
|
|
35703
|
+
translator$p as aX,
|
|
35704
|
+
commentRangeEndTranslator as aY,
|
|
35705
|
+
commentRangeStartTranslator as aZ,
|
|
35706
|
+
translator$a as a_,
|
|
35444
35707
|
hasSomeParentWithClass as aa,
|
|
35445
35708
|
isActive as ab,
|
|
35446
35709
|
unflattenListsInHtml as ac,
|
|
@@ -35458,66 +35721,83 @@ export {
|
|
|
35458
35721
|
docxNumberigHelpers as ao,
|
|
35459
35722
|
parseIndentElement as ap,
|
|
35460
35723
|
combineIndents as aq,
|
|
35461
|
-
|
|
35462
|
-
|
|
35463
|
-
|
|
35464
|
-
|
|
35465
|
-
|
|
35466
|
-
|
|
35467
|
-
|
|
35468
|
-
|
|
35469
|
-
|
|
35724
|
+
twipsToPixels as ar,
|
|
35725
|
+
PIXELS_PER_INCH as as,
|
|
35726
|
+
SelectionRange as at,
|
|
35727
|
+
Transform as au,
|
|
35728
|
+
isInTable as av,
|
|
35729
|
+
generateDocxRandomId as aw,
|
|
35730
|
+
insertNewRelationship as ax,
|
|
35731
|
+
inchesToPixels as ay,
|
|
35732
|
+
commonjsGlobal as az,
|
|
35470
35733
|
Slice as b,
|
|
35471
|
-
translator$
|
|
35472
|
-
translator
|
|
35473
|
-
translator$
|
|
35474
|
-
translator$
|
|
35475
|
-
translator$
|
|
35476
|
-
translator$
|
|
35477
|
-
translator$
|
|
35478
|
-
translator$
|
|
35479
|
-
translator$
|
|
35480
|
-
translator$
|
|
35481
|
-
translator$
|
|
35482
|
-
translator$
|
|
35483
|
-
translator$
|
|
35484
|
-
translator$
|
|
35485
|
-
translator$
|
|
35486
|
-
translator$
|
|
35487
|
-
translator$
|
|
35488
|
-
translator$
|
|
35489
|
-
translator$
|
|
35490
|
-
translator$
|
|
35491
|
-
translator$
|
|
35492
|
-
translator$
|
|
35493
|
-
|
|
35494
|
-
translator$
|
|
35495
|
-
translator$
|
|
35496
|
-
translator$
|
|
35497
|
-
translator$
|
|
35498
|
-
translator$
|
|
35499
|
-
translator$
|
|
35500
|
-
translator$
|
|
35501
|
-
translator$
|
|
35502
|
-
translator$
|
|
35503
|
-
translator$
|
|
35504
|
-
translator$
|
|
35505
|
-
translator$
|
|
35506
|
-
translator$
|
|
35507
|
-
translator$
|
|
35508
|
-
translator$
|
|
35734
|
+
translator$5 as b$,
|
|
35735
|
+
translator$$ as b0,
|
|
35736
|
+
translator$10 as b1,
|
|
35737
|
+
translator$1l as b2,
|
|
35738
|
+
translator$_ as b3,
|
|
35739
|
+
translator$11 as b4,
|
|
35740
|
+
translator$Z as b5,
|
|
35741
|
+
translator$z as b6,
|
|
35742
|
+
translator$c as b7,
|
|
35743
|
+
translator$M as b8,
|
|
35744
|
+
translator$N as b9,
|
|
35745
|
+
translator$1i as bA,
|
|
35746
|
+
translator$1b as bB,
|
|
35747
|
+
translator$1o as bC,
|
|
35748
|
+
translator$F as bD,
|
|
35749
|
+
translator$14 as bE,
|
|
35750
|
+
translator$G as bF,
|
|
35751
|
+
translator$H as bG,
|
|
35752
|
+
translator$1m as bH,
|
|
35753
|
+
translator$1c as bI,
|
|
35754
|
+
translator$1q as bJ,
|
|
35755
|
+
translator$15 as bK,
|
|
35756
|
+
translator$u as bL,
|
|
35757
|
+
translator$16 as bM,
|
|
35758
|
+
translator$17 as bN,
|
|
35759
|
+
translator$J as bO,
|
|
35760
|
+
translator$9 as bP,
|
|
35761
|
+
translator$18 as bQ,
|
|
35762
|
+
translator$1j as bR,
|
|
35763
|
+
translator$19 as bS,
|
|
35764
|
+
translator$1a as bT,
|
|
35765
|
+
translator$1r as bU,
|
|
35766
|
+
translator$L as bV,
|
|
35767
|
+
translator$7 as bW,
|
|
35768
|
+
translator$6 as bX,
|
|
35769
|
+
translator$Y as bY,
|
|
35770
|
+
translator$1n as bZ,
|
|
35771
|
+
translator$4 as b_,
|
|
35772
|
+
translator$O as ba,
|
|
35773
|
+
translator$P as bb,
|
|
35774
|
+
translator$Q as bc,
|
|
35775
|
+
translator$v as bd,
|
|
35776
|
+
translator$R as be,
|
|
35777
|
+
translator$S as bf,
|
|
35778
|
+
translator$T as bg,
|
|
35779
|
+
translator$U as bh,
|
|
35780
|
+
translator$12 as bi,
|
|
35781
|
+
translator$t as bj,
|
|
35782
|
+
translator$V as bk,
|
|
35783
|
+
translator$13 as bl,
|
|
35784
|
+
translator$w as bm,
|
|
35785
|
+
translator$W as bn,
|
|
35786
|
+
translator$x as bo,
|
|
35509
35787
|
translator$s as bp,
|
|
35510
|
-
translator$
|
|
35511
|
-
translator$
|
|
35512
|
-
translator$
|
|
35513
|
-
translator$
|
|
35514
|
-
translator$
|
|
35515
|
-
translator$
|
|
35516
|
-
translator$
|
|
35517
|
-
translator$
|
|
35518
|
-
translator$
|
|
35519
|
-
translator$
|
|
35788
|
+
translator$1p as bq,
|
|
35789
|
+
translator$1f as br,
|
|
35790
|
+
translator$1g as bs,
|
|
35791
|
+
translator$1k as bt,
|
|
35792
|
+
translator$B as bu,
|
|
35793
|
+
translator$X as bv,
|
|
35794
|
+
translator$8 as bw,
|
|
35795
|
+
translator$D as bx,
|
|
35796
|
+
translator$1h as by,
|
|
35797
|
+
translator$1d as bz,
|
|
35520
35798
|
DOMParser$1 as c,
|
|
35799
|
+
translator$1 as c0,
|
|
35800
|
+
_sfc_main as c1,
|
|
35521
35801
|
Mark as d,
|
|
35522
35802
|
dropPoint as e,
|
|
35523
35803
|
callOrGet as f,
|