@harbour-enterprises/superdoc 0.21.0 → 0.21.2
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-D3zo7tPo.es.js → PdfViewer-B8NGBTSu.es.js} +1 -1
- package/dist/chunks/{PdfViewer-OZDJ7gwT.cjs → PdfViewer-BI_j6JKS.cjs} +1 -1
- package/dist/chunks/{index-MzW5BVNd.es.js → index-CBHfvgkG.es.js} +42 -21
- package/dist/chunks/{index-CfYf4T_z.cjs → index-tTdOfgF_.cjs} +42 -21
- package/dist/chunks/{super-editor.es-U-GVCd_F.cjs → super-editor.es-BHEMJ9ST.cjs} +1595 -866
- package/dist/chunks/{super-editor.es-Bntob7Wd.es.js → super-editor.es-BIEh7qVW.es.js} +1595 -866
- package/dist/core/SuperDoc.d.ts +5 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +12 -4
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/style.css +47 -27
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-3xnF_NHq.js → converter-D7lP9y8P.js} +1064 -710
- package/dist/super-editor/chunks/{docx-zipper-CZdELYi-.js → docx-zipper-_TMbHpUQ.js} +73 -12
- package/dist/super-editor/chunks/{editor-BqYH4kDD.js → editor-BuT5uWdz.js} +80 -26
- package/dist/super-editor/chunks/{toolbar-TkaE2kKM.js → toolbar-6ZwZPyNU.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/src/components/slash-menu/menuItems.d.ts +5 -1
- package/dist/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +466 -0
- package/dist/super-editor/src/components/slash-menu/utils.d.ts +9 -2
- package/dist/super-editor/src/core/DocxZipper.d.ts +1 -1
- package/dist/super-editor/src/core/commands/__tests__/schemaWithLists.d.ts +2 -0
- package/dist/super-editor/src/core/commands/__tests__/testHelpers.d.ts +4 -0
- package/dist/super-editor/src/core/commands/__tests__/testSchema.d.ts +2 -0
- package/dist/super-editor/src/core/commands/tests/commandTestUtils.d.ts +7 -0
- package/dist/super-editor/src/core/commands/tests/test-schema.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +1 -13
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/helpers/tableFallbackHelpers.d.ts +24 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +5 -0
- package/dist/super-editor/src/tests/helpers/helpers.d.ts +1 -0
- package/dist/super-editor/src/utils/contextmenu-helpers.d.ts +24 -0
- package/dist/super-editor/style.css +20 -0
- package/dist/super-editor/super-editor.es.js +454 -154
- 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 +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +1635 -885
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +2 -5
- package/dist/super-editor/src/extensions/run-item/index.d.ts +0 -1
- package/dist/super-editor/src/extensions/run-item/run-item.d.ts +0 -26
|
@@ -24323,37 +24323,37 @@ const _NodeTranslator = class _NodeTranslator {
|
|
|
24323
24323
|
/** @type {typeof TranslatorTypes} */
|
|
24324
24324
|
__publicField(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
24325
24325
|
let NodeTranslator = _NodeTranslator;
|
|
24326
|
-
const encode$
|
|
24326
|
+
const encode$18 = (attributes) => {
|
|
24327
24327
|
return attributes["w:type"];
|
|
24328
24328
|
};
|
|
24329
|
-
const decode
|
|
24329
|
+
const decode$$ = (attrs) => {
|
|
24330
24330
|
const { lineBreakType } = attrs;
|
|
24331
24331
|
return lineBreakType;
|
|
24332
24332
|
};
|
|
24333
24333
|
const attrConfig$F = Object.freeze({
|
|
24334
24334
|
xmlName: "w:type",
|
|
24335
24335
|
sdName: "lineBreakType",
|
|
24336
|
-
encode: encode$
|
|
24337
|
-
decode: decode
|
|
24336
|
+
encode: encode$18,
|
|
24337
|
+
decode: decode$$
|
|
24338
24338
|
});
|
|
24339
|
-
const encode$
|
|
24339
|
+
const encode$17 = (attributes) => {
|
|
24340
24340
|
const xmlAttrValue = attributes["w:clear"];
|
|
24341
24341
|
return xmlAttrValue;
|
|
24342
24342
|
};
|
|
24343
|
-
const decode$
|
|
24343
|
+
const decode$_ = (attrs) => {
|
|
24344
24344
|
const { clear } = attrs;
|
|
24345
24345
|
return clear;
|
|
24346
24346
|
};
|
|
24347
24347
|
const attrConfig$E = Object.freeze({
|
|
24348
24348
|
xmlName: "w:clear",
|
|
24349
24349
|
sdName: "clear",
|
|
24350
|
-
encode: encode$
|
|
24351
|
-
decode: decode$
|
|
24350
|
+
encode: encode$17,
|
|
24351
|
+
decode: decode$_
|
|
24352
24352
|
});
|
|
24353
|
-
const validXmlAttributes$
|
|
24354
|
-
const XML_NODE_NAME$
|
|
24355
|
-
const SD_NODE_NAME$
|
|
24356
|
-
const encode$
|
|
24353
|
+
const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
|
|
24354
|
+
const XML_NODE_NAME$u = "w:br";
|
|
24355
|
+
const SD_NODE_NAME$d = "lineBreak";
|
|
24356
|
+
const encode$16 = (_2, encodedAttrs) => {
|
|
24357
24357
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
24358
24358
|
const translated = {
|
|
24359
24359
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -24363,7 +24363,7 @@ const encode$15 = (_2, encodedAttrs) => {
|
|
|
24363
24363
|
}
|
|
24364
24364
|
return translated;
|
|
24365
24365
|
};
|
|
24366
|
-
const decode$
|
|
24366
|
+
const decode$Z = (params, decodedAttrs) => {
|
|
24367
24367
|
const { node } = params;
|
|
24368
24368
|
if (!node) return;
|
|
24369
24369
|
const wBreak = { name: "w:br" };
|
|
@@ -24380,39 +24380,39 @@ const decode$Y = (params, decodedAttrs) => {
|
|
|
24380
24380
|
};
|
|
24381
24381
|
return translated;
|
|
24382
24382
|
};
|
|
24383
|
-
const config$
|
|
24384
|
-
xmlName: XML_NODE_NAME$
|
|
24385
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24383
|
+
const config$s = {
|
|
24384
|
+
xmlName: XML_NODE_NAME$u,
|
|
24385
|
+
sdNodeOrKeyName: SD_NODE_NAME$d,
|
|
24386
24386
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24387
|
-
encode: encode$
|
|
24388
|
-
decode: decode$
|
|
24389
|
-
attributes: validXmlAttributes$
|
|
24387
|
+
encode: encode$16,
|
|
24388
|
+
decode: decode$Z,
|
|
24389
|
+
attributes: validXmlAttributes$m
|
|
24390
24390
|
};
|
|
24391
|
-
const translator$
|
|
24392
|
-
const encode$
|
|
24393
|
-
const decode$
|
|
24391
|
+
const translator$16 = NodeTranslator.from(config$s);
|
|
24392
|
+
const encode$15 = (attributes) => attributes?.["w:val"];
|
|
24393
|
+
const decode$Y = (attrs) => attrs?.highlight;
|
|
24394
24394
|
const attrConfig$D = Object.freeze({
|
|
24395
24395
|
xmlName: "w:val",
|
|
24396
24396
|
sdName: "highlight",
|
|
24397
|
-
encode: encode$
|
|
24398
|
-
decode: decode$
|
|
24397
|
+
encode: encode$15,
|
|
24398
|
+
decode: decode$Y
|
|
24399
24399
|
});
|
|
24400
|
-
const validXmlAttributes$
|
|
24401
|
-
const XML_NODE_NAME$
|
|
24400
|
+
const validXmlAttributes$l = [attrConfig$D];
|
|
24401
|
+
const XML_NODE_NAME$t = "w:highlight";
|
|
24402
24402
|
const SD_ATTR_KEY$f = "highlight";
|
|
24403
24403
|
const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
|
|
24404
|
-
const encode$
|
|
24404
|
+
const encode$14 = (params, encodedAttrs = {}) => {
|
|
24405
24405
|
const { nodes } = params;
|
|
24406
24406
|
const node = nodes?.[0];
|
|
24407
24407
|
const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
|
|
24408
24408
|
return {
|
|
24409
24409
|
type: "attr",
|
|
24410
|
-
xmlName: XML_NODE_NAME$
|
|
24410
|
+
xmlName: XML_NODE_NAME$t,
|
|
24411
24411
|
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
24412
24412
|
attributes: { "w:val": value ?? null }
|
|
24413
24413
|
};
|
|
24414
24414
|
};
|
|
24415
|
-
const decode$
|
|
24415
|
+
const decode$X = (params) => {
|
|
24416
24416
|
const attrs = params?.node?.attrs || {};
|
|
24417
24417
|
const highlightValue = attrs.highlight ?? attrs.color ?? null;
|
|
24418
24418
|
if (!highlightValue) return void 0;
|
|
@@ -24420,14 +24420,14 @@ const decode$W = (params) => {
|
|
|
24420
24420
|
if (!normalizedValue) return void 0;
|
|
24421
24421
|
if (DISABLED_TOKENS.has(normalizedValue)) {
|
|
24422
24422
|
return {
|
|
24423
|
-
name: XML_NODE_NAME$
|
|
24423
|
+
name: XML_NODE_NAME$t,
|
|
24424
24424
|
attributes: { "w:val": "none" }
|
|
24425
24425
|
};
|
|
24426
24426
|
}
|
|
24427
24427
|
const keyword = getDocxHighlightKeywordFromHex(highlightValue);
|
|
24428
24428
|
if (keyword) {
|
|
24429
24429
|
return {
|
|
24430
|
-
name: XML_NODE_NAME$
|
|
24430
|
+
name: XML_NODE_NAME$t,
|
|
24431
24431
|
attributes: { "w:val": keyword }
|
|
24432
24432
|
};
|
|
24433
24433
|
}
|
|
@@ -24442,63 +24442,63 @@ const decode$W = (params) => {
|
|
|
24442
24442
|
}
|
|
24443
24443
|
};
|
|
24444
24444
|
};
|
|
24445
|
-
const config$
|
|
24446
|
-
xmlName: XML_NODE_NAME$
|
|
24445
|
+
const config$r = {
|
|
24446
|
+
xmlName: XML_NODE_NAME$t,
|
|
24447
24447
|
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
24448
24448
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
24449
|
-
encode: encode$
|
|
24450
|
-
decode: decode$
|
|
24451
|
-
attributes: validXmlAttributes$
|
|
24449
|
+
encode: encode$14,
|
|
24450
|
+
decode: decode$X,
|
|
24451
|
+
attributes: validXmlAttributes$l
|
|
24452
24452
|
};
|
|
24453
|
-
const translator$
|
|
24454
|
-
const encode$
|
|
24453
|
+
const translator$15 = NodeTranslator.from(config$r);
|
|
24454
|
+
const encode$13 = (attributes) => {
|
|
24455
24455
|
return attributes["w:val"];
|
|
24456
24456
|
};
|
|
24457
|
-
const decode$
|
|
24457
|
+
const decode$W = (attrs) => {
|
|
24458
24458
|
const { tabSize } = attrs || {};
|
|
24459
24459
|
return tabSize;
|
|
24460
24460
|
};
|
|
24461
24461
|
const attrConfig$C = Object.freeze({
|
|
24462
24462
|
xmlName: "w:val",
|
|
24463
24463
|
sdName: "tabSize",
|
|
24464
|
-
encode: encode$
|
|
24465
|
-
decode: decode$
|
|
24464
|
+
encode: encode$13,
|
|
24465
|
+
decode: decode$W
|
|
24466
24466
|
});
|
|
24467
|
-
const encode$
|
|
24467
|
+
const encode$12 = (attributes) => {
|
|
24468
24468
|
return attributes["w:leader"];
|
|
24469
24469
|
};
|
|
24470
|
-
const decode$
|
|
24470
|
+
const decode$V = (attrs) => {
|
|
24471
24471
|
const { leader } = attrs || {};
|
|
24472
24472
|
return leader;
|
|
24473
24473
|
};
|
|
24474
24474
|
const attrConfig$B = Object.freeze({
|
|
24475
24475
|
xmlName: "w:leader",
|
|
24476
24476
|
sdName: "leader",
|
|
24477
|
-
encode: encode$
|
|
24478
|
-
decode: decode$
|
|
24477
|
+
encode: encode$12,
|
|
24478
|
+
decode: decode$V
|
|
24479
24479
|
});
|
|
24480
|
-
const encode$
|
|
24480
|
+
const encode$11 = (attributes) => {
|
|
24481
24481
|
return attributes["w:pos"];
|
|
24482
24482
|
};
|
|
24483
|
-
const decode$
|
|
24483
|
+
const decode$U = (attrs) => {
|
|
24484
24484
|
const { pos } = attrs || {};
|
|
24485
24485
|
return pos;
|
|
24486
24486
|
};
|
|
24487
24487
|
const attrConfig$A = Object.freeze({
|
|
24488
24488
|
xmlName: "w:pos",
|
|
24489
24489
|
sdName: "pos",
|
|
24490
|
-
encode: encode$
|
|
24491
|
-
decode: decode$
|
|
24490
|
+
encode: encode$11,
|
|
24491
|
+
decode: decode$U
|
|
24492
24492
|
});
|
|
24493
|
-
const validXmlAttributes$
|
|
24494
|
-
const XML_NODE_NAME$
|
|
24495
|
-
const SD_NODE_NAME$
|
|
24496
|
-
const encode
|
|
24493
|
+
const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
|
|
24494
|
+
const XML_NODE_NAME$s = "w:tab";
|
|
24495
|
+
const SD_NODE_NAME$c = "tab";
|
|
24496
|
+
const encode$10 = (_2, encodedAttrs = {}) => {
|
|
24497
24497
|
const translated = { type: "tab" };
|
|
24498
24498
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
24499
24499
|
return translated;
|
|
24500
24500
|
};
|
|
24501
|
-
const decode$
|
|
24501
|
+
const decode$T = (params, decodedAttrs = {}) => {
|
|
24502
24502
|
const { node } = params || {};
|
|
24503
24503
|
if (!node) return;
|
|
24504
24504
|
const wTab = { name: "w:tab" };
|
|
@@ -24514,15 +24514,15 @@ const decode$S = (params, decodedAttrs = {}) => {
|
|
|
24514
24514
|
}
|
|
24515
24515
|
return translated;
|
|
24516
24516
|
};
|
|
24517
|
-
const config$
|
|
24518
|
-
xmlName: XML_NODE_NAME$
|
|
24519
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24517
|
+
const config$q = {
|
|
24518
|
+
xmlName: XML_NODE_NAME$s,
|
|
24519
|
+
sdNodeOrKeyName: SD_NODE_NAME$c,
|
|
24520
24520
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24521
|
-
encode: encode
|
|
24522
|
-
decode: decode$
|
|
24523
|
-
attributes: validXmlAttributes$
|
|
24521
|
+
encode: encode$10,
|
|
24522
|
+
decode: decode$T,
|
|
24523
|
+
attributes: validXmlAttributes$k
|
|
24524
24524
|
};
|
|
24525
|
-
const translator$
|
|
24525
|
+
const translator$14 = NodeTranslator.from(config$q);
|
|
24526
24526
|
const mergeTextNodes = (nodes) => {
|
|
24527
24527
|
if (!nodes || !Array.isArray(nodes)) {
|
|
24528
24528
|
return nodes;
|
|
@@ -24846,17 +24846,16 @@ const getParagraphSpacing = (node, docx, styleId = "", marks = [], options = {})
|
|
|
24846
24846
|
};
|
|
24847
24847
|
const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
24848
24848
|
const styles = docx["word/styles.xml"];
|
|
24849
|
-
|
|
24849
|
+
const rootElements = styles?.elements?.[0]?.elements;
|
|
24850
|
+
if (!rootElements?.length) {
|
|
24850
24851
|
return {};
|
|
24851
24852
|
}
|
|
24852
|
-
const defaults =
|
|
24853
|
-
const pDefault = defaults
|
|
24853
|
+
const defaults = rootElements.find((el) => el.name === "w:docDefaults");
|
|
24854
|
+
const pDefault = defaults?.elements?.find((el) => el.name === "w:pPrDefault") || {};
|
|
24854
24855
|
const pPrDefault = pDefault?.elements?.find((el) => el.name === "w:pPr");
|
|
24855
24856
|
const pPrDefaultSpacingTag = pPrDefault?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24856
24857
|
const pPrDefaultIndentTag = pPrDefault?.elements?.find((el) => el.name === "w:ind") || {};
|
|
24857
|
-
const stylesNormal =
|
|
24858
|
-
(el) => el.name === "w:style" && el.attributes["w:styleId"] === "Normal"
|
|
24859
|
-
);
|
|
24858
|
+
const stylesNormal = rootElements.find((el) => el.name === "w:style" && el.attributes["w:styleId"] === "Normal");
|
|
24860
24859
|
const pPrNormal = stylesNormal?.elements?.find((el) => el.name === "w:pPr");
|
|
24861
24860
|
const pPrNormalSpacingTag = pPrNormal?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24862
24861
|
const pPrNormalIndentTag = pPrNormal?.elements?.find((el) => el.name === "w:ind") || {};
|
|
@@ -24865,9 +24864,7 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
|
24865
24864
|
let pPrStyleIdIndentTag = {};
|
|
24866
24865
|
let pPrStyleJc = {};
|
|
24867
24866
|
if (styleId) {
|
|
24868
|
-
const stylesById =
|
|
24869
|
-
(el) => el.name === "w:style" && el.attributes["w:styleId"] === styleId
|
|
24870
|
-
);
|
|
24867
|
+
const stylesById = rootElements.find((el) => el.name === "w:style" && el.attributes["w:styleId"] === styleId);
|
|
24871
24868
|
const pPrById = stylesById?.elements?.find((el) => el.name === "w:pPr");
|
|
24872
24869
|
pPrStyleIdSpacingTag = pPrById?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24873
24870
|
pPrStyleIdIndentTag = pPrById?.elements?.find((el) => el.name === "w:ind") || {};
|
|
@@ -25137,91 +25134,91 @@ const handleParagraphNode$1 = (params) => {
|
|
|
25137
25134
|
}
|
|
25138
25135
|
return schemaNode;
|
|
25139
25136
|
};
|
|
25140
|
-
const encode
|
|
25137
|
+
const encode$$ = (attributes) => {
|
|
25141
25138
|
return attributes["w:rsidDel"];
|
|
25142
25139
|
};
|
|
25143
|
-
const decode$
|
|
25140
|
+
const decode$S = (attrs) => {
|
|
25144
25141
|
return attrs.rsidDel;
|
|
25145
25142
|
};
|
|
25146
25143
|
const attrConfig$z = Object.freeze({
|
|
25147
25144
|
xmlName: "w:rsidDel",
|
|
25148
25145
|
sdName: "rsidDel",
|
|
25149
|
-
encode: encode
|
|
25150
|
-
decode: decode$
|
|
25146
|
+
encode: encode$$,
|
|
25147
|
+
decode: decode$S
|
|
25151
25148
|
});
|
|
25152
|
-
const encode$
|
|
25149
|
+
const encode$_ = (attributes) => {
|
|
25153
25150
|
return attributes["w:rsidP"];
|
|
25154
25151
|
};
|
|
25155
|
-
const decode$
|
|
25152
|
+
const decode$R = (attrs) => {
|
|
25156
25153
|
return attrs.rsidP;
|
|
25157
25154
|
};
|
|
25158
25155
|
const attrConfig$y = Object.freeze({
|
|
25159
25156
|
xmlName: "w:rsidP",
|
|
25160
25157
|
sdName: "rsidP",
|
|
25161
|
-
encode: encode$
|
|
25162
|
-
decode: decode$
|
|
25158
|
+
encode: encode$_,
|
|
25159
|
+
decode: decode$R
|
|
25163
25160
|
});
|
|
25164
|
-
const encode$
|
|
25161
|
+
const encode$Z = (attributes) => {
|
|
25165
25162
|
return attributes["w:rsidR"];
|
|
25166
25163
|
};
|
|
25167
|
-
const decode$
|
|
25164
|
+
const decode$Q = (attrs) => {
|
|
25168
25165
|
return attrs.rsidR;
|
|
25169
25166
|
};
|
|
25170
25167
|
const attrConfig$x = Object.freeze({
|
|
25171
25168
|
xmlName: "w:rsidR",
|
|
25172
25169
|
sdName: "rsidR",
|
|
25173
|
-
encode: encode$
|
|
25174
|
-
decode: decode$
|
|
25170
|
+
encode: encode$Z,
|
|
25171
|
+
decode: decode$Q
|
|
25175
25172
|
});
|
|
25176
|
-
const encode$
|
|
25173
|
+
const encode$Y = (attributes) => {
|
|
25177
25174
|
return attributes["w:rsidRPr"];
|
|
25178
25175
|
};
|
|
25179
|
-
const decode$
|
|
25176
|
+
const decode$P = (attrs) => {
|
|
25180
25177
|
return attrs.rsidRPr;
|
|
25181
25178
|
};
|
|
25182
25179
|
const attrConfig$w = Object.freeze({
|
|
25183
25180
|
xmlName: "w:rsidRPr",
|
|
25184
25181
|
sdName: "rsidRPr",
|
|
25185
|
-
encode: encode$
|
|
25186
|
-
decode: decode$
|
|
25182
|
+
encode: encode$Y,
|
|
25183
|
+
decode: decode$P
|
|
25187
25184
|
});
|
|
25188
|
-
const encode$
|
|
25185
|
+
const encode$X = (attributes) => {
|
|
25189
25186
|
return attributes["w:rsidRDefault"];
|
|
25190
25187
|
};
|
|
25191
|
-
const decode$
|
|
25188
|
+
const decode$O = (attrs) => {
|
|
25192
25189
|
return attrs.rsidRDefault;
|
|
25193
25190
|
};
|
|
25194
25191
|
const attrConfig$v = Object.freeze({
|
|
25195
25192
|
xmlName: "w:rsidRDefault",
|
|
25196
25193
|
sdName: "rsidRDefault",
|
|
25197
|
-
encode: encode$
|
|
25198
|
-
decode: decode$
|
|
25194
|
+
encode: encode$X,
|
|
25195
|
+
decode: decode$O
|
|
25199
25196
|
});
|
|
25200
|
-
const encode$
|
|
25197
|
+
const encode$W = (attributes) => {
|
|
25201
25198
|
return attributes["w14:paraId"];
|
|
25202
25199
|
};
|
|
25203
|
-
const decode$
|
|
25200
|
+
const decode$N = (attrs) => {
|
|
25204
25201
|
return attrs.paraId;
|
|
25205
25202
|
};
|
|
25206
25203
|
const attrConfig$u = Object.freeze({
|
|
25207
25204
|
xmlName: "w14:paraId",
|
|
25208
25205
|
sdName: "paraId",
|
|
25209
|
-
encode: encode$
|
|
25210
|
-
decode: decode$
|
|
25206
|
+
encode: encode$W,
|
|
25207
|
+
decode: decode$N
|
|
25211
25208
|
});
|
|
25212
|
-
const encode$
|
|
25209
|
+
const encode$V = (attributes) => {
|
|
25213
25210
|
return attributes["w14:textId"];
|
|
25214
25211
|
};
|
|
25215
|
-
const decode$
|
|
25212
|
+
const decode$M = (attrs) => {
|
|
25216
25213
|
return attrs.textId;
|
|
25217
25214
|
};
|
|
25218
25215
|
const attrConfig$t = Object.freeze({
|
|
25219
25216
|
xmlName: "w14:textId",
|
|
25220
25217
|
sdName: "textId",
|
|
25221
|
-
encode: encode$
|
|
25222
|
-
decode: decode$
|
|
25218
|
+
encode: encode$V,
|
|
25219
|
+
decode: decode$M
|
|
25223
25220
|
});
|
|
25224
|
-
const validXmlAttributes$
|
|
25221
|
+
const validXmlAttributes$j = [
|
|
25225
25222
|
attrConfig$u,
|
|
25226
25223
|
attrConfig$t,
|
|
25227
25224
|
attrConfig$x,
|
|
@@ -25230,9 +25227,9 @@ const validXmlAttributes$i = [
|
|
|
25230
25227
|
attrConfig$w,
|
|
25231
25228
|
attrConfig$z
|
|
25232
25229
|
];
|
|
25233
|
-
const XML_NODE_NAME$
|
|
25234
|
-
const SD_NODE_NAME$
|
|
25235
|
-
const encode$
|
|
25230
|
+
const XML_NODE_NAME$r = "w:p";
|
|
25231
|
+
const SD_NODE_NAME$b = "paragraph";
|
|
25232
|
+
const encode$U = (params, encodedAttrs = {}) => {
|
|
25236
25233
|
const node = handleParagraphNode$1(params);
|
|
25237
25234
|
if (!node) return void 0;
|
|
25238
25235
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -25240,7 +25237,7 @@ const encode$T = (params, encodedAttrs = {}) => {
|
|
|
25240
25237
|
}
|
|
25241
25238
|
return node;
|
|
25242
25239
|
};
|
|
25243
|
-
const decode$
|
|
25240
|
+
const decode$L = (params, decodedAttrs = {}) => {
|
|
25244
25241
|
const translated = translateParagraphNode(params);
|
|
25245
25242
|
if (!translated) return void 0;
|
|
25246
25243
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -25248,16 +25245,16 @@ const decode$K = (params, decodedAttrs = {}) => {
|
|
|
25248
25245
|
}
|
|
25249
25246
|
return translated;
|
|
25250
25247
|
};
|
|
25251
|
-
const config$
|
|
25252
|
-
xmlName: XML_NODE_NAME$
|
|
25253
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
25248
|
+
const config$p = {
|
|
25249
|
+
xmlName: XML_NODE_NAME$r,
|
|
25250
|
+
sdNodeOrKeyName: SD_NODE_NAME$b,
|
|
25254
25251
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25255
|
-
encode: encode$
|
|
25256
|
-
decode: decode$
|
|
25257
|
-
attributes: validXmlAttributes$
|
|
25252
|
+
encode: encode$U,
|
|
25253
|
+
decode: decode$L,
|
|
25254
|
+
attributes: validXmlAttributes$j
|
|
25258
25255
|
};
|
|
25259
|
-
const translator$
|
|
25260
|
-
const encode$
|
|
25256
|
+
const translator$13 = NodeTranslator.from(config$p);
|
|
25257
|
+
const encode$T = (attributes) => {
|
|
25261
25258
|
const raw = attributes?.["w:val"];
|
|
25262
25259
|
if (raw === void 0 || raw === null) return void 0;
|
|
25263
25260
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25267,20 +25264,20 @@ const encode$S = (attributes) => {
|
|
|
25267
25264
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25268
25265
|
return void 0;
|
|
25269
25266
|
};
|
|
25270
|
-
const decode$
|
|
25267
|
+
const decode$K = (runProps) => {
|
|
25271
25268
|
if (runProps?.bold === false) return "0";
|
|
25272
25269
|
return void 0;
|
|
25273
25270
|
};
|
|
25274
25271
|
const attrConfig$s = Object.freeze({
|
|
25275
25272
|
xmlName: "w:val",
|
|
25276
25273
|
sdName: "bold",
|
|
25277
|
-
encode: encode$
|
|
25278
|
-
decode: decode$
|
|
25274
|
+
encode: encode$T,
|
|
25275
|
+
decode: decode$K
|
|
25279
25276
|
});
|
|
25280
|
-
const validXmlAttributes$
|
|
25281
|
-
const XML_NODE_NAME$
|
|
25277
|
+
const validXmlAttributes$i = [attrConfig$s];
|
|
25278
|
+
const XML_NODE_NAME$q = "w:b";
|
|
25282
25279
|
const SD_ATTR_KEY$e = "bold";
|
|
25283
|
-
const encode$
|
|
25280
|
+
const encode$S = (params, encodedAttrs = {}) => {
|
|
25284
25281
|
const { nodes } = params;
|
|
25285
25282
|
const node = nodes[0];
|
|
25286
25283
|
if (!node) return void 0;
|
|
@@ -25292,85 +25289,85 @@ const encode$R = (params, encodedAttrs = {}) => {
|
|
|
25292
25289
|
else attributes = node.attributes || {};
|
|
25293
25290
|
return {
|
|
25294
25291
|
type: "attr",
|
|
25295
|
-
xmlName: XML_NODE_NAME$
|
|
25292
|
+
xmlName: XML_NODE_NAME$q,
|
|
25296
25293
|
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25297
25294
|
attributes
|
|
25298
25295
|
};
|
|
25299
25296
|
};
|
|
25300
|
-
const config$
|
|
25301
|
-
xmlName: XML_NODE_NAME$
|
|
25297
|
+
const config$o = {
|
|
25298
|
+
xmlName: XML_NODE_NAME$q,
|
|
25302
25299
|
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25303
25300
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25304
|
-
encode: encode$
|
|
25305
|
-
attributes: validXmlAttributes$
|
|
25301
|
+
encode: encode$S,
|
|
25302
|
+
attributes: validXmlAttributes$i
|
|
25306
25303
|
};
|
|
25307
|
-
const translator$
|
|
25308
|
-
const XML_NODE_NAME$
|
|
25304
|
+
const translator$12 = NodeTranslator.from(config$o);
|
|
25305
|
+
const XML_NODE_NAME$p = "w:i";
|
|
25309
25306
|
const SD_ATTR_KEY$d = "italic";
|
|
25310
|
-
const encode$
|
|
25307
|
+
const encode$R = (params) => {
|
|
25311
25308
|
const { nodes } = params;
|
|
25312
25309
|
const node = nodes?.[0];
|
|
25313
25310
|
if (!node) return void 0;
|
|
25314
25311
|
return {
|
|
25315
25312
|
type: "attr",
|
|
25316
|
-
xmlName: XML_NODE_NAME$
|
|
25313
|
+
xmlName: XML_NODE_NAME$p,
|
|
25317
25314
|
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25318
25315
|
attributes: {
|
|
25319
25316
|
"w:val": node.attributes?.["w:val"] ?? null
|
|
25320
25317
|
}
|
|
25321
25318
|
};
|
|
25322
25319
|
};
|
|
25323
|
-
const config$
|
|
25324
|
-
xmlName: XML_NODE_NAME$
|
|
25320
|
+
const config$n = {
|
|
25321
|
+
xmlName: XML_NODE_NAME$p,
|
|
25325
25322
|
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25326
25323
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25327
|
-
encode: encode$
|
|
25324
|
+
encode: encode$R
|
|
25328
25325
|
};
|
|
25329
|
-
const translator$
|
|
25330
|
-
const encode$
|
|
25331
|
-
const decode$
|
|
25326
|
+
const translator$11 = NodeTranslator.from(config$n);
|
|
25327
|
+
const encode$Q = (attributes) => attributes?.["w:val"];
|
|
25328
|
+
const decode$J = (attrs) => attrs?.underline;
|
|
25332
25329
|
const attrConfig$r = Object.freeze({
|
|
25333
25330
|
xmlName: "w:val",
|
|
25334
25331
|
sdName: "underline",
|
|
25335
|
-
encode: encode$
|
|
25336
|
-
decode: decode$
|
|
25332
|
+
encode: encode$Q,
|
|
25333
|
+
decode: decode$J
|
|
25337
25334
|
});
|
|
25338
|
-
const encode$
|
|
25339
|
-
const decode$
|
|
25335
|
+
const encode$P = (attributes) => attributes?.["w:color"];
|
|
25336
|
+
const decode$I = (attrs) => attrs?.color;
|
|
25340
25337
|
const attrConfig$q = Object.freeze({
|
|
25341
25338
|
xmlName: "w:color",
|
|
25342
25339
|
sdName: "color",
|
|
25343
|
-
encode: encode$
|
|
25344
|
-
decode: decode$
|
|
25340
|
+
encode: encode$P,
|
|
25341
|
+
decode: decode$I
|
|
25345
25342
|
});
|
|
25346
|
-
const encode$
|
|
25347
|
-
const decode$
|
|
25343
|
+
const encode$O = (attributes) => attributes?.["w:themeColor"];
|
|
25344
|
+
const decode$H = (attrs) => attrs?.themeColor;
|
|
25348
25345
|
const attrConfig$p = Object.freeze({
|
|
25349
25346
|
xmlName: "w:themeColor",
|
|
25350
25347
|
sdName: "themeColor",
|
|
25351
|
-
encode: encode$
|
|
25352
|
-
decode: decode$
|
|
25348
|
+
encode: encode$O,
|
|
25349
|
+
decode: decode$H
|
|
25353
25350
|
});
|
|
25354
|
-
const encode$
|
|
25355
|
-
const decode$
|
|
25351
|
+
const encode$N = (attributes) => attributes?.["w:themeTint"];
|
|
25352
|
+
const decode$G = (attrs) => attrs?.themeTint;
|
|
25356
25353
|
const attrConfig$o = Object.freeze({
|
|
25357
25354
|
xmlName: "w:themeTint",
|
|
25358
25355
|
sdName: "themeTint",
|
|
25359
|
-
encode: encode$
|
|
25360
|
-
decode: decode$
|
|
25356
|
+
encode: encode$N,
|
|
25357
|
+
decode: decode$G
|
|
25361
25358
|
});
|
|
25362
|
-
const encode$
|
|
25363
|
-
const decode$
|
|
25359
|
+
const encode$M = (attributes) => attributes?.["w:themeShade"];
|
|
25360
|
+
const decode$F = (attrs) => attrs?.themeShade;
|
|
25364
25361
|
const attrConfig$n = Object.freeze({
|
|
25365
25362
|
xmlName: "w:themeShade",
|
|
25366
25363
|
sdName: "themeShade",
|
|
25367
|
-
encode: encode$
|
|
25368
|
-
decode: decode$
|
|
25364
|
+
encode: encode$M,
|
|
25365
|
+
decode: decode$F
|
|
25369
25366
|
});
|
|
25370
|
-
const validXmlAttributes$
|
|
25371
|
-
const XML_NODE_NAME$
|
|
25367
|
+
const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
|
|
25368
|
+
const XML_NODE_NAME$o = "w:u";
|
|
25372
25369
|
const SD_ATTR_KEY$c = "underline";
|
|
25373
|
-
const encode$
|
|
25370
|
+
const encode$L = (params, encodedAttrs = {}) => {
|
|
25374
25371
|
const { nodes } = params;
|
|
25375
25372
|
const node = nodes?.[0];
|
|
25376
25373
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25386,12 +25383,12 @@ const encode$K = (params, encodedAttrs = {}) => {
|
|
|
25386
25383
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25387
25384
|
return {
|
|
25388
25385
|
type: "attr",
|
|
25389
|
-
xmlName: XML_NODE_NAME$
|
|
25386
|
+
xmlName: XML_NODE_NAME$o,
|
|
25390
25387
|
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25391
25388
|
attributes
|
|
25392
25389
|
};
|
|
25393
25390
|
};
|
|
25394
|
-
const decode$
|
|
25391
|
+
const decode$E = (params) => {
|
|
25395
25392
|
const attrs = params?.node?.attrs || {};
|
|
25396
25393
|
const underlineType = attrs.underlineType ?? attrs.underline ?? null;
|
|
25397
25394
|
const color = attrs.underlineColor ?? attrs.color ?? null;
|
|
@@ -25409,20 +25406,20 @@ const decode$D = (params) => {
|
|
|
25409
25406
|
if (themeTint) attributes["w:themeTint"] = themeTint;
|
|
25410
25407
|
if (themeShade) attributes["w:themeShade"] = themeShade;
|
|
25411
25408
|
return {
|
|
25412
|
-
name: XML_NODE_NAME$
|
|
25409
|
+
name: XML_NODE_NAME$o,
|
|
25413
25410
|
attributes
|
|
25414
25411
|
};
|
|
25415
25412
|
};
|
|
25416
|
-
const config$
|
|
25417
|
-
xmlName: XML_NODE_NAME$
|
|
25413
|
+
const config$m = {
|
|
25414
|
+
xmlName: XML_NODE_NAME$o,
|
|
25418
25415
|
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25419
25416
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25420
|
-
encode: encode$
|
|
25421
|
-
decode: decode$
|
|
25422
|
-
attributes: validXmlAttributes$
|
|
25417
|
+
encode: encode$L,
|
|
25418
|
+
decode: decode$E,
|
|
25419
|
+
attributes: validXmlAttributes$h
|
|
25423
25420
|
};
|
|
25424
|
-
const translator
|
|
25425
|
-
const encode$
|
|
25421
|
+
const translator$10 = NodeTranslator.from(config$m);
|
|
25422
|
+
const encode$K = (attributes) => {
|
|
25426
25423
|
const raw = attributes?.["w:val"];
|
|
25427
25424
|
if (raw === void 0 || raw === null) return void 0;
|
|
25428
25425
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25432,20 +25429,20 @@ const encode$J = (attributes) => {
|
|
|
25432
25429
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25433
25430
|
return void 0;
|
|
25434
25431
|
};
|
|
25435
|
-
const decode$
|
|
25432
|
+
const decode$D = (attrs) => {
|
|
25436
25433
|
if (attrs?.strike === false) return "0";
|
|
25437
25434
|
return void 0;
|
|
25438
25435
|
};
|
|
25439
25436
|
const attrConfig$m = Object.freeze({
|
|
25440
25437
|
xmlName: "w:val",
|
|
25441
25438
|
sdName: "strike",
|
|
25442
|
-
encode: encode$
|
|
25443
|
-
decode: decode$
|
|
25439
|
+
encode: encode$K,
|
|
25440
|
+
decode: decode$D
|
|
25444
25441
|
});
|
|
25445
|
-
const validXmlAttributes$
|
|
25446
|
-
const XML_NODE_NAME$
|
|
25442
|
+
const validXmlAttributes$g = [attrConfig$m];
|
|
25443
|
+
const XML_NODE_NAME$n = "w:strike";
|
|
25447
25444
|
const SD_ATTR_KEY$b = "strike";
|
|
25448
|
-
const encode$
|
|
25445
|
+
const encode$J = (params, encodedAttrs = {}) => {
|
|
25449
25446
|
const { nodes } = params;
|
|
25450
25447
|
const node = nodes?.[0];
|
|
25451
25448
|
if (!node) return void 0;
|
|
@@ -25458,55 +25455,55 @@ const encode$I = (params, encodedAttrs = {}) => {
|
|
|
25458
25455
|
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25459
25456
|
return {
|
|
25460
25457
|
type: "attr",
|
|
25461
|
-
xmlName: XML_NODE_NAME$
|
|
25458
|
+
xmlName: XML_NODE_NAME$n,
|
|
25462
25459
|
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25463
25460
|
attributes
|
|
25464
25461
|
};
|
|
25465
25462
|
};
|
|
25466
|
-
const config$
|
|
25467
|
-
xmlName: XML_NODE_NAME$
|
|
25463
|
+
const config$l = {
|
|
25464
|
+
xmlName: XML_NODE_NAME$n,
|
|
25468
25465
|
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25469
25466
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25470
|
-
encode: encode$
|
|
25471
|
-
attributes: validXmlAttributes$
|
|
25467
|
+
encode: encode$J,
|
|
25468
|
+
attributes: validXmlAttributes$g
|
|
25472
25469
|
};
|
|
25473
|
-
const translator
|
|
25474
|
-
const encode$
|
|
25475
|
-
const decode$
|
|
25470
|
+
const translator$$ = NodeTranslator.from(config$l);
|
|
25471
|
+
const encode$I = (attributes) => attributes?.["w:val"];
|
|
25472
|
+
const decode$C = (attrs) => attrs?.color;
|
|
25476
25473
|
const attrConfig$l = Object.freeze({
|
|
25477
25474
|
xmlName: "w:val",
|
|
25478
25475
|
sdName: "color",
|
|
25479
|
-
encode: encode$
|
|
25480
|
-
decode: decode$
|
|
25476
|
+
encode: encode$I,
|
|
25477
|
+
decode: decode$C
|
|
25481
25478
|
});
|
|
25482
|
-
const encode$
|
|
25483
|
-
const decode$
|
|
25479
|
+
const encode$H = (attributes) => attributes?.["w:themeColor"];
|
|
25480
|
+
const decode$B = (attrs) => attrs?.themeColor;
|
|
25484
25481
|
const attrConfig$k = Object.freeze({
|
|
25485
25482
|
xmlName: "w:themeColor",
|
|
25486
25483
|
sdName: "themeColor",
|
|
25487
|
-
encode: encode$
|
|
25488
|
-
decode: decode$
|
|
25484
|
+
encode: encode$H,
|
|
25485
|
+
decode: decode$B
|
|
25489
25486
|
});
|
|
25490
|
-
const encode$
|
|
25491
|
-
const decode$
|
|
25487
|
+
const encode$G = (attributes) => attributes?.["w:themeTint"];
|
|
25488
|
+
const decode$A = (attrs) => attrs?.themeTint;
|
|
25492
25489
|
const attrConfig$j = Object.freeze({
|
|
25493
25490
|
xmlName: "w:themeTint",
|
|
25494
25491
|
sdName: "themeTint",
|
|
25495
|
-
encode: encode$
|
|
25496
|
-
decode: decode$
|
|
25492
|
+
encode: encode$G,
|
|
25493
|
+
decode: decode$A
|
|
25497
25494
|
});
|
|
25498
|
-
const encode$
|
|
25499
|
-
const decode$
|
|
25495
|
+
const encode$F = (attributes) => attributes?.["w:themeShade"];
|
|
25496
|
+
const decode$z = (attrs) => attrs?.themeShade;
|
|
25500
25497
|
const attrConfig$i = Object.freeze({
|
|
25501
25498
|
xmlName: "w:themeShade",
|
|
25502
25499
|
sdName: "themeShade",
|
|
25503
|
-
encode: encode$
|
|
25504
|
-
decode: decode$
|
|
25500
|
+
encode: encode$F,
|
|
25501
|
+
decode: decode$z
|
|
25505
25502
|
});
|
|
25506
|
-
const validXmlAttributes$
|
|
25507
|
-
const XML_NODE_NAME$
|
|
25503
|
+
const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
25504
|
+
const XML_NODE_NAME$m = "w:color";
|
|
25508
25505
|
const SD_ATTR_KEY$a = "color";
|
|
25509
|
-
const encode$
|
|
25506
|
+
const encode$E = (params, encodedAttrs = {}) => {
|
|
25510
25507
|
const { nodes } = params;
|
|
25511
25508
|
const node = nodes?.[0];
|
|
25512
25509
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25521,63 +25518,63 @@ const encode$D = (params, encodedAttrs = {}) => {
|
|
|
25521
25518
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25522
25519
|
return {
|
|
25523
25520
|
type: "attr",
|
|
25524
|
-
xmlName: XML_NODE_NAME$
|
|
25521
|
+
xmlName: XML_NODE_NAME$m,
|
|
25525
25522
|
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25526
25523
|
attributes
|
|
25527
25524
|
};
|
|
25528
25525
|
};
|
|
25529
|
-
const config$
|
|
25530
|
-
xmlName: XML_NODE_NAME$
|
|
25526
|
+
const config$k = {
|
|
25527
|
+
xmlName: XML_NODE_NAME$m,
|
|
25531
25528
|
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25532
25529
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25533
|
-
encode: encode$
|
|
25534
|
-
attributes: validXmlAttributes$
|
|
25530
|
+
encode: encode$E,
|
|
25531
|
+
attributes: validXmlAttributes$f
|
|
25535
25532
|
};
|
|
25536
|
-
const translator$
|
|
25537
|
-
const encode$
|
|
25538
|
-
const decode$
|
|
25533
|
+
const translator$_ = NodeTranslator.from(config$k);
|
|
25534
|
+
const encode$D = (attributes) => attributes?.["w:eastAsia"];
|
|
25535
|
+
const decode$y = (attrs) => attrs?.eastAsia;
|
|
25539
25536
|
const attrConfig$h = Object.freeze({
|
|
25540
25537
|
xmlName: "w:eastAsia",
|
|
25541
25538
|
sdName: "eastAsia",
|
|
25542
|
-
encode: encode$
|
|
25543
|
-
decode: decode$
|
|
25539
|
+
encode: encode$D,
|
|
25540
|
+
decode: decode$y
|
|
25544
25541
|
});
|
|
25545
|
-
const encode$
|
|
25546
|
-
const decode$
|
|
25542
|
+
const encode$C = (attributes) => attributes?.["w:ascii"];
|
|
25543
|
+
const decode$x = (attrs) => attrs?.ascii;
|
|
25547
25544
|
const attrConfig$g = Object.freeze({
|
|
25548
25545
|
xmlName: "w:ascii",
|
|
25549
25546
|
sdName: "ascii",
|
|
25550
|
-
encode: encode$
|
|
25551
|
-
decode: decode$
|
|
25547
|
+
encode: encode$C,
|
|
25548
|
+
decode: decode$x
|
|
25552
25549
|
});
|
|
25553
|
-
const encode$
|
|
25554
|
-
const decode$
|
|
25550
|
+
const encode$B = (attributes) => attributes?.["w:hAnsi"];
|
|
25551
|
+
const decode$w = (attrs) => attrs?.hAnsi;
|
|
25555
25552
|
const attrConfig$f = Object.freeze({
|
|
25556
25553
|
xmlName: "w:hAnsi",
|
|
25557
25554
|
sdName: "hAnsi",
|
|
25558
|
-
encode: encode$
|
|
25559
|
-
decode: decode$
|
|
25555
|
+
encode: encode$B,
|
|
25556
|
+
decode: decode$w
|
|
25560
25557
|
});
|
|
25561
|
-
const encode$
|
|
25562
|
-
const decode$
|
|
25558
|
+
const encode$A = (attributes) => attributes?.["w:cs"];
|
|
25559
|
+
const decode$v = (attrs) => attrs?.cs;
|
|
25563
25560
|
const attrConfig$e = Object.freeze({
|
|
25564
25561
|
xmlName: "w:cs",
|
|
25565
25562
|
sdName: "cs",
|
|
25566
|
-
encode: encode$
|
|
25567
|
-
decode: decode$
|
|
25563
|
+
encode: encode$A,
|
|
25564
|
+
decode: decode$v
|
|
25568
25565
|
});
|
|
25569
|
-
const encode$
|
|
25570
|
-
const decode$
|
|
25566
|
+
const encode$z = (attributes) => attributes?.["w:val"];
|
|
25567
|
+
const decode$u = (attrs) => attrs?.value;
|
|
25571
25568
|
const attrConfig$d = Object.freeze({
|
|
25572
25569
|
xmlName: "w:val",
|
|
25573
25570
|
sdName: "value",
|
|
25574
|
-
encode: encode$
|
|
25575
|
-
decode: decode$
|
|
25571
|
+
encode: encode$z,
|
|
25572
|
+
decode: decode$u
|
|
25576
25573
|
});
|
|
25577
|
-
const validXmlAttributes$
|
|
25578
|
-
const XML_NODE_NAME$
|
|
25574
|
+
const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
|
|
25575
|
+
const XML_NODE_NAME$l = "w:rFonts";
|
|
25579
25576
|
const SD_ATTR_KEY$9 = "fontFamily";
|
|
25580
|
-
const encode$
|
|
25577
|
+
const encode$y = (params, encodedAttrs = {}) => {
|
|
25581
25578
|
const { nodes } = params;
|
|
25582
25579
|
const node = nodes?.[0];
|
|
25583
25580
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25603,120 +25600,120 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
25603
25600
|
if (attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25604
25601
|
return {
|
|
25605
25602
|
type: "attr",
|
|
25606
|
-
xmlName: XML_NODE_NAME$
|
|
25603
|
+
xmlName: XML_NODE_NAME$l,
|
|
25607
25604
|
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25608
25605
|
attributes
|
|
25609
25606
|
};
|
|
25610
25607
|
};
|
|
25611
|
-
const config$
|
|
25612
|
-
xmlName: XML_NODE_NAME$
|
|
25608
|
+
const config$j = {
|
|
25609
|
+
xmlName: XML_NODE_NAME$l,
|
|
25613
25610
|
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25614
25611
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25615
|
-
encode: encode$
|
|
25616
|
-
attributes: validXmlAttributes$
|
|
25612
|
+
encode: encode$y,
|
|
25613
|
+
attributes: validXmlAttributes$e
|
|
25617
25614
|
};
|
|
25618
|
-
const translator$
|
|
25619
|
-
const encode$
|
|
25620
|
-
const decode$
|
|
25615
|
+
const translator$Z = NodeTranslator.from(config$j);
|
|
25616
|
+
const encode$x = (attributes) => attributes?.["w:val"];
|
|
25617
|
+
const decode$t = (attrs) => attrs?.styleId;
|
|
25621
25618
|
const attrConfig$c = Object.freeze({
|
|
25622
25619
|
xmlName: "w:val",
|
|
25623
25620
|
sdName: "styleId",
|
|
25624
|
-
encode: encode$
|
|
25625
|
-
decode: decode$
|
|
25621
|
+
encode: encode$x,
|
|
25622
|
+
decode: decode$t
|
|
25626
25623
|
});
|
|
25627
|
-
const validXmlAttributes$
|
|
25628
|
-
const XML_NODE_NAME$
|
|
25624
|
+
const validXmlAttributes$d = [attrConfig$c];
|
|
25625
|
+
const XML_NODE_NAME$k = "w:rStyle";
|
|
25629
25626
|
const SD_ATTR_KEY$8 = "styleId";
|
|
25630
|
-
const encode$
|
|
25627
|
+
const encode$w = (params, encodedAttrs = {}) => {
|
|
25631
25628
|
const { nodes } = params;
|
|
25632
25629
|
const node = nodes?.[0];
|
|
25633
25630
|
const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
|
|
25634
25631
|
return {
|
|
25635
25632
|
type: "attr",
|
|
25636
|
-
xmlName: XML_NODE_NAME$
|
|
25633
|
+
xmlName: XML_NODE_NAME$k,
|
|
25637
25634
|
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25638
25635
|
attributes: { "w:val": value ?? null }
|
|
25639
25636
|
};
|
|
25640
25637
|
};
|
|
25641
|
-
const config$
|
|
25642
|
-
xmlName: XML_NODE_NAME$
|
|
25638
|
+
const config$i = {
|
|
25639
|
+
xmlName: XML_NODE_NAME$k,
|
|
25643
25640
|
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25644
25641
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25645
|
-
encode: encode$
|
|
25646
|
-
attributes: validXmlAttributes$
|
|
25642
|
+
encode: encode$w,
|
|
25643
|
+
attributes: validXmlAttributes$d
|
|
25647
25644
|
};
|
|
25648
|
-
const translator$
|
|
25649
|
-
const encode$
|
|
25650
|
-
const decode$
|
|
25645
|
+
const translator$Y = NodeTranslator.from(config$i);
|
|
25646
|
+
const encode$v = (attributes) => attributes?.["w:val"];
|
|
25647
|
+
const decode$s = (attrs) => attrs?.fontSize;
|
|
25651
25648
|
const attrConfig$b = Object.freeze({
|
|
25652
25649
|
xmlName: "w:val",
|
|
25653
25650
|
sdName: "fontSize",
|
|
25654
|
-
encode: encode$
|
|
25655
|
-
decode: decode$
|
|
25651
|
+
encode: encode$v,
|
|
25652
|
+
decode: decode$s
|
|
25656
25653
|
});
|
|
25657
|
-
const validXmlAttributes$
|
|
25658
|
-
const XML_NODE_NAME$
|
|
25654
|
+
const validXmlAttributes$c = [attrConfig$b];
|
|
25655
|
+
const XML_NODE_NAME$j = "w:sz";
|
|
25659
25656
|
const SD_ATTR_KEY$7 = "fontSize";
|
|
25660
|
-
const encode$
|
|
25657
|
+
const encode$u = (params, encodedAttrs = {}) => {
|
|
25661
25658
|
const { nodes } = params;
|
|
25662
25659
|
const node = nodes?.[0];
|
|
25663
25660
|
const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
|
|
25664
25661
|
return {
|
|
25665
25662
|
type: "attr",
|
|
25666
|
-
xmlName: XML_NODE_NAME$
|
|
25663
|
+
xmlName: XML_NODE_NAME$j,
|
|
25667
25664
|
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25668
25665
|
attributes: { "w:val": value ?? null }
|
|
25669
25666
|
};
|
|
25670
25667
|
};
|
|
25671
|
-
const config$
|
|
25672
|
-
xmlName: XML_NODE_NAME$
|
|
25668
|
+
const config$h = {
|
|
25669
|
+
xmlName: XML_NODE_NAME$j,
|
|
25673
25670
|
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25674
25671
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25675
|
-
encode: encode$
|
|
25676
|
-
attributes: validXmlAttributes$
|
|
25672
|
+
encode: encode$u,
|
|
25673
|
+
attributes: validXmlAttributes$c
|
|
25677
25674
|
};
|
|
25678
|
-
const translator$
|
|
25679
|
-
const encode$
|
|
25680
|
-
const decode$
|
|
25675
|
+
const translator$X = NodeTranslator.from(config$h);
|
|
25676
|
+
const encode$t = (attributes) => attributes?.["w:val"];
|
|
25677
|
+
const decode$r = (attrs) => attrs?.fontSizeCs;
|
|
25681
25678
|
const attrConfig$a = Object.freeze({
|
|
25682
25679
|
xmlName: "w:val",
|
|
25683
25680
|
sdName: "fontSizeCs",
|
|
25684
|
-
encode: encode$
|
|
25685
|
-
decode: decode$
|
|
25681
|
+
encode: encode$t,
|
|
25682
|
+
decode: decode$r
|
|
25686
25683
|
});
|
|
25687
|
-
const validXmlAttributes$
|
|
25688
|
-
const XML_NODE_NAME$
|
|
25684
|
+
const validXmlAttributes$b = [attrConfig$a];
|
|
25685
|
+
const XML_NODE_NAME$i = "w:szCs";
|
|
25689
25686
|
const SD_ATTR_KEY$6 = "fontSizeCs";
|
|
25690
|
-
const encode$
|
|
25687
|
+
const encode$s = (params, encodedAttrs = {}) => {
|
|
25691
25688
|
const { nodes } = params;
|
|
25692
25689
|
const node = nodes?.[0];
|
|
25693
25690
|
const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
|
|
25694
25691
|
return {
|
|
25695
25692
|
type: "attr",
|
|
25696
|
-
xmlName: XML_NODE_NAME$
|
|
25693
|
+
xmlName: XML_NODE_NAME$i,
|
|
25697
25694
|
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25698
25695
|
attributes: { "w:val": value ?? null }
|
|
25699
25696
|
};
|
|
25700
25697
|
};
|
|
25701
|
-
const config$
|
|
25702
|
-
xmlName: XML_NODE_NAME$
|
|
25698
|
+
const config$g = {
|
|
25699
|
+
xmlName: XML_NODE_NAME$i,
|
|
25703
25700
|
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25704
25701
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25705
|
-
encode: encode$
|
|
25706
|
-
attributes: validXmlAttributes$
|
|
25702
|
+
encode: encode$s,
|
|
25703
|
+
attributes: validXmlAttributes$b
|
|
25707
25704
|
};
|
|
25708
|
-
const translator$
|
|
25705
|
+
const translator$W = NodeTranslator.from(config$g);
|
|
25709
25706
|
const runPropertyTranslators = Object.freeze({
|
|
25710
|
-
"w:b": translator$
|
|
25711
|
-
"w:i": translator$
|
|
25712
|
-
"w:u": translator
|
|
25713
|
-
"w:strike": translator
|
|
25714
|
-
"w:color": translator$
|
|
25715
|
-
"w:highlight": translator$
|
|
25716
|
-
"w:rFonts": translator$
|
|
25717
|
-
"w:rStyle": translator$
|
|
25718
|
-
"w:sz": translator$
|
|
25719
|
-
"w:szCs": translator$
|
|
25707
|
+
"w:b": translator$12,
|
|
25708
|
+
"w:i": translator$11,
|
|
25709
|
+
"w:u": translator$10,
|
|
25710
|
+
"w:strike": translator$$,
|
|
25711
|
+
"w:color": translator$_,
|
|
25712
|
+
"w:highlight": translator$15,
|
|
25713
|
+
"w:rFonts": translator$Z,
|
|
25714
|
+
"w:rStyle": translator$Y,
|
|
25715
|
+
"w:sz": translator$X,
|
|
25716
|
+
"w:szCs": translator$W
|
|
25720
25717
|
});
|
|
25721
25718
|
const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
|
|
25722
25719
|
const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
|
|
@@ -25730,9 +25727,9 @@ const toRunPropertyEntry = (candidate) => {
|
|
|
25730
25727
|
attributes: { ...candidate.attributes || {} }
|
|
25731
25728
|
};
|
|
25732
25729
|
};
|
|
25733
|
-
const XML_NODE_NAME$
|
|
25730
|
+
const XML_NODE_NAME$h = "w:rPr";
|
|
25734
25731
|
const SD_ATTR_KEY$5 = "runProperties";
|
|
25735
|
-
const encode$
|
|
25732
|
+
const encode$r = (params) => {
|
|
25736
25733
|
const { nodes } = params;
|
|
25737
25734
|
const node = nodes?.[0] || {};
|
|
25738
25735
|
const contents = Array.isArray(node.elements) ? node.elements : [];
|
|
@@ -25766,16 +25763,16 @@ const encode$q = (params) => {
|
|
|
25766
25763
|
attributes: runPropsArray
|
|
25767
25764
|
};
|
|
25768
25765
|
};
|
|
25769
|
-
const config$
|
|
25770
|
-
xmlName: XML_NODE_NAME$
|
|
25766
|
+
const config$f = {
|
|
25767
|
+
xmlName: XML_NODE_NAME$h,
|
|
25771
25768
|
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
25772
25769
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25773
|
-
encode: encode$
|
|
25770
|
+
encode: encode$r
|
|
25774
25771
|
};
|
|
25775
|
-
const translator$
|
|
25772
|
+
const translator$V = NodeTranslator.from(config$f);
|
|
25776
25773
|
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;
|
|
25777
25774
|
const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
|
|
25778
|
-
const collectRunProperties = (params, rPrNode, translator2 = translator$
|
|
25775
|
+
const collectRunProperties = (params, rPrNode, translator2 = translator$V) => {
|
|
25779
25776
|
if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
|
|
25780
25777
|
const result = translator2.encode({ ...params, nodes: [rPrNode] }) || {};
|
|
25781
25778
|
let entries = [];
|
|
@@ -26237,46 +26234,46 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
|
|
|
26237
26234
|
}
|
|
26238
26235
|
return runs;
|
|
26239
26236
|
};
|
|
26240
|
-
const encode$
|
|
26237
|
+
const encode$q = (attributes) => {
|
|
26241
26238
|
return attributes["w:rsidR"];
|
|
26242
26239
|
};
|
|
26243
|
-
const decode$
|
|
26240
|
+
const decode$q = (attrs) => {
|
|
26244
26241
|
return attrs.rsidR;
|
|
26245
26242
|
};
|
|
26246
26243
|
const attrConfig$9 = Object.freeze({
|
|
26247
26244
|
xmlName: "w:rsidR",
|
|
26248
26245
|
sdName: "rsidR",
|
|
26249
|
-
encode: encode$
|
|
26250
|
-
decode: decode$
|
|
26246
|
+
encode: encode$q,
|
|
26247
|
+
decode: decode$q
|
|
26251
26248
|
});
|
|
26252
|
-
const encode$
|
|
26249
|
+
const encode$p = (attributes) => {
|
|
26253
26250
|
return attributes["w:rsidRPr"];
|
|
26254
26251
|
};
|
|
26255
|
-
const decode$
|
|
26252
|
+
const decode$p = (attrs) => {
|
|
26256
26253
|
return attrs.rsidRPr;
|
|
26257
26254
|
};
|
|
26258
26255
|
const attrConfig$8 = Object.freeze({
|
|
26259
26256
|
xmlName: "w:rsidRPr",
|
|
26260
26257
|
sdName: "rsidRPr",
|
|
26261
|
-
encode: encode$
|
|
26262
|
-
decode: decode$
|
|
26258
|
+
encode: encode$p,
|
|
26259
|
+
decode: decode$p
|
|
26263
26260
|
});
|
|
26264
|
-
const encode$
|
|
26261
|
+
const encode$o = (attributes) => {
|
|
26265
26262
|
return attributes["w:rsidDel"];
|
|
26266
26263
|
};
|
|
26267
|
-
const decode$
|
|
26264
|
+
const decode$o = (attrs) => {
|
|
26268
26265
|
return attrs.rsidDel;
|
|
26269
26266
|
};
|
|
26270
26267
|
const attrConfig$7 = Object.freeze({
|
|
26271
26268
|
xmlName: "w:rsidDel",
|
|
26272
26269
|
sdName: "rsidDel",
|
|
26273
|
-
encode: encode$
|
|
26274
|
-
decode: decode$
|
|
26270
|
+
encode: encode$o,
|
|
26271
|
+
decode: decode$o
|
|
26275
26272
|
});
|
|
26276
|
-
const validXmlAttributes$
|
|
26277
|
-
const XML_NODE_NAME$
|
|
26273
|
+
const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
|
|
26274
|
+
const XML_NODE_NAME$g = "w:r";
|
|
26278
26275
|
const SD_KEY_NAME = "run";
|
|
26279
|
-
const encode$
|
|
26276
|
+
const encode$n = (params, encodedAttrs = {}) => {
|
|
26280
26277
|
const { nodes = [], nodeListHandler } = params || {};
|
|
26281
26278
|
const runNode = nodes[0];
|
|
26282
26279
|
if (!runNode) return void 0;
|
|
@@ -26324,7 +26321,7 @@ const encode$m = (params, encodedAttrs = {}) => {
|
|
|
26324
26321
|
}
|
|
26325
26322
|
return runNodeResult;
|
|
26326
26323
|
};
|
|
26327
|
-
const decode$
|
|
26324
|
+
const decode$n = (params, decodedAttrs = {}) => {
|
|
26328
26325
|
const { node } = params || {};
|
|
26329
26326
|
if (!node) return void 0;
|
|
26330
26327
|
const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
|
|
@@ -26381,7 +26378,7 @@ const decode$m = (params, decodedAttrs = {}) => {
|
|
|
26381
26378
|
runs.push(trackedClone);
|
|
26382
26379
|
return;
|
|
26383
26380
|
}
|
|
26384
|
-
const runWrapper = { name: XML_NODE_NAME$
|
|
26381
|
+
const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
|
|
26385
26382
|
applyBaseRunProps(runWrapper);
|
|
26386
26383
|
if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
|
|
26387
26384
|
runWrapper.elements.push(cloneXmlNode(child));
|
|
@@ -26389,7 +26386,7 @@ const decode$m = (params, decodedAttrs = {}) => {
|
|
|
26389
26386
|
});
|
|
26390
26387
|
const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
|
|
26391
26388
|
if (!trackedRuns.length) {
|
|
26392
|
-
const emptyRun = { name: XML_NODE_NAME$
|
|
26389
|
+
const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
|
|
26393
26390
|
applyBaseRunProps(emptyRun);
|
|
26394
26391
|
trackedRuns.push(emptyRun);
|
|
26395
26392
|
}
|
|
@@ -26403,15 +26400,15 @@ const decode$m = (params, decodedAttrs = {}) => {
|
|
|
26403
26400
|
}
|
|
26404
26401
|
return trackedRuns;
|
|
26405
26402
|
};
|
|
26406
|
-
const config$
|
|
26407
|
-
xmlName: XML_NODE_NAME$
|
|
26403
|
+
const config$e = {
|
|
26404
|
+
xmlName: XML_NODE_NAME$g,
|
|
26408
26405
|
sdNodeOrKeyName: SD_KEY_NAME,
|
|
26409
26406
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26410
|
-
encode: encode$
|
|
26411
|
-
decode: decode$
|
|
26412
|
-
attributes: validXmlAttributes$
|
|
26407
|
+
encode: encode$n,
|
|
26408
|
+
decode: decode$n,
|
|
26409
|
+
attributes: validXmlAttributes$a
|
|
26413
26410
|
};
|
|
26414
|
-
const translator$
|
|
26411
|
+
const translator$U = NodeTranslator.from(config$e);
|
|
26415
26412
|
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
26416
26413
|
handlerName,
|
|
26417
26414
|
handler: (params) => {
|
|
@@ -26585,13 +26582,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
|
26585
26582
|
}
|
|
26586
26583
|
return table;
|
|
26587
26584
|
}
|
|
26588
|
-
const translator$
|
|
26585
|
+
const translator$T = NodeTranslator.from({
|
|
26589
26586
|
xmlName: "w:cantSplit",
|
|
26590
26587
|
sdNodeOrKeyName: "cantSplit",
|
|
26591
26588
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26592
26589
|
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
26593
26590
|
});
|
|
26594
|
-
const translator$
|
|
26591
|
+
const translator$S = NodeTranslator.from({
|
|
26595
26592
|
xmlName: "w:cnfStyle",
|
|
26596
26593
|
sdNodeOrKeyName: "cnfStyle",
|
|
26597
26594
|
attributes: [
|
|
@@ -26617,8 +26614,8 @@ const translator$R = NodeTranslator.from({
|
|
|
26617
26614
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26618
26615
|
}
|
|
26619
26616
|
});
|
|
26620
|
-
const translator$
|
|
26621
|
-
const translator$
|
|
26617
|
+
const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
26618
|
+
const translator$Q = NodeTranslator.from(
|
|
26622
26619
|
createSingleAttrPropertyHandler(
|
|
26623
26620
|
"w:gridAfter",
|
|
26624
26621
|
null,
|
|
@@ -26627,7 +26624,7 @@ const translator$P = NodeTranslator.from(
|
|
|
26627
26624
|
(v2) => integerToString(v2)
|
|
26628
26625
|
)
|
|
26629
26626
|
);
|
|
26630
|
-
const translator$
|
|
26627
|
+
const translator$P = NodeTranslator.from(
|
|
26631
26628
|
createSingleAttrPropertyHandler(
|
|
26632
26629
|
"w:gridBefore",
|
|
26633
26630
|
null,
|
|
@@ -26636,21 +26633,21 @@ const translator$O = NodeTranslator.from(
|
|
|
26636
26633
|
(v2) => integerToString(v2)
|
|
26637
26634
|
)
|
|
26638
26635
|
);
|
|
26639
|
-
const translator$
|
|
26636
|
+
const translator$O = NodeTranslator.from({
|
|
26640
26637
|
xmlName: "w:hidden",
|
|
26641
26638
|
sdNodeOrKeyName: "hidden",
|
|
26642
26639
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26643
26640
|
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
26644
26641
|
});
|
|
26645
|
-
const translator$
|
|
26646
|
-
const translator$
|
|
26647
|
-
const translator$
|
|
26642
|
+
const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
26643
|
+
const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
26644
|
+
const translator$L = NodeTranslator.from({
|
|
26648
26645
|
xmlName: "w:tblHeader",
|
|
26649
26646
|
sdNodeOrKeyName: "repeatHeader",
|
|
26650
26647
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26651
26648
|
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
26652
26649
|
});
|
|
26653
|
-
const translator$
|
|
26650
|
+
const translator$K = NodeTranslator.from({
|
|
26654
26651
|
xmlName: "w:trHeight",
|
|
26655
26652
|
sdNodeOrKeyName: "rowHeight",
|
|
26656
26653
|
encode: ({ nodes }) => {
|
|
@@ -26677,11 +26674,11 @@ const translator$J = NodeTranslator.from({
|
|
|
26677
26674
|
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
26678
26675
|
}
|
|
26679
26676
|
});
|
|
26680
|
-
const translator$
|
|
26681
|
-
const translator$
|
|
26682
|
-
const XML_NODE_NAME$
|
|
26677
|
+
const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
26678
|
+
const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
26679
|
+
const XML_NODE_NAME$f = "w:trPr";
|
|
26683
26680
|
const SD_ATTR_KEY$4 = "tableRowProperties";
|
|
26684
|
-
const encode$
|
|
26681
|
+
const encode$m = (params) => {
|
|
26685
26682
|
const { nodes } = params;
|
|
26686
26683
|
const node = nodes[0];
|
|
26687
26684
|
let attributes = {
|
|
@@ -26695,12 +26692,12 @@ const encode$l = (params) => {
|
|
|
26695
26692
|
};
|
|
26696
26693
|
return {
|
|
26697
26694
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
26698
|
-
xmlName: XML_NODE_NAME$
|
|
26695
|
+
xmlName: XML_NODE_NAME$f,
|
|
26699
26696
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
26700
26697
|
attributes
|
|
26701
26698
|
};
|
|
26702
26699
|
};
|
|
26703
|
-
const decode$
|
|
26700
|
+
const decode$m = (params) => {
|
|
26704
26701
|
const { tableRowProperties = {} } = params.node.attrs || {};
|
|
26705
26702
|
const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
|
|
26706
26703
|
const newNode = {
|
|
@@ -26712,6 +26709,7 @@ const decode$l = (params) => {
|
|
|
26712
26709
|
return newNode;
|
|
26713
26710
|
};
|
|
26714
26711
|
const propertyTranslators$3 = [
|
|
26712
|
+
translator$T,
|
|
26715
26713
|
translator$S,
|
|
26716
26714
|
translator$R,
|
|
26717
26715
|
translator$Q,
|
|
@@ -26722,8 +26720,7 @@ const propertyTranslators$3 = [
|
|
|
26722
26720
|
translator$L,
|
|
26723
26721
|
translator$K,
|
|
26724
26722
|
translator$J,
|
|
26725
|
-
translator$I
|
|
26726
|
-
translator$H
|
|
26723
|
+
translator$I
|
|
26727
26724
|
];
|
|
26728
26725
|
const propertyTranslatorsByXmlName$2 = {};
|
|
26729
26726
|
propertyTranslators$3.forEach((translator2) => {
|
|
@@ -26733,25 +26730,25 @@ const propertyTranslatorsBySdName$2 = {};
|
|
|
26733
26730
|
propertyTranslators$3.forEach((translator2) => {
|
|
26734
26731
|
propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
|
|
26735
26732
|
});
|
|
26736
|
-
const config$
|
|
26737
|
-
xmlName: XML_NODE_NAME$
|
|
26733
|
+
const config$d = {
|
|
26734
|
+
xmlName: XML_NODE_NAME$f,
|
|
26738
26735
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
26739
26736
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
26740
|
-
encode: encode$
|
|
26741
|
-
decode: decode$
|
|
26737
|
+
encode: encode$m,
|
|
26738
|
+
decode: decode$m
|
|
26742
26739
|
};
|
|
26743
|
-
const translator$
|
|
26744
|
-
const XML_NODE_NAME$
|
|
26745
|
-
const SD_NODE_NAME$
|
|
26746
|
-
const validXmlAttributes$
|
|
26740
|
+
const translator$H = NodeTranslator.from(config$d);
|
|
26741
|
+
const XML_NODE_NAME$e = "w:tr";
|
|
26742
|
+
const SD_NODE_NAME$a = "tableRow";
|
|
26743
|
+
const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
26747
26744
|
(xmlName) => createAttributeHandler(xmlName)
|
|
26748
26745
|
);
|
|
26749
|
-
const encode$
|
|
26746
|
+
const encode$l = (params, encodedAttrs) => {
|
|
26750
26747
|
const { row } = params.extraParams;
|
|
26751
26748
|
let tableRowProperties = {};
|
|
26752
26749
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
26753
26750
|
if (tPr) {
|
|
26754
|
-
({ attributes: tableRowProperties } = translator$
|
|
26751
|
+
({ attributes: tableRowProperties } = translator$H.encode({
|
|
26755
26752
|
...params,
|
|
26756
26753
|
nodes: [tPr]
|
|
26757
26754
|
}));
|
|
@@ -26764,7 +26761,7 @@ const encode$k = (params, encodedAttrs) => {
|
|
|
26764
26761
|
let currentColumnIndex = 0;
|
|
26765
26762
|
const content = cellNodes?.map((n) => {
|
|
26766
26763
|
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
26767
|
-
const result = translator$
|
|
26764
|
+
const result = translator$8.encode({
|
|
26768
26765
|
...params,
|
|
26769
26766
|
extraParams: {
|
|
26770
26767
|
...params.extraParams,
|
|
@@ -26786,7 +26783,7 @@ const encode$k = (params, encodedAttrs) => {
|
|
|
26786
26783
|
};
|
|
26787
26784
|
return newNode;
|
|
26788
26785
|
};
|
|
26789
|
-
const decode$
|
|
26786
|
+
const decode$l = (params, decodedAttrs) => {
|
|
26790
26787
|
const { node } = params;
|
|
26791
26788
|
const elements = translateChildNodes(params);
|
|
26792
26789
|
if (node.attrs?.tableRowProperties) {
|
|
@@ -26798,7 +26795,7 @@ const decode$k = (params, decodedAttrs) => {
|
|
|
26798
26795
|
}
|
|
26799
26796
|
}
|
|
26800
26797
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
26801
|
-
const trPr = translator$
|
|
26798
|
+
const trPr = translator$H.decode({
|
|
26802
26799
|
...params,
|
|
26803
26800
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
26804
26801
|
});
|
|
@@ -26810,22 +26807,22 @@ const decode$k = (params, decodedAttrs) => {
|
|
|
26810
26807
|
elements
|
|
26811
26808
|
};
|
|
26812
26809
|
};
|
|
26813
|
-
const config$
|
|
26814
|
-
xmlName: XML_NODE_NAME$
|
|
26815
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
26810
|
+
const config$c = {
|
|
26811
|
+
xmlName: XML_NODE_NAME$e,
|
|
26812
|
+
sdNodeOrKeyName: SD_NODE_NAME$a,
|
|
26816
26813
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26817
|
-
encode: encode$
|
|
26818
|
-
decode: decode$
|
|
26819
|
-
attributes: validXmlAttributes$
|
|
26814
|
+
encode: encode$l,
|
|
26815
|
+
decode: decode$l,
|
|
26816
|
+
attributes: validXmlAttributes$9
|
|
26820
26817
|
};
|
|
26821
|
-
const translator$
|
|
26822
|
-
const translator$
|
|
26818
|
+
const translator$G = NodeTranslator.from(config$c);
|
|
26819
|
+
const translator$F = NodeTranslator.from({
|
|
26823
26820
|
xmlName: "w:bidiVisual",
|
|
26824
26821
|
sdNodeOrKeyName: "rightToLeft",
|
|
26825
26822
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26826
26823
|
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
26827
26824
|
});
|
|
26828
|
-
const translator$
|
|
26825
|
+
const translator$E = NodeTranslator.from({
|
|
26829
26826
|
xmlName: "w:shd",
|
|
26830
26827
|
sdNodeOrKeyName: "shading",
|
|
26831
26828
|
attributes: [
|
|
@@ -26847,11 +26844,11 @@ const translator$D = NodeTranslator.from({
|
|
|
26847
26844
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26848
26845
|
}
|
|
26849
26846
|
});
|
|
26850
|
-
const translator$
|
|
26851
|
-
const translator$
|
|
26852
|
-
const translator$
|
|
26853
|
-
const translator$
|
|
26854
|
-
const translator$
|
|
26847
|
+
const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
26848
|
+
const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
26849
|
+
const translator$B = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
26850
|
+
const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
26851
|
+
const translator$z = NodeTranslator.from({
|
|
26855
26852
|
xmlName: "w:tblLook",
|
|
26856
26853
|
sdNodeOrKeyName: "tblLook",
|
|
26857
26854
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
@@ -26863,16 +26860,16 @@ const translator$y = NodeTranslator.from({
|
|
|
26863
26860
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26864
26861
|
}
|
|
26865
26862
|
});
|
|
26866
|
-
const translator$
|
|
26867
|
-
const translator$
|
|
26868
|
-
const translator$
|
|
26863
|
+
const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
26864
|
+
const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
26865
|
+
const translator$w = NodeTranslator.from(
|
|
26869
26866
|
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
26870
26867
|
);
|
|
26871
|
-
const translator$
|
|
26868
|
+
const translator$v = NodeTranslator.from(
|
|
26872
26869
|
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
26873
26870
|
);
|
|
26874
|
-
const translator$
|
|
26875
|
-
const translator$
|
|
26871
|
+
const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
26872
|
+
const translator$t = NodeTranslator.from({
|
|
26876
26873
|
xmlName: "w:tblpPr",
|
|
26877
26874
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
26878
26875
|
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))),
|
|
@@ -26884,29 +26881,29 @@ const translator$s = NodeTranslator.from({
|
|
|
26884
26881
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26885
26882
|
}
|
|
26886
26883
|
});
|
|
26887
|
-
const translator$
|
|
26888
|
-
const translator$
|
|
26889
|
-
const translator$
|
|
26890
|
-
const translator$
|
|
26891
|
-
const translator$
|
|
26892
|
-
const translator$
|
|
26893
|
-
const translator$
|
|
26894
|
-
const translator$
|
|
26895
|
-
const translator$
|
|
26896
|
-
const translator$
|
|
26897
|
-
const translator$
|
|
26898
|
-
const translator$
|
|
26899
|
-
const translator$
|
|
26900
|
-
const translator$
|
|
26901
|
-
const XML_NODE_NAME$
|
|
26884
|
+
const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
26885
|
+
const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
26886
|
+
const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
26887
|
+
const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
26888
|
+
const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
26889
|
+
const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
26890
|
+
const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
26891
|
+
const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
26892
|
+
const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
26893
|
+
const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
26894
|
+
const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
26895
|
+
const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
26896
|
+
const translator$g = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
26897
|
+
const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
26898
|
+
const XML_NODE_NAME$d = "w:tblBorders";
|
|
26902
26899
|
const SD_ATTR_KEY$3 = "borders";
|
|
26903
|
-
const encode$
|
|
26900
|
+
const encode$k = (params) => {
|
|
26904
26901
|
const { nodes } = params;
|
|
26905
26902
|
const node = nodes[0];
|
|
26906
26903
|
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
26907
26904
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
26908
26905
|
};
|
|
26909
|
-
const decode$
|
|
26906
|
+
const decode$k = (params) => {
|
|
26910
26907
|
const { borders = {} } = params.node.attrs || {};
|
|
26911
26908
|
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
26912
26909
|
const newNode = {
|
|
@@ -26918,14 +26915,14 @@ const decode$j = (params) => {
|
|
|
26918
26915
|
return newNode;
|
|
26919
26916
|
};
|
|
26920
26917
|
const propertyTranslators$2 = [
|
|
26921
|
-
translator$
|
|
26922
|
-
translator$
|
|
26918
|
+
translator$s,
|
|
26919
|
+
translator$q,
|
|
26920
|
+
translator$o,
|
|
26923
26921
|
translator$n,
|
|
26924
26922
|
translator$m,
|
|
26925
|
-
translator$
|
|
26926
|
-
translator$
|
|
26927
|
-
translator$
|
|
26928
|
-
translator$f
|
|
26923
|
+
translator$k,
|
|
26924
|
+
translator$i,
|
|
26925
|
+
translator$g
|
|
26929
26926
|
];
|
|
26930
26927
|
const tblBordersTranslatorsByXmlName = {};
|
|
26931
26928
|
const tblBordersTranslatorsBySdName = {};
|
|
@@ -26933,27 +26930,27 @@ propertyTranslators$2.forEach((translator2) => {
|
|
|
26933
26930
|
tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
26934
26931
|
tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
26935
26932
|
});
|
|
26936
|
-
const translator$
|
|
26937
|
-
xmlName: XML_NODE_NAME$
|
|
26933
|
+
const translator$e = NodeTranslator.from({
|
|
26934
|
+
xmlName: XML_NODE_NAME$d,
|
|
26938
26935
|
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
26939
26936
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26940
26937
|
attributes: [],
|
|
26941
|
-
encode: encode$
|
|
26942
|
-
decode: decode$
|
|
26938
|
+
encode: encode$k,
|
|
26939
|
+
decode: decode$k
|
|
26943
26940
|
});
|
|
26944
|
-
const XML_NODE_NAME$
|
|
26941
|
+
const XML_NODE_NAME$c = "w:tblCellMar";
|
|
26945
26942
|
const SD_ATTR_KEY$2 = "cellMargins";
|
|
26946
|
-
const encode$
|
|
26943
|
+
const encode$j = (params) => {
|
|
26947
26944
|
const { nodes } = params;
|
|
26948
26945
|
const node = nodes[0];
|
|
26949
26946
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
26950
26947
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
26951
26948
|
};
|
|
26952
|
-
const decode$
|
|
26949
|
+
const decode$j = (params) => {
|
|
26953
26950
|
const { cellMargins = {} } = params.node.attrs || {};
|
|
26954
26951
|
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
26955
26952
|
const newNode = {
|
|
26956
|
-
name: XML_NODE_NAME$
|
|
26953
|
+
name: XML_NODE_NAME$c,
|
|
26957
26954
|
type: "element",
|
|
26958
26955
|
attributes: {},
|
|
26959
26956
|
elements
|
|
@@ -26961,12 +26958,12 @@ const decode$i = (params) => {
|
|
|
26961
26958
|
return newNode;
|
|
26962
26959
|
};
|
|
26963
26960
|
const propertyTranslators$1 = [
|
|
26964
|
-
translator$
|
|
26965
|
-
translator$
|
|
26966
|
-
translator$
|
|
26967
|
-
translator$
|
|
26968
|
-
translator$
|
|
26969
|
-
translator$
|
|
26961
|
+
translator$r,
|
|
26962
|
+
translator$p,
|
|
26963
|
+
translator$l,
|
|
26964
|
+
translator$j,
|
|
26965
|
+
translator$h,
|
|
26966
|
+
translator$f
|
|
26970
26967
|
];
|
|
26971
26968
|
const propertyTranslatorsByXmlName$1 = {};
|
|
26972
26969
|
const propertyTranslatorsBySdName$1 = {};
|
|
@@ -26974,27 +26971,27 @@ propertyTranslators$1.forEach((translator2) => {
|
|
|
26974
26971
|
propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
|
|
26975
26972
|
propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
|
|
26976
26973
|
});
|
|
26977
|
-
const translator$
|
|
26978
|
-
xmlName: XML_NODE_NAME$
|
|
26974
|
+
const translator$d = NodeTranslator.from({
|
|
26975
|
+
xmlName: XML_NODE_NAME$c,
|
|
26979
26976
|
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
26980
26977
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26981
26978
|
attributes: [],
|
|
26982
|
-
encode: encode$
|
|
26983
|
-
decode: decode$
|
|
26979
|
+
encode: encode$j,
|
|
26980
|
+
decode: decode$j
|
|
26984
26981
|
});
|
|
26985
|
-
const XML_NODE_NAME$
|
|
26982
|
+
const XML_NODE_NAME$b = "w:tblPr";
|
|
26986
26983
|
const SD_ATTR_KEY$1 = "tableProperties";
|
|
26987
|
-
const encode$
|
|
26984
|
+
const encode$i = (params) => {
|
|
26988
26985
|
const { nodes } = params;
|
|
26989
26986
|
const node = nodes[0];
|
|
26990
26987
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
|
|
26991
26988
|
return {
|
|
26992
|
-
xmlName: XML_NODE_NAME$
|
|
26989
|
+
xmlName: XML_NODE_NAME$b,
|
|
26993
26990
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
26994
26991
|
attributes
|
|
26995
26992
|
};
|
|
26996
26993
|
};
|
|
26997
|
-
const decode$
|
|
26994
|
+
const decode$i = (params) => {
|
|
26998
26995
|
const { tableProperties = {} } = params.node.attrs || {};
|
|
26999
26996
|
const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
|
|
27000
26997
|
const newNode = {
|
|
@@ -27006,11 +27003,12 @@ const decode$h = (params) => {
|
|
|
27006
27003
|
return newNode;
|
|
27007
27004
|
};
|
|
27008
27005
|
const propertyTranslators = [
|
|
27006
|
+
translator$F,
|
|
27007
|
+
translator$N,
|
|
27009
27008
|
translator$E,
|
|
27010
|
-
translator$M,
|
|
27011
27009
|
translator$D,
|
|
27010
|
+
translator$M,
|
|
27012
27011
|
translator$C,
|
|
27013
|
-
translator$L,
|
|
27014
27012
|
translator$B,
|
|
27015
27013
|
translator$A,
|
|
27016
27014
|
translator$z,
|
|
@@ -27020,9 +27018,8 @@ const propertyTranslators = [
|
|
|
27020
27018
|
translator$v,
|
|
27021
27019
|
translator$u,
|
|
27022
27020
|
translator$t,
|
|
27023
|
-
translator$
|
|
27024
|
-
translator$d
|
|
27025
|
-
translator$c
|
|
27021
|
+
translator$e,
|
|
27022
|
+
translator$d
|
|
27026
27023
|
];
|
|
27027
27024
|
const propertyTranslatorsByXmlName = {};
|
|
27028
27025
|
const propertyTranslatorsBySdName = {};
|
|
@@ -27030,14 +27027,14 @@ propertyTranslators.forEach((translator2) => {
|
|
|
27030
27027
|
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
27031
27028
|
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
27032
27029
|
});
|
|
27033
|
-
const config$
|
|
27034
|
-
xmlName: XML_NODE_NAME$
|
|
27030
|
+
const config$b = {
|
|
27031
|
+
xmlName: XML_NODE_NAME$b,
|
|
27035
27032
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
27036
|
-
encode: encode$
|
|
27037
|
-
decode: decode$
|
|
27033
|
+
encode: encode$i,
|
|
27034
|
+
decode: decode$i
|
|
27038
27035
|
};
|
|
27039
|
-
const translator$
|
|
27040
|
-
const translator$
|
|
27036
|
+
const translator$c = NodeTranslator.from(config$b);
|
|
27037
|
+
const translator$b = NodeTranslator.from(
|
|
27041
27038
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
27042
27039
|
);
|
|
27043
27040
|
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
@@ -27087,20 +27084,20 @@ const resolveFallbackColumnWidthTwips = (params, totalColumns, cellMinWidthTwips
|
|
|
27087
27084
|
}
|
|
27088
27085
|
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
27089
27086
|
};
|
|
27090
|
-
const XML_NODE_NAME$
|
|
27087
|
+
const XML_NODE_NAME$a = "w:tblGrid";
|
|
27091
27088
|
const SD_ATTR_KEY = "grid";
|
|
27092
27089
|
const cellMinWidth = pixelsToTwips(10);
|
|
27093
|
-
const encode$
|
|
27090
|
+
const encode$h = (params) => {
|
|
27094
27091
|
const { nodes } = params;
|
|
27095
27092
|
const node = nodes[0];
|
|
27096
|
-
const attributes = encodeProperties(node, { [translator$
|
|
27093
|
+
const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
|
|
27097
27094
|
return {
|
|
27098
|
-
xmlName: XML_NODE_NAME$
|
|
27095
|
+
xmlName: XML_NODE_NAME$a,
|
|
27099
27096
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
27100
27097
|
attributes
|
|
27101
27098
|
};
|
|
27102
27099
|
};
|
|
27103
|
-
const decode$
|
|
27100
|
+
const decode$h = (params) => {
|
|
27104
27101
|
const { grid: rawGrid } = params.node.attrs || {};
|
|
27105
27102
|
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
27106
27103
|
const { firstRow = {} } = params.extraParams || {};
|
|
@@ -27119,10 +27116,10 @@ const decode$g = (params) => {
|
|
|
27119
27116
|
numericWidth = fallbackColumnWidthTwips;
|
|
27120
27117
|
}
|
|
27121
27118
|
numericWidth = Math.max(numericWidth, cellMinWidth);
|
|
27122
|
-
const decoded = translator$
|
|
27119
|
+
const decoded = translator$b.decode({
|
|
27123
27120
|
node: { type: (
|
|
27124
27121
|
/** @type {string} */
|
|
27125
|
-
translator$
|
|
27122
|
+
translator$b.sdNodeOrKeyName
|
|
27126
27123
|
), attrs: { col: numericWidth } }
|
|
27127
27124
|
});
|
|
27128
27125
|
if (decoded) elements.push(decoded);
|
|
@@ -27157,39 +27154,100 @@ const decode$g = (params) => {
|
|
|
27157
27154
|
columnIndex++;
|
|
27158
27155
|
}
|
|
27159
27156
|
const newNode = {
|
|
27160
|
-
name: XML_NODE_NAME$
|
|
27157
|
+
name: XML_NODE_NAME$a,
|
|
27161
27158
|
attributes: {},
|
|
27162
27159
|
elements
|
|
27163
27160
|
};
|
|
27164
27161
|
return newNode;
|
|
27165
27162
|
};
|
|
27166
|
-
const config$
|
|
27167
|
-
xmlName: XML_NODE_NAME$
|
|
27163
|
+
const config$a = {
|
|
27164
|
+
xmlName: XML_NODE_NAME$a,
|
|
27168
27165
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
27169
|
-
encode: encode$
|
|
27170
|
-
decode: decode$
|
|
27166
|
+
encode: encode$h,
|
|
27167
|
+
decode: decode$h
|
|
27171
27168
|
};
|
|
27172
|
-
const translator$
|
|
27173
|
-
const
|
|
27174
|
-
const
|
|
27175
|
-
const
|
|
27169
|
+
const translator$a = NodeTranslator.from(config$a);
|
|
27170
|
+
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
27171
|
+
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
27172
|
+
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
27173
|
+
const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
|
|
27174
|
+
const pctToPercent = (value) => {
|
|
27175
|
+
if (value == null) return null;
|
|
27176
|
+
return value / 50;
|
|
27177
|
+
};
|
|
27178
|
+
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
27179
|
+
const resolveMeasurementWidthPx = (measurement) => {
|
|
27180
|
+
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
27181
|
+
const { value, type: type2 } = measurement;
|
|
27182
|
+
if (!type2 || type2 === "auto") return null;
|
|
27183
|
+
if (type2 === "dxa") return twipsToPixels(value);
|
|
27184
|
+
if (type2 === "pct") {
|
|
27185
|
+
const percent = pctToPercent(value);
|
|
27186
|
+
if (percent == null || percent <= 0) return null;
|
|
27187
|
+
const widthTwips = resolveContentWidthTwips() * percent / 100;
|
|
27188
|
+
return twipsToPixels(widthTwips);
|
|
27189
|
+
}
|
|
27190
|
+
return null;
|
|
27191
|
+
};
|
|
27192
|
+
const countColumnsInRow = (row) => {
|
|
27193
|
+
if (!row?.elements?.length) return 0;
|
|
27194
|
+
return row.elements.reduce((count, element) => {
|
|
27195
|
+
if (element.name !== "w:tc") return count;
|
|
27196
|
+
const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
|
|
27197
|
+
const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27198
|
+
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
27199
|
+
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
27200
|
+
}, 0);
|
|
27201
|
+
};
|
|
27202
|
+
const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
27203
|
+
const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
27204
|
+
const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasurement }) => {
|
|
27205
|
+
const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
|
|
27206
|
+
const columnCount = countColumnsInRow(firstRow);
|
|
27207
|
+
if (!columnCount) return null;
|
|
27208
|
+
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
|
|
27209
|
+
/** @type {any} */
|
|
27210
|
+
params
|
|
27211
|
+
);
|
|
27212
|
+
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
27213
|
+
let totalWidthPx;
|
|
27214
|
+
if (tableWidthMeasurement) {
|
|
27215
|
+
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
27216
|
+
if (resolved != null) totalWidthPx = resolved;
|
|
27217
|
+
}
|
|
27218
|
+
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) {
|
|
27219
|
+
totalWidthPx = tableWidth.width;
|
|
27220
|
+
}
|
|
27221
|
+
if (totalWidthPx == null) {
|
|
27222
|
+
totalWidthPx = minimumColumnWidthPx * columnCount;
|
|
27223
|
+
}
|
|
27224
|
+
const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
|
|
27225
|
+
const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
|
|
27226
|
+
const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
|
|
27227
|
+
return {
|
|
27228
|
+
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
27229
|
+
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27230
|
+
};
|
|
27231
|
+
};
|
|
27232
|
+
const XML_NODE_NAME$9 = "w:tbl";
|
|
27233
|
+
const SD_NODE_NAME$9 = "table";
|
|
27234
|
+
const encode$g = (params, encodedAttrs) => {
|
|
27176
27235
|
const { nodes } = params;
|
|
27177
27236
|
const node = nodes[0];
|
|
27178
27237
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
27179
27238
|
if (tblPr) {
|
|
27180
|
-
const encodedProperties = translator$
|
|
27239
|
+
const encodedProperties = translator$c.encode({ ...params, nodes: [tblPr] });
|
|
27181
27240
|
encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
|
|
27182
27241
|
}
|
|
27183
27242
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
27184
27243
|
if (tblGrid) {
|
|
27185
|
-
encodedAttrs["grid"] = translator$
|
|
27244
|
+
encodedAttrs["grid"] = translator$a.encode({ ...params, nodes: [tblGrid] }).attributes;
|
|
27186
27245
|
}
|
|
27187
27246
|
[
|
|
27188
27247
|
"tableStyleId",
|
|
27189
27248
|
"justification",
|
|
27190
27249
|
"tableLayout",
|
|
27191
27250
|
["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
27192
|
-
["tableWidth", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
27193
27251
|
["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
|
|
27194
27252
|
].forEach((prop) => {
|
|
27195
27253
|
let key;
|
|
@@ -27207,6 +27265,21 @@ const encode$f = (params, encodedAttrs) => {
|
|
|
27207
27265
|
if (encodedAttrs.tableCellSpacing) {
|
|
27208
27266
|
encodedAttrs["borderCollapse"] = "separate";
|
|
27209
27267
|
}
|
|
27268
|
+
if (encodedAttrs.tableProperties?.tableWidth) {
|
|
27269
|
+
const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
|
|
27270
|
+
const widthPx = twipsToPixels(tableWidthMeasurement.value);
|
|
27271
|
+
if (widthPx != null) {
|
|
27272
|
+
encodedAttrs.tableWidth = {
|
|
27273
|
+
width: widthPx,
|
|
27274
|
+
type: tableWidthMeasurement.type
|
|
27275
|
+
};
|
|
27276
|
+
} else if (tableWidthMeasurement.type === "auto") {
|
|
27277
|
+
encodedAttrs.tableWidth = {
|
|
27278
|
+
width: 0,
|
|
27279
|
+
type: tableWidthMeasurement.type
|
|
27280
|
+
};
|
|
27281
|
+
}
|
|
27282
|
+
}
|
|
27210
27283
|
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
27211
27284
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params);
|
|
27212
27285
|
if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
|
|
@@ -27220,10 +27293,22 @@ const encode$f = (params, encodedAttrs) => {
|
|
|
27220
27293
|
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
27221
27294
|
encodedAttrs["borders"] = borderData;
|
|
27222
27295
|
const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
|
|
27223
|
-
|
|
27296
|
+
let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
|
|
27297
|
+
if (!columnWidths.length) {
|
|
27298
|
+
const fallback = buildFallbackGridForTable({
|
|
27299
|
+
params,
|
|
27300
|
+
rows,
|
|
27301
|
+
tableWidth: encodedAttrs.tableWidth,
|
|
27302
|
+
tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
|
|
27303
|
+
});
|
|
27304
|
+
if (fallback) {
|
|
27305
|
+
encodedAttrs.grid = fallback.grid;
|
|
27306
|
+
columnWidths = fallback.columnWidths;
|
|
27307
|
+
}
|
|
27308
|
+
}
|
|
27224
27309
|
const content = [];
|
|
27225
27310
|
rows.forEach((row) => {
|
|
27226
|
-
const result = translator$
|
|
27311
|
+
const result = translator$G.encode({
|
|
27227
27312
|
...params,
|
|
27228
27313
|
nodes: [row],
|
|
27229
27314
|
extraParams: {
|
|
@@ -27242,13 +27327,13 @@ const encode$f = (params, encodedAttrs) => {
|
|
|
27242
27327
|
attrs: encodedAttrs
|
|
27243
27328
|
};
|
|
27244
27329
|
};
|
|
27245
|
-
const decode$
|
|
27330
|
+
const decode$g = (params, decodedAttrs) => {
|
|
27246
27331
|
params.node = preProcessVerticalMergeCells(params.node, params);
|
|
27247
27332
|
const { node } = params;
|
|
27248
27333
|
const elements = translateChildNodes(params);
|
|
27249
27334
|
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
27250
27335
|
const properties = node.attrs.grid;
|
|
27251
|
-
const element = translator$
|
|
27336
|
+
const element = translator$a.decode({
|
|
27252
27337
|
...params,
|
|
27253
27338
|
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
27254
27339
|
extraParams: {
|
|
@@ -27258,7 +27343,7 @@ const decode$f = (params, decodedAttrs) => {
|
|
|
27258
27343
|
if (element) elements.unshift(element);
|
|
27259
27344
|
if (node.attrs?.tableProperties) {
|
|
27260
27345
|
const properties2 = { ...node.attrs.tableProperties };
|
|
27261
|
-
const element2 = translator$
|
|
27346
|
+
const element2 = translator$c.decode({
|
|
27262
27347
|
...params,
|
|
27263
27348
|
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
27264
27349
|
});
|
|
@@ -27324,7 +27409,7 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
27324
27409
|
if (baseTblPr && baseTblPr.elements) {
|
|
27325
27410
|
tblPr.elements.push(...baseTblPr.elements);
|
|
27326
27411
|
}
|
|
27327
|
-
const tableProperties = translator$
|
|
27412
|
+
const tableProperties = translator$c.encode({ ...params, nodes: [tblPr] }).attributes;
|
|
27328
27413
|
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
27329
27414
|
if (borders) stylesToReturn.borders = borders;
|
|
27330
27415
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
@@ -27341,16 +27426,16 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
27341
27426
|
}
|
|
27342
27427
|
return stylesToReturn;
|
|
27343
27428
|
}
|
|
27344
|
-
const config$
|
|
27345
|
-
xmlName: XML_NODE_NAME$
|
|
27346
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
27429
|
+
const config$9 = {
|
|
27430
|
+
xmlName: XML_NODE_NAME$9,
|
|
27431
|
+
sdNodeOrKeyName: SD_NODE_NAME$9,
|
|
27347
27432
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27348
|
-
encode: encode$
|
|
27349
|
-
decode: decode$
|
|
27433
|
+
encode: encode$g,
|
|
27434
|
+
decode: decode$g,
|
|
27350
27435
|
attributes: []
|
|
27351
27436
|
};
|
|
27352
|
-
const translator$
|
|
27353
|
-
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$
|
|
27437
|
+
const translator$9 = NodeTranslator.from(config$9);
|
|
27438
|
+
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
|
|
27354
27439
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
27355
27440
|
if (!tblStyleTag) return null;
|
|
27356
27441
|
const stylesToReturn = {};
|
|
@@ -27712,10 +27797,10 @@ function generateCellMargins(cellMargins) {
|
|
|
27712
27797
|
if (left != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left) } });
|
|
27713
27798
|
return elements;
|
|
27714
27799
|
}
|
|
27715
|
-
const XML_NODE_NAME$
|
|
27716
|
-
const SD_NODE_NAME$
|
|
27717
|
-
const validXmlAttributes$
|
|
27718
|
-
function encode$
|
|
27800
|
+
const XML_NODE_NAME$8 = "w:tc";
|
|
27801
|
+
const SD_NODE_NAME$8 = "tableCell";
|
|
27802
|
+
const validXmlAttributes$8 = [];
|
|
27803
|
+
function encode$f(params, encodedAttrs) {
|
|
27719
27804
|
const {
|
|
27720
27805
|
node,
|
|
27721
27806
|
table,
|
|
@@ -27742,31 +27827,31 @@ function encode$e(params, encodedAttrs) {
|
|
|
27742
27827
|
}
|
|
27743
27828
|
return schemaNode;
|
|
27744
27829
|
}
|
|
27745
|
-
function decode$
|
|
27830
|
+
function decode$f(params, decodedAttrs) {
|
|
27746
27831
|
const translated = translateTableCell(params);
|
|
27747
27832
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
27748
27833
|
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
27749
27834
|
}
|
|
27750
27835
|
return translated;
|
|
27751
27836
|
}
|
|
27752
|
-
const config$
|
|
27753
|
-
xmlName: XML_NODE_NAME$
|
|
27754
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
27837
|
+
const config$8 = {
|
|
27838
|
+
xmlName: XML_NODE_NAME$8,
|
|
27839
|
+
sdNodeOrKeyName: SD_NODE_NAME$8,
|
|
27755
27840
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27756
|
-
encode: encode$
|
|
27757
|
-
decode: decode$
|
|
27758
|
-
attributes: validXmlAttributes$
|
|
27841
|
+
encode: encode$f,
|
|
27842
|
+
decode: decode$f,
|
|
27843
|
+
attributes: validXmlAttributes$8
|
|
27759
27844
|
};
|
|
27760
|
-
const translator$
|
|
27761
|
-
const XML_NODE_NAME$
|
|
27762
|
-
const SD_NODE_NAME$
|
|
27845
|
+
const translator$8 = NodeTranslator.from(config$8);
|
|
27846
|
+
const XML_NODE_NAME$7 = "w:hyperlink";
|
|
27847
|
+
const SD_NODE_NAME$7 = "link";
|
|
27763
27848
|
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
27764
27849
|
xmlName,
|
|
27765
27850
|
sdName,
|
|
27766
27851
|
encode: (attributes) => attributes[xmlName],
|
|
27767
27852
|
decode: (attributes) => attributes[sdName]
|
|
27768
27853
|
});
|
|
27769
|
-
const validXmlAttributes$
|
|
27854
|
+
const validXmlAttributes$7 = [
|
|
27770
27855
|
_createAttributeHandler("w:anchor", "anchor"),
|
|
27771
27856
|
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
27772
27857
|
{
|
|
@@ -27779,7 +27864,7 @@ const validXmlAttributes$6 = [
|
|
|
27779
27864
|
_createAttributeHandler("r:id", "rId"),
|
|
27780
27865
|
_createAttributeHandler("w:tgtFrame", "target")
|
|
27781
27866
|
];
|
|
27782
|
-
const encode$
|
|
27867
|
+
const encode$e = (params, encodedAttrs) => {
|
|
27783
27868
|
const { nodes, docx, nodeListHandler } = params;
|
|
27784
27869
|
const node = nodes[0];
|
|
27785
27870
|
let href = _resolveHref(docx, encodedAttrs);
|
|
@@ -27845,7 +27930,7 @@ const _resolveHref = (docx, encodedAttrs) => {
|
|
|
27845
27930
|
}
|
|
27846
27931
|
return href;
|
|
27847
27932
|
};
|
|
27848
|
-
function decode$
|
|
27933
|
+
function decode$e(params) {
|
|
27849
27934
|
const { node } = params;
|
|
27850
27935
|
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
27851
27936
|
const linkAttrs = this.decodeAttributes({ ...params, node: linkMark });
|
|
@@ -27889,15 +27974,15 @@ function _addNewLinkRelationship(params, link, rId) {
|
|
|
27889
27974
|
});
|
|
27890
27975
|
return rId;
|
|
27891
27976
|
}
|
|
27892
|
-
const config$
|
|
27893
|
-
xmlName: XML_NODE_NAME$
|
|
27894
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
27977
|
+
const config$7 = {
|
|
27978
|
+
xmlName: XML_NODE_NAME$7,
|
|
27979
|
+
sdNodeOrKeyName: SD_NODE_NAME$7,
|
|
27895
27980
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27896
|
-
encode: encode$
|
|
27897
|
-
decode: decode$
|
|
27898
|
-
attributes: validXmlAttributes$
|
|
27981
|
+
encode: encode$e,
|
|
27982
|
+
decode: decode$e,
|
|
27983
|
+
attributes: validXmlAttributes$7
|
|
27899
27984
|
};
|
|
27900
|
-
const translator$
|
|
27985
|
+
const translator$7 = NodeTranslator.from(config$7);
|
|
27901
27986
|
function parseTagValueJSON(json) {
|
|
27902
27987
|
if (typeof json !== "string") {
|
|
27903
27988
|
return {};
|
|
@@ -28692,32 +28777,32 @@ function translateAnchorNode(params) {
|
|
|
28692
28777
|
elements: [...anchorElements, ...elementsWithWrap]
|
|
28693
28778
|
};
|
|
28694
28779
|
}
|
|
28695
|
-
const XML_NODE_NAME$
|
|
28696
|
-
const SD_NODE_NAME$
|
|
28697
|
-
const validXmlAttributes$
|
|
28698
|
-
function encode$
|
|
28780
|
+
const XML_NODE_NAME$6 = "wp:anchor";
|
|
28781
|
+
const SD_NODE_NAME$6 = ["image"];
|
|
28782
|
+
const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
28783
|
+
function encode$d(params) {
|
|
28699
28784
|
const { node } = params.extraParams;
|
|
28700
28785
|
if (!node || !node.type) {
|
|
28701
28786
|
return null;
|
|
28702
28787
|
}
|
|
28703
28788
|
return handleAnchorNode(params);
|
|
28704
28789
|
}
|
|
28705
|
-
function decode$
|
|
28790
|
+
function decode$d(params) {
|
|
28706
28791
|
const { node } = params;
|
|
28707
28792
|
if (!node || !node.type) {
|
|
28708
28793
|
return null;
|
|
28709
28794
|
}
|
|
28710
28795
|
return translateAnchorNode(params);
|
|
28711
28796
|
}
|
|
28712
|
-
const config$
|
|
28713
|
-
xmlName: XML_NODE_NAME$
|
|
28714
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28797
|
+
const config$6 = {
|
|
28798
|
+
xmlName: XML_NODE_NAME$6,
|
|
28799
|
+
sdNodeOrKeyName: SD_NODE_NAME$6,
|
|
28715
28800
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28716
|
-
encode: encode$
|
|
28717
|
-
decode: decode$
|
|
28718
|
-
attributes: validXmlAttributes$
|
|
28801
|
+
encode: encode$d,
|
|
28802
|
+
decode: decode$d,
|
|
28803
|
+
attributes: validXmlAttributes$6
|
|
28719
28804
|
};
|
|
28720
|
-
const translator$
|
|
28805
|
+
const translator$6 = NodeTranslator.from(config$6);
|
|
28721
28806
|
function handleInlineNode(params) {
|
|
28722
28807
|
const { node } = params.extraParams;
|
|
28723
28808
|
if (node.name !== "wp:inline") {
|
|
@@ -28733,41 +28818,41 @@ function translateInlineNode(params) {
|
|
|
28733
28818
|
elements: nodeElements.elements
|
|
28734
28819
|
};
|
|
28735
28820
|
}
|
|
28736
|
-
const XML_NODE_NAME$
|
|
28737
|
-
const SD_NODE_NAME$
|
|
28738
|
-
const validXmlAttributes$
|
|
28739
|
-
function encode$
|
|
28821
|
+
const XML_NODE_NAME$5 = "wp:inline";
|
|
28822
|
+
const SD_NODE_NAME$5 = ["image"];
|
|
28823
|
+
const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
28824
|
+
function encode$c(params) {
|
|
28740
28825
|
const { node } = params.extraParams;
|
|
28741
28826
|
if (!node || !node.type) {
|
|
28742
28827
|
return null;
|
|
28743
28828
|
}
|
|
28744
28829
|
return handleInlineNode(params);
|
|
28745
28830
|
}
|
|
28746
|
-
function decode$
|
|
28831
|
+
function decode$c(params) {
|
|
28747
28832
|
const { node } = params;
|
|
28748
28833
|
if (!node || !node.type) {
|
|
28749
28834
|
return null;
|
|
28750
28835
|
}
|
|
28751
28836
|
return translateInlineNode(params);
|
|
28752
28837
|
}
|
|
28753
|
-
const config$
|
|
28754
|
-
xmlName: XML_NODE_NAME$
|
|
28755
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28838
|
+
const config$5 = {
|
|
28839
|
+
xmlName: XML_NODE_NAME$5,
|
|
28840
|
+
sdNodeOrKeyName: SD_NODE_NAME$5,
|
|
28756
28841
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28757
|
-
encode: encode$
|
|
28758
|
-
decode: decode$
|
|
28759
|
-
attributes: validXmlAttributes$
|
|
28842
|
+
encode: encode$c,
|
|
28843
|
+
decode: decode$c,
|
|
28844
|
+
attributes: validXmlAttributes$5
|
|
28760
28845
|
};
|
|
28761
|
-
const translator$
|
|
28762
|
-
const XML_NODE_NAME$
|
|
28763
|
-
const SD_NODE_NAME$
|
|
28764
|
-
const validXmlAttributes$
|
|
28765
|
-
function encode$
|
|
28846
|
+
const translator$5 = NodeTranslator.from(config$5);
|
|
28847
|
+
const XML_NODE_NAME$4 = "w:drawing";
|
|
28848
|
+
const SD_NODE_NAME$4 = [];
|
|
28849
|
+
const validXmlAttributes$4 = [];
|
|
28850
|
+
function encode$b(params) {
|
|
28766
28851
|
const nodes = params.nodes;
|
|
28767
28852
|
const node = nodes[0];
|
|
28768
28853
|
const translatorByChildName = {
|
|
28769
|
-
"wp:anchor": translator$
|
|
28770
|
-
"wp:inline": translator$
|
|
28854
|
+
"wp:anchor": translator$6,
|
|
28855
|
+
"wp:inline": translator$5
|
|
28771
28856
|
};
|
|
28772
28857
|
return node.elements.reduce((acc, child) => {
|
|
28773
28858
|
if (acc) return acc;
|
|
@@ -28776,12 +28861,12 @@ function encode$a(params) {
|
|
|
28776
28861
|
return translator2.encode({ ...params, extraParams: { node: child } }) || acc;
|
|
28777
28862
|
}, null);
|
|
28778
28863
|
}
|
|
28779
|
-
function decode$
|
|
28864
|
+
function decode$b(params) {
|
|
28780
28865
|
const { node } = params;
|
|
28781
28866
|
if (!node || !node.type) {
|
|
28782
28867
|
return null;
|
|
28783
28868
|
}
|
|
28784
|
-
const childTranslator = node.attrs.isAnchor ? translator$
|
|
28869
|
+
const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
|
|
28785
28870
|
const resultNode = childTranslator.decode(params);
|
|
28786
28871
|
return wrapTextInRun(
|
|
28787
28872
|
{
|
|
@@ -28791,15 +28876,15 @@ function decode$a(params) {
|
|
|
28791
28876
|
[]
|
|
28792
28877
|
);
|
|
28793
28878
|
}
|
|
28794
|
-
const config$
|
|
28795
|
-
xmlName: XML_NODE_NAME$
|
|
28796
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28879
|
+
const config$4 = {
|
|
28880
|
+
xmlName: XML_NODE_NAME$4,
|
|
28881
|
+
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
28797
28882
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28798
|
-
encode: encode$
|
|
28799
|
-
decode: decode$
|
|
28800
|
-
attributes: validXmlAttributes$
|
|
28883
|
+
encode: encode$b,
|
|
28884
|
+
decode: decode$b,
|
|
28885
|
+
attributes: validXmlAttributes$4
|
|
28801
28886
|
};
|
|
28802
|
-
const translator$
|
|
28887
|
+
const translator$4 = NodeTranslator.from(config$4);
|
|
28803
28888
|
class CommandService {
|
|
28804
28889
|
/**
|
|
28805
28890
|
* @param {import('./commands/types/index.js').CommandServiceOptions} props
|
|
@@ -30137,7 +30222,7 @@ function prepareTextAnnotation(params) {
|
|
|
30137
30222
|
return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params);
|
|
30138
30223
|
}
|
|
30139
30224
|
function prepareImageAnnotation(params, imageSize) {
|
|
30140
|
-
return translator$
|
|
30225
|
+
return translator$4.decode({
|
|
30141
30226
|
...params,
|
|
30142
30227
|
imageSize
|
|
30143
30228
|
});
|
|
@@ -30374,10 +30459,10 @@ function translateStructuredContent(params) {
|
|
|
30374
30459
|
};
|
|
30375
30460
|
return result;
|
|
30376
30461
|
}
|
|
30377
|
-
const XML_NODE_NAME$
|
|
30378
|
-
const SD_NODE_NAME$
|
|
30379
|
-
const validXmlAttributes$
|
|
30380
|
-
function encode$
|
|
30462
|
+
const XML_NODE_NAME$3 = "w:sdt";
|
|
30463
|
+
const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
30464
|
+
const validXmlAttributes$3 = [];
|
|
30465
|
+
function encode$a(params) {
|
|
30381
30466
|
const nodes = params.nodes;
|
|
30382
30467
|
const node = nodes[0];
|
|
30383
30468
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -30387,7 +30472,7 @@ function encode$9(params) {
|
|
|
30387
30472
|
const result = handler2(params);
|
|
30388
30473
|
return result;
|
|
30389
30474
|
}
|
|
30390
|
-
function decode$
|
|
30475
|
+
function decode$a(params) {
|
|
30391
30476
|
const { node } = params;
|
|
30392
30477
|
if (!node || !node.type) {
|
|
30393
30478
|
return null;
|
|
@@ -30403,85 +30488,85 @@ function decode$9(params) {
|
|
|
30403
30488
|
const result = decoder();
|
|
30404
30489
|
return result;
|
|
30405
30490
|
}
|
|
30406
|
-
const config$
|
|
30407
|
-
xmlName: XML_NODE_NAME$
|
|
30408
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
30491
|
+
const config$3 = {
|
|
30492
|
+
xmlName: XML_NODE_NAME$3,
|
|
30493
|
+
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
30409
30494
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30410
|
-
encode: encode$
|
|
30411
|
-
decode: decode$
|
|
30412
|
-
attributes: validXmlAttributes$
|
|
30495
|
+
encode: encode$a,
|
|
30496
|
+
decode: decode$a,
|
|
30497
|
+
attributes: validXmlAttributes$3
|
|
30413
30498
|
};
|
|
30414
|
-
const translator$
|
|
30415
|
-
const encode$
|
|
30499
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
30500
|
+
const encode$9 = (attributes) => {
|
|
30416
30501
|
return attributes["w:id"];
|
|
30417
30502
|
};
|
|
30418
|
-
const decode$
|
|
30503
|
+
const decode$9 = (attrs) => {
|
|
30419
30504
|
return attrs.id;
|
|
30420
30505
|
};
|
|
30421
30506
|
const attrConfig$6 = Object.freeze({
|
|
30422
30507
|
xmlName: "w:id",
|
|
30423
30508
|
sdName: "id",
|
|
30424
|
-
encode: encode$
|
|
30425
|
-
decode: decode$
|
|
30509
|
+
encode: encode$9,
|
|
30510
|
+
decode: decode$9
|
|
30426
30511
|
});
|
|
30427
|
-
const encode$
|
|
30512
|
+
const encode$8 = (attributes) => {
|
|
30428
30513
|
return attributes["w:name"];
|
|
30429
30514
|
};
|
|
30430
|
-
const decode$
|
|
30515
|
+
const decode$8 = (attrs) => {
|
|
30431
30516
|
return attrs.name;
|
|
30432
30517
|
};
|
|
30433
30518
|
const attrConfig$5 = Object.freeze({
|
|
30434
30519
|
xmlName: "w:name",
|
|
30435
30520
|
sdName: "name",
|
|
30436
|
-
encode: encode$
|
|
30437
|
-
decode: decode$
|
|
30521
|
+
encode: encode$8,
|
|
30522
|
+
decode: decode$8
|
|
30438
30523
|
});
|
|
30439
|
-
const encode$
|
|
30524
|
+
const encode$7 = (attributes) => {
|
|
30440
30525
|
return attributes["w:colFirst"];
|
|
30441
30526
|
};
|
|
30442
|
-
const decode$
|
|
30527
|
+
const decode$7 = (attrs) => {
|
|
30443
30528
|
return attrs.colFirst;
|
|
30444
30529
|
};
|
|
30445
30530
|
const attrConfig$4 = Object.freeze({
|
|
30446
30531
|
xmlName: "w:colFirst",
|
|
30447
30532
|
sdName: "colFirst",
|
|
30448
|
-
encode: encode$
|
|
30449
|
-
decode: decode$
|
|
30533
|
+
encode: encode$7,
|
|
30534
|
+
decode: decode$7
|
|
30450
30535
|
});
|
|
30451
|
-
const encode$
|
|
30536
|
+
const encode$6 = (attributes) => {
|
|
30452
30537
|
return attributes["w:colLast"];
|
|
30453
30538
|
};
|
|
30454
|
-
const decode$
|
|
30539
|
+
const decode$6 = (attrs) => {
|
|
30455
30540
|
return attrs.colLast;
|
|
30456
30541
|
};
|
|
30457
30542
|
const attrConfig$3 = Object.freeze({
|
|
30458
30543
|
xmlName: "w:colLast",
|
|
30459
30544
|
sdName: "colLast",
|
|
30460
|
-
encode: encode$
|
|
30461
|
-
decode: decode$
|
|
30545
|
+
encode: encode$6,
|
|
30546
|
+
decode: decode$6
|
|
30462
30547
|
});
|
|
30463
|
-
const encode$
|
|
30548
|
+
const encode$5 = (attributes) => {
|
|
30464
30549
|
return attributes["w:displacedByCustomXml"];
|
|
30465
30550
|
};
|
|
30466
|
-
const decode$
|
|
30551
|
+
const decode$5 = (attrs) => {
|
|
30467
30552
|
return attrs.displacedByCustomXml;
|
|
30468
30553
|
};
|
|
30469
30554
|
const attrConfig$2 = Object.freeze({
|
|
30470
30555
|
xmlName: "w:displacedByCustomXml",
|
|
30471
30556
|
sdName: "displacedByCustomXml",
|
|
30472
|
-
encode: encode$
|
|
30473
|
-
decode: decode$
|
|
30557
|
+
encode: encode$5,
|
|
30558
|
+
decode: decode$5
|
|
30474
30559
|
});
|
|
30475
|
-
const validXmlAttributes$
|
|
30476
|
-
const XML_NODE_NAME$
|
|
30477
|
-
const SD_NODE_NAME$
|
|
30478
|
-
const encode$
|
|
30560
|
+
const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
|
|
30561
|
+
const XML_NODE_NAME$2 = "w:bookmarkStart";
|
|
30562
|
+
const SD_NODE_NAME$2 = "bookmarkStart";
|
|
30563
|
+
const encode$4 = (params, encodedAttrs = {}) => {
|
|
30479
30564
|
return {
|
|
30480
30565
|
type: "bookmarkStart",
|
|
30481
30566
|
attrs: encodedAttrs
|
|
30482
30567
|
};
|
|
30483
30568
|
};
|
|
30484
|
-
const decode$
|
|
30569
|
+
const decode$4 = (params, decodedAttrs = {}) => {
|
|
30485
30570
|
const result = {
|
|
30486
30571
|
name: "w:bookmarkStart",
|
|
30487
30572
|
elements: []
|
|
@@ -30491,49 +30576,49 @@ const decode$3 = (params, decodedAttrs = {}) => {
|
|
|
30491
30576
|
}
|
|
30492
30577
|
return result;
|
|
30493
30578
|
};
|
|
30494
|
-
const config$
|
|
30495
|
-
xmlName: XML_NODE_NAME$
|
|
30496
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
30579
|
+
const config$2 = {
|
|
30580
|
+
xmlName: XML_NODE_NAME$2,
|
|
30581
|
+
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
30497
30582
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30498
|
-
encode: encode$
|
|
30499
|
-
decode: decode$
|
|
30500
|
-
attributes: validXmlAttributes$
|
|
30583
|
+
encode: encode$4,
|
|
30584
|
+
decode: decode$4,
|
|
30585
|
+
attributes: validXmlAttributes$2
|
|
30501
30586
|
};
|
|
30502
|
-
const translator$
|
|
30503
|
-
const encode$
|
|
30587
|
+
const translator$2 = NodeTranslator.from(config$2);
|
|
30588
|
+
const encode$3 = (attributes) => {
|
|
30504
30589
|
return attributes["w:id"];
|
|
30505
30590
|
};
|
|
30506
|
-
const decode$
|
|
30591
|
+
const decode$3 = (attrs) => {
|
|
30507
30592
|
return attrs.id;
|
|
30508
30593
|
};
|
|
30509
30594
|
const attrConfig$1 = Object.freeze({
|
|
30510
30595
|
xmlName: "w:id",
|
|
30511
30596
|
sdName: "id",
|
|
30512
|
-
encode: encode$
|
|
30513
|
-
decode: decode$
|
|
30597
|
+
encode: encode$3,
|
|
30598
|
+
decode: decode$3
|
|
30514
30599
|
});
|
|
30515
|
-
const encode$
|
|
30600
|
+
const encode$2 = (attributes) => {
|
|
30516
30601
|
return attributes["w:displacedByCustomXml"];
|
|
30517
30602
|
};
|
|
30518
|
-
const decode$
|
|
30603
|
+
const decode$2 = (attrs) => {
|
|
30519
30604
|
return attrs.displacedByCustomXml;
|
|
30520
30605
|
};
|
|
30521
30606
|
const attrConfig = Object.freeze({
|
|
30522
30607
|
xmlName: "w:displacedByCustomXml",
|
|
30523
30608
|
sdName: "displacedByCustomXml",
|
|
30524
|
-
encode: encode$
|
|
30525
|
-
decode: decode$
|
|
30609
|
+
encode: encode$2,
|
|
30610
|
+
decode: decode$2
|
|
30526
30611
|
});
|
|
30527
|
-
const validXmlAttributes = [attrConfig$1, attrConfig];
|
|
30528
|
-
const XML_NODE_NAME = "w:bookmarkEnd";
|
|
30529
|
-
const SD_NODE_NAME = "bookmarkEnd";
|
|
30530
|
-
const encode = (params, encodedAttrs = {}) => {
|
|
30612
|
+
const validXmlAttributes$1 = [attrConfig$1, attrConfig];
|
|
30613
|
+
const XML_NODE_NAME$1 = "w:bookmarkEnd";
|
|
30614
|
+
const SD_NODE_NAME$1 = "bookmarkEnd";
|
|
30615
|
+
const encode$1 = (params, encodedAttrs = {}) => {
|
|
30531
30616
|
return {
|
|
30532
30617
|
type: "bookmarkEnd",
|
|
30533
30618
|
attrs: encodedAttrs
|
|
30534
30619
|
};
|
|
30535
30620
|
};
|
|
30536
|
-
const decode = (params, decodedAttrs = {}) => {
|
|
30621
|
+
const decode$1 = (params, decodedAttrs = {}) => {
|
|
30537
30622
|
const result = {
|
|
30538
30623
|
name: "w:bookmarkEnd",
|
|
30539
30624
|
elements: []
|
|
@@ -30543,6 +30628,55 @@ const decode = (params, decodedAttrs = {}) => {
|
|
|
30543
30628
|
}
|
|
30544
30629
|
return result;
|
|
30545
30630
|
};
|
|
30631
|
+
const config$1 = {
|
|
30632
|
+
xmlName: XML_NODE_NAME$1,
|
|
30633
|
+
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
30634
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
30635
|
+
encode: encode$1,
|
|
30636
|
+
decode: decode$1,
|
|
30637
|
+
attributes: validXmlAttributes$1
|
|
30638
|
+
};
|
|
30639
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
30640
|
+
const XML_NODE_NAME = "mc:AlternateContent";
|
|
30641
|
+
const SD_NODE_NAME = [];
|
|
30642
|
+
const validXmlAttributes = [];
|
|
30643
|
+
function encode(params) {
|
|
30644
|
+
const { nodeListHandler } = params;
|
|
30645
|
+
const { node } = params.extraParams;
|
|
30646
|
+
if (!node || !node.type) {
|
|
30647
|
+
return null;
|
|
30648
|
+
}
|
|
30649
|
+
const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
|
|
30650
|
+
const wpsNode = node.elements.find(
|
|
30651
|
+
(el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
|
|
30652
|
+
);
|
|
30653
|
+
if (!wpsNode) {
|
|
30654
|
+
return null;
|
|
30655
|
+
}
|
|
30656
|
+
const contents = wpsNode.elements;
|
|
30657
|
+
return nodeListHandler.handler({
|
|
30658
|
+
...params,
|
|
30659
|
+
nodes: contents,
|
|
30660
|
+
path: [...params.path || [], wpsNode]
|
|
30661
|
+
});
|
|
30662
|
+
}
|
|
30663
|
+
function decode(params) {
|
|
30664
|
+
const { node } = params;
|
|
30665
|
+
const { drawingContent } = node.attrs;
|
|
30666
|
+
const drawing = {
|
|
30667
|
+
name: "w:drawing",
|
|
30668
|
+
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
30669
|
+
};
|
|
30670
|
+
const choice = {
|
|
30671
|
+
name: "mc:Choice",
|
|
30672
|
+
attributes: { Requires: "wps" },
|
|
30673
|
+
elements: [drawing]
|
|
30674
|
+
};
|
|
30675
|
+
return {
|
|
30676
|
+
name: "mc:AlternateContent",
|
|
30677
|
+
elements: [choice]
|
|
30678
|
+
};
|
|
30679
|
+
}
|
|
30546
30680
|
const config = {
|
|
30547
30681
|
xmlName: XML_NODE_NAME,
|
|
30548
30682
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
@@ -30552,6 +30686,63 @@ const config = {
|
|
|
30552
30686
|
attributes: validXmlAttributes
|
|
30553
30687
|
};
|
|
30554
30688
|
const translator = NodeTranslator.from(config);
|
|
30689
|
+
const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
|
|
30690
|
+
pageSize: Object.freeze({ width: "12240", height: "15840" }),
|
|
30691
|
+
pageMargins: Object.freeze({
|
|
30692
|
+
top: "1440",
|
|
30693
|
+
right: "1440",
|
|
30694
|
+
bottom: "1440",
|
|
30695
|
+
left: "1440",
|
|
30696
|
+
header: "720",
|
|
30697
|
+
footer: "720",
|
|
30698
|
+
gutter: "0"
|
|
30699
|
+
})
|
|
30700
|
+
});
|
|
30701
|
+
const ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
30702
|
+
if (!sectPr) {
|
|
30703
|
+
return {
|
|
30704
|
+
type: "element",
|
|
30705
|
+
name: "w:sectPr",
|
|
30706
|
+
elements: []
|
|
30707
|
+
};
|
|
30708
|
+
}
|
|
30709
|
+
if (!sectPr.elements) sectPr.elements = [];
|
|
30710
|
+
const ensureChild = (name) => {
|
|
30711
|
+
let child = sectPr.elements.find((n) => n.name === name);
|
|
30712
|
+
if (!child) {
|
|
30713
|
+
child = {
|
|
30714
|
+
type: "element",
|
|
30715
|
+
name,
|
|
30716
|
+
elements: [],
|
|
30717
|
+
attributes: {}
|
|
30718
|
+
};
|
|
30719
|
+
sectPr.elements.push(child);
|
|
30720
|
+
} else {
|
|
30721
|
+
if (!child.elements) child.elements = [];
|
|
30722
|
+
if (!child.attributes) child.attributes = {};
|
|
30723
|
+
}
|
|
30724
|
+
return child;
|
|
30725
|
+
};
|
|
30726
|
+
const pageSize = converter?.pageStyles?.pageSize;
|
|
30727
|
+
const pgSz = ensureChild("w:pgSz");
|
|
30728
|
+
if (pageSize?.width != null) pgSz.attributes["w:w"] = String(inchesToTwips(pageSize.width));
|
|
30729
|
+
if (pageSize?.height != null) pgSz.attributes["w:h"] = String(inchesToTwips(pageSize.height));
|
|
30730
|
+
if (pgSz.attributes["w:w"] == null) pgSz.attributes["w:w"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.width;
|
|
30731
|
+
if (pgSz.attributes["w:h"] == null) pgSz.attributes["w:h"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.height;
|
|
30732
|
+
const pageMargins = converter?.pageStyles?.pageMargins;
|
|
30733
|
+
const pgMar = ensureChild("w:pgMar");
|
|
30734
|
+
if (pageMargins) {
|
|
30735
|
+
Object.entries(pageMargins).forEach(([key, value]) => {
|
|
30736
|
+
const converted = inchesToTwips(value);
|
|
30737
|
+
if (converted != null) pgMar.attributes[`w:${key}`] = String(converted);
|
|
30738
|
+
});
|
|
30739
|
+
}
|
|
30740
|
+
Object.entries(DEFAULT_SECTION_PROPS_TWIPS.pageMargins).forEach(([key, value]) => {
|
|
30741
|
+
const attrKey = `w:${key}`;
|
|
30742
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
30743
|
+
});
|
|
30744
|
+
return sectPr;
|
|
30745
|
+
};
|
|
30555
30746
|
const isLineBreakOnlyRun = (node) => {
|
|
30556
30747
|
if (!node) return false;
|
|
30557
30748
|
if (node.type === "lineBreak" || node.type === "hardBreak") return true;
|
|
@@ -30566,30 +30757,30 @@ function exportSchemaToJson(params) {
|
|
|
30566
30757
|
doc: translateDocumentNode,
|
|
30567
30758
|
body: translateBodyNode,
|
|
30568
30759
|
heading: translateHeadingNode,
|
|
30569
|
-
paragraph: translator$
|
|
30570
|
-
run: translator$
|
|
30760
|
+
paragraph: translator$13,
|
|
30761
|
+
run: translator$U,
|
|
30571
30762
|
text: translateTextNode,
|
|
30572
30763
|
bulletList: translateList,
|
|
30573
30764
|
orderedList: translateList,
|
|
30574
|
-
lineBreak: translator$
|
|
30575
|
-
table: translator$
|
|
30576
|
-
tableRow: translator$
|
|
30577
|
-
tableCell: translator$
|
|
30578
|
-
bookmarkStart: translator$
|
|
30579
|
-
bookmarkEnd: translator,
|
|
30580
|
-
fieldAnnotation: translator$
|
|
30581
|
-
tab: translator$
|
|
30582
|
-
image: translator$
|
|
30583
|
-
hardBreak: translator$
|
|
30765
|
+
lineBreak: translator$16,
|
|
30766
|
+
table: translator$9,
|
|
30767
|
+
tableRow: translator$G,
|
|
30768
|
+
tableCell: translator$8,
|
|
30769
|
+
bookmarkStart: translator$2,
|
|
30770
|
+
bookmarkEnd: translator$1,
|
|
30771
|
+
fieldAnnotation: translator$3,
|
|
30772
|
+
tab: translator$14,
|
|
30773
|
+
image: translator$4,
|
|
30774
|
+
hardBreak: translator$16,
|
|
30584
30775
|
commentRangeStart: () => translateCommentNode(params, "Start"),
|
|
30585
30776
|
commentRangeEnd: () => translateCommentNode(params, "End"),
|
|
30586
30777
|
commentReference: () => null,
|
|
30587
30778
|
shapeContainer: translateShapeContainer,
|
|
30588
30779
|
shapeTextbox: translateShapeTextbox,
|
|
30589
30780
|
contentBlock: translateContentBlock,
|
|
30590
|
-
structuredContent: translator$
|
|
30591
|
-
structuredContentBlock: translator$
|
|
30592
|
-
documentSection: translator$
|
|
30781
|
+
structuredContent: translator$3,
|
|
30782
|
+
structuredContentBlock: translator$3,
|
|
30783
|
+
documentSection: translator$3,
|
|
30593
30784
|
"page-number": translatePageNumberNode,
|
|
30594
30785
|
"total-page-number": translateTotalPageNumberNode
|
|
30595
30786
|
};
|
|
@@ -30604,28 +30795,30 @@ function exportSchemaToJson(params) {
|
|
|
30604
30795
|
return handler2(params);
|
|
30605
30796
|
}
|
|
30606
30797
|
function translateBodyNode(params) {
|
|
30607
|
-
let sectPr = params.bodyNode?.elements
|
|
30798
|
+
let sectPr = params.bodyNode?.elements?.find((n) => n.name === "w:sectPr");
|
|
30799
|
+
if (!sectPr) {
|
|
30800
|
+
sectPr = {
|
|
30801
|
+
type: "element",
|
|
30802
|
+
name: "w:sectPr",
|
|
30803
|
+
elements: []
|
|
30804
|
+
};
|
|
30805
|
+
} else if (!sectPr.elements) {
|
|
30806
|
+
sectPr = { ...sectPr, elements: [] };
|
|
30807
|
+
}
|
|
30808
|
+
sectPr = ensureSectionLayoutDefaults(sectPr, params.converter);
|
|
30608
30809
|
if (params.converter) {
|
|
30609
|
-
const hasHeader = sectPr
|
|
30810
|
+
const hasHeader = sectPr.elements?.some((n) => n.name === "w:headerReference");
|
|
30610
30811
|
const hasDefaultHeader = params.converter.headerIds?.default;
|
|
30611
30812
|
if (!hasHeader && hasDefaultHeader && !params.editor.options.isHeaderOrFooter) {
|
|
30612
30813
|
const defaultHeader = generateDefaultHeaderFooter("header", params.converter.headerIds?.default);
|
|
30613
30814
|
sectPr.elements.push(defaultHeader);
|
|
30614
30815
|
}
|
|
30615
|
-
const hasFooter = sectPr
|
|
30816
|
+
const hasFooter = sectPr.elements?.some((n) => n.name === "w:footerReference");
|
|
30616
30817
|
const hasDefaultFooter = params.converter.footerIds?.default;
|
|
30617
30818
|
if (!hasFooter && hasDefaultFooter && !params.editor.options.isHeaderOrFooter) {
|
|
30618
30819
|
const defaultFooter = generateDefaultHeaderFooter("footer", params.converter.footerIds?.default);
|
|
30619
30820
|
sectPr.elements.push(defaultFooter);
|
|
30620
30821
|
}
|
|
30621
|
-
const newMargins = params.converter.pageStyles.pageMargins;
|
|
30622
|
-
const sectPrMargins = sectPr.elements.find((n) => n.name === "w:pgMar");
|
|
30623
|
-
const { attributes } = sectPrMargins;
|
|
30624
|
-
Object.entries(newMargins).forEach(([key, value]) => {
|
|
30625
|
-
const convertedValue = inchesToTwips(value);
|
|
30626
|
-
attributes[`w:${key}`] = convertedValue;
|
|
30627
|
-
});
|
|
30628
|
-
sectPrMargins.attributes = attributes;
|
|
30629
30822
|
}
|
|
30630
30823
|
const elements = translateChildNodes(params);
|
|
30631
30824
|
if (params.isHeaderFooter) {
|
|
@@ -30928,7 +31121,7 @@ function translateTextNode(params) {
|
|
|
30928
31121
|
const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
|
|
30929
31122
|
if (isTrackedNode) return translateTrackedNode(params);
|
|
30930
31123
|
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
30931
|
-
if (isLinkNode) return translator$
|
|
31124
|
+
if (isLinkNode) return translator$7.decode(params);
|
|
30932
31125
|
const { text, marks = [] } = node;
|
|
30933
31126
|
return getTextNodeForExport(text, marks, params);
|
|
30934
31127
|
}
|
|
@@ -31234,7 +31427,7 @@ function translateMark(mark) {
|
|
|
31234
31427
|
markElement.type = "element";
|
|
31235
31428
|
break;
|
|
31236
31429
|
case "underline": {
|
|
31237
|
-
const translated = translator
|
|
31430
|
+
const translated = translator$10.decode({
|
|
31238
31431
|
node: {
|
|
31239
31432
|
attrs: {
|
|
31240
31433
|
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
@@ -31298,7 +31491,7 @@ function translateMark(mark) {
|
|
|
31298
31491
|
break;
|
|
31299
31492
|
case "highlight": {
|
|
31300
31493
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
31301
|
-
const translated = translator$
|
|
31494
|
+
const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
31302
31495
|
return translated || {};
|
|
31303
31496
|
}
|
|
31304
31497
|
}
|
|
@@ -31354,23 +31547,11 @@ function translateShapeTextbox(params) {
|
|
|
31354
31547
|
}
|
|
31355
31548
|
function translateContentBlock(params) {
|
|
31356
31549
|
const { node } = params;
|
|
31357
|
-
const {
|
|
31550
|
+
const { vmlAttributes, horizontalRule } = node.attrs;
|
|
31358
31551
|
if (vmlAttributes || horizontalRule) {
|
|
31359
31552
|
return translateVRectContentBlock(params);
|
|
31360
31553
|
}
|
|
31361
|
-
const
|
|
31362
|
-
name: "w:drawing",
|
|
31363
|
-
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
31364
|
-
};
|
|
31365
|
-
const choice = {
|
|
31366
|
-
name: "mc:Choice",
|
|
31367
|
-
attributes: { Requires: "wps" },
|
|
31368
|
-
elements: [drawing]
|
|
31369
|
-
};
|
|
31370
|
-
const alternateContent = {
|
|
31371
|
-
name: "mc:AlternateContent",
|
|
31372
|
-
elements: [choice]
|
|
31373
|
-
};
|
|
31554
|
+
const alternateContent = translator.decode(params);
|
|
31374
31555
|
return wrapTextInRun(alternateContent);
|
|
31375
31556
|
}
|
|
31376
31557
|
function translateVRectContentBlock(params) {
|
|
@@ -31574,7 +31755,7 @@ const handleDrawingNode = (params) => {
|
|
|
31574
31755
|
if (mainNode.name === "w:drawing") node = mainNode;
|
|
31575
31756
|
else node = mainNode.elements.find((el) => el.name === "w:drawing");
|
|
31576
31757
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31577
|
-
const schemaNode = translator$
|
|
31758
|
+
const schemaNode = translator$4.encode(params);
|
|
31578
31759
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
31579
31760
|
return { nodes: newNodes, consumed: 1 };
|
|
31580
31761
|
};
|
|
@@ -31676,8 +31857,8 @@ const trackChangeNodeHandlerEntity = {
|
|
|
31676
31857
|
handlerName: "trackChangeNodeHandler",
|
|
31677
31858
|
handler: handleTrackChangeNode
|
|
31678
31859
|
};
|
|
31679
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
31680
|
-
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$
|
|
31860
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
|
|
31861
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
|
|
31681
31862
|
const handleTextNode = (params) => {
|
|
31682
31863
|
const { nodes, insideTrackChange } = params;
|
|
31683
31864
|
if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
|
|
@@ -31718,7 +31899,7 @@ const handleParagraphNode = (params) => {
|
|
|
31718
31899
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
31719
31900
|
return { nodes: [], consumed: 0 };
|
|
31720
31901
|
}
|
|
31721
|
-
const schemaNode = translator$
|
|
31902
|
+
const schemaNode = translator$13.encode(params);
|
|
31722
31903
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
31723
31904
|
return { nodes: newNodes, consumed: 1 };
|
|
31724
31905
|
};
|
|
@@ -31731,7 +31912,7 @@ const handleSdtNode = (params) => {
|
|
|
31731
31912
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
31732
31913
|
return { nodes: [], consumed: 0 };
|
|
31733
31914
|
}
|
|
31734
|
-
const result = translator$
|
|
31915
|
+
const result = translator$3.encode(params);
|
|
31735
31916
|
if (!result) {
|
|
31736
31917
|
return { nodes: [], consumed: 0 };
|
|
31737
31918
|
}
|
|
@@ -31821,7 +32002,7 @@ const handler = (params) => {
|
|
|
31821
32002
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
31822
32003
|
return { nodes: [], consumed: 0 };
|
|
31823
32004
|
}
|
|
31824
|
-
const result = translator$
|
|
32005
|
+
const result = translator$16.encode(params);
|
|
31825
32006
|
if (!result) return { nodes: [], consumed: 0 };
|
|
31826
32007
|
return {
|
|
31827
32008
|
nodes: [result],
|
|
@@ -31893,7 +32074,7 @@ const handleBookmarkStartNode = (params) => {
|
|
|
31893
32074
|
if (isCustomMarkBookmark(nodes[0], params.editor)) {
|
|
31894
32075
|
return handleBookmarkNode(params);
|
|
31895
32076
|
}
|
|
31896
|
-
const node = translator$
|
|
32077
|
+
const node = translator$2.encode(params);
|
|
31897
32078
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31898
32079
|
return { nodes: [node], consumed: 1 };
|
|
31899
32080
|
};
|
|
@@ -31925,7 +32106,7 @@ const handleBookmarkEndNode = (params) => {
|
|
|
31925
32106
|
if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
|
|
31926
32107
|
return { nodes: [], consumed: 0 };
|
|
31927
32108
|
}
|
|
31928
|
-
const node = translator.encode(params);
|
|
32109
|
+
const node = translator$1.encode(params);
|
|
31929
32110
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31930
32111
|
return { nodes: [node], consumed: 1 };
|
|
31931
32112
|
};
|
|
@@ -31933,32 +32114,86 @@ const bookmarkEndNodeHandlerEntity = {
|
|
|
31933
32114
|
handlerName: "w:bookmarkEndTranslator",
|
|
31934
32115
|
handler: handleBookmarkEndNode
|
|
31935
32116
|
};
|
|
32117
|
+
const ALTERNATE_CONTENT_NODE = "mc:AlternateContent";
|
|
32118
|
+
const SUPPORTED_REQUIRES = /* @__PURE__ */ new Set([
|
|
32119
|
+
"wps",
|
|
32120
|
+
"wp14",
|
|
32121
|
+
"w14",
|
|
32122
|
+
"w15",
|
|
32123
|
+
"w16",
|
|
32124
|
+
"w16cex",
|
|
32125
|
+
"w16cid",
|
|
32126
|
+
"w16du",
|
|
32127
|
+
"w16sdtdh",
|
|
32128
|
+
"w16sdtfl",
|
|
32129
|
+
"w16se"
|
|
32130
|
+
]);
|
|
32131
|
+
const skipHandlerResponse = { nodes: [], consumed: 0 };
|
|
32132
|
+
const isAlternateContentNode = (node) => node?.name === ALTERNATE_CONTENT_NODE;
|
|
32133
|
+
const isSupportedChoice = (choice) => {
|
|
32134
|
+
if (!choice?.attributes) return false;
|
|
32135
|
+
const requires = choice.attributes.Requires || choice.attributes.requires;
|
|
32136
|
+
if (!requires) return false;
|
|
32137
|
+
return requires.split(/\s+/).filter(Boolean).some((namespace) => SUPPORTED_REQUIRES.has(namespace));
|
|
32138
|
+
};
|
|
32139
|
+
const resolveAlternateContentElements = (alternateContent) => {
|
|
32140
|
+
if (!alternateContent?.elements?.length) return null;
|
|
32141
|
+
const choices = alternateContent.elements.filter((el) => el.name === "mc:Choice");
|
|
32142
|
+
const fallback = alternateContent.elements.find((el) => el.name === "mc:Fallback");
|
|
32143
|
+
const supportedChoice = choices.find(isSupportedChoice);
|
|
32144
|
+
const selectedElements = supportedChoice?.elements || fallback?.elements || choices[0]?.elements;
|
|
32145
|
+
if (!selectedElements) return null;
|
|
32146
|
+
return carbonCopy(selectedElements);
|
|
32147
|
+
};
|
|
32148
|
+
const buildNodeWithoutAlternateContent = (node) => {
|
|
32149
|
+
const { elements } = node || {};
|
|
32150
|
+
if (!elements?.length) return null;
|
|
32151
|
+
let replaced = false;
|
|
32152
|
+
const updatedElements = [];
|
|
32153
|
+
elements.forEach((element) => {
|
|
32154
|
+
if (isAlternateContentNode(element)) {
|
|
32155
|
+
const resolved = resolveAlternateContentElements(element);
|
|
32156
|
+
if (resolved) {
|
|
32157
|
+
updatedElements.push(...resolved);
|
|
32158
|
+
replaced = true;
|
|
32159
|
+
return;
|
|
32160
|
+
}
|
|
32161
|
+
updatedElements.push(carbonCopy(element));
|
|
32162
|
+
return;
|
|
32163
|
+
}
|
|
32164
|
+
updatedElements.push(carbonCopy(element));
|
|
32165
|
+
});
|
|
32166
|
+
if (!replaced) return null;
|
|
32167
|
+
const clone = carbonCopy(node);
|
|
32168
|
+
clone.elements = updatedElements;
|
|
32169
|
+
return clone;
|
|
32170
|
+
};
|
|
31936
32171
|
const handleAlternateChoice = (params) => {
|
|
31937
|
-
const skipHandlerResponse = { nodes: [], consumed: 0 };
|
|
31938
32172
|
const { nodes, nodeListHandler } = params;
|
|
31939
|
-
if (nodes
|
|
32173
|
+
if (!nodes?.length) {
|
|
31940
32174
|
return skipHandlerResponse;
|
|
31941
32175
|
}
|
|
31942
|
-
const
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
32176
|
+
const [currentNode] = nodes;
|
|
32177
|
+
if (isAlternateContentNode(currentNode)) {
|
|
32178
|
+
const resolvedElements = resolveAlternateContentElements(currentNode);
|
|
32179
|
+
if (!resolvedElements) {
|
|
32180
|
+
return skipHandlerResponse;
|
|
32181
|
+
}
|
|
32182
|
+
const result2 = nodeListHandler.handler({
|
|
32183
|
+
...params,
|
|
32184
|
+
nodes: resolvedElements,
|
|
32185
|
+
path: [...params.path || [], currentNode]
|
|
32186
|
+
});
|
|
32187
|
+
return { nodes: result2, consumed: 1 };
|
|
31947
32188
|
}
|
|
31948
|
-
const
|
|
31949
|
-
|
|
31950
|
-
const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
|
|
31951
|
-
const wpsNode = altChoiceNode.elements.find(
|
|
31952
|
-
(el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
|
|
31953
|
-
);
|
|
31954
|
-
if (!wpsNode) {
|
|
32189
|
+
const sanitizedNode = buildNodeWithoutAlternateContent(currentNode);
|
|
32190
|
+
if (!sanitizedNode) {
|
|
31955
32191
|
return skipHandlerResponse;
|
|
31956
32192
|
}
|
|
31957
|
-
const contents = wpsNode.elements;
|
|
31958
32193
|
const result = nodeListHandler.handler({
|
|
31959
32194
|
...params,
|
|
31960
|
-
nodes:
|
|
31961
|
-
path: [...params.path || [],
|
|
32195
|
+
nodes: [sanitizedNode],
|
|
32196
|
+
path: [...params.path || [], sanitizedNode]
|
|
31962
32197
|
});
|
|
31963
32198
|
return { nodes: result, consumed: 1 };
|
|
31964
32199
|
};
|
|
@@ -32564,7 +32799,7 @@ const handleTabNode = (params) => {
|
|
|
32564
32799
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
32565
32800
|
return { nodes: [], consumed: 0 };
|
|
32566
32801
|
}
|
|
32567
|
-
const node = translator$
|
|
32802
|
+
const node = translator$14.encode(params);
|
|
32568
32803
|
return { nodes: [node], consumed: 1 };
|
|
32569
32804
|
};
|
|
32570
32805
|
const tabNodeEntityHandler = {
|
|
@@ -32598,6 +32833,7 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
32598
32833
|
const nodeListHandler = defaultNodeListHandler();
|
|
32599
32834
|
const bodyNode = json.elements[0].elements.find((el) => el.name === "w:body");
|
|
32600
32835
|
if (bodyNode) {
|
|
32836
|
+
ensureSectionProperties(bodyNode);
|
|
32601
32837
|
const node = bodyNode;
|
|
32602
32838
|
const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
|
|
32603
32839
|
const content = pruneIgnoredNodes(contentElements);
|
|
@@ -32831,6 +33067,59 @@ function getDocumentStyles(node, docx, converter, editor) {
|
|
|
32831
33067
|
styles.alternateHeaders = isAlternatingHeadersOddEven(docx);
|
|
32832
33068
|
return styles;
|
|
32833
33069
|
}
|
|
33070
|
+
const DEFAULT_SECTION_PROPS = Object.freeze({
|
|
33071
|
+
pageSize: Object.freeze({ width: "12240", height: "15840" }),
|
|
33072
|
+
pageMargins: Object.freeze({
|
|
33073
|
+
top: "1440",
|
|
33074
|
+
right: "1440",
|
|
33075
|
+
bottom: "1440",
|
|
33076
|
+
left: "1440",
|
|
33077
|
+
header: "720",
|
|
33078
|
+
footer: "720",
|
|
33079
|
+
gutter: "0"
|
|
33080
|
+
})
|
|
33081
|
+
});
|
|
33082
|
+
function ensureSectionProperties(bodyNode, converter) {
|
|
33083
|
+
if (!bodyNode.elements) bodyNode.elements = [];
|
|
33084
|
+
let sectPr = bodyNode.elements.find((el) => el.name === "w:sectPr");
|
|
33085
|
+
if (!sectPr) {
|
|
33086
|
+
sectPr = {
|
|
33087
|
+
type: "element",
|
|
33088
|
+
name: "w:sectPr",
|
|
33089
|
+
elements: []
|
|
33090
|
+
};
|
|
33091
|
+
bodyNode.elements.push(sectPr);
|
|
33092
|
+
} else if (!sectPr.elements) {
|
|
33093
|
+
sectPr.elements = [];
|
|
33094
|
+
}
|
|
33095
|
+
const ensureChild = (name, factory) => {
|
|
33096
|
+
let child = sectPr.elements.find((el) => el.name === name);
|
|
33097
|
+
if (!child) {
|
|
33098
|
+
child = factory();
|
|
33099
|
+
sectPr.elements.push(child);
|
|
33100
|
+
} else if (!child.attributes) {
|
|
33101
|
+
child.attributes = {};
|
|
33102
|
+
}
|
|
33103
|
+
return child;
|
|
33104
|
+
};
|
|
33105
|
+
const pgSz = ensureChild("w:pgSz", () => ({
|
|
33106
|
+
type: "element",
|
|
33107
|
+
name: "w:pgSz",
|
|
33108
|
+
attributes: {}
|
|
33109
|
+
}));
|
|
33110
|
+
pgSz.attributes["w:w"] = pgSz.attributes["w:w"] ?? DEFAULT_SECTION_PROPS.pageSize.width;
|
|
33111
|
+
pgSz.attributes["w:h"] = pgSz.attributes["w:h"] ?? DEFAULT_SECTION_PROPS.pageSize.height;
|
|
33112
|
+
const pgMar = ensureChild("w:pgMar", () => ({
|
|
33113
|
+
type: "element",
|
|
33114
|
+
name: "w:pgMar",
|
|
33115
|
+
attributes: {}
|
|
33116
|
+
}));
|
|
33117
|
+
Object.entries(DEFAULT_SECTION_PROPS.pageMargins).forEach(([key, value]) => {
|
|
33118
|
+
const attrKey = `w:${key}`;
|
|
33119
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
33120
|
+
});
|
|
33121
|
+
return sectPr;
|
|
33122
|
+
}
|
|
32834
33123
|
function getStyleDefinitions(docx) {
|
|
32835
33124
|
const styles = docx["word/styles.xml"];
|
|
32836
33125
|
if (!styles) return [];
|
|
@@ -33023,6 +33312,36 @@ const FONT_FAMILY_FALLBACKS = Object.freeze({
|
|
|
33023
33312
|
auto: "sans-serif"
|
|
33024
33313
|
});
|
|
33025
33314
|
const DEFAULT_GENERIC_FALLBACK = "sans-serif";
|
|
33315
|
+
const DEFAULT_FONT_SIZE_PT = 10;
|
|
33316
|
+
const collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state: state2 }) => {
|
|
33317
|
+
if (!runProps?.elements?.length || !state2) return;
|
|
33318
|
+
const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
|
|
33319
|
+
if (fontsNode?.attributes) {
|
|
33320
|
+
const themeName = fontsNode.attributes["w:asciiTheme"];
|
|
33321
|
+
if (themeName) {
|
|
33322
|
+
const themeInfo = themeResolver?.(themeName) || {};
|
|
33323
|
+
if ((allowOverrideTypeface || !state2.typeface) && themeInfo.typeface) state2.typeface = themeInfo.typeface;
|
|
33324
|
+
if ((allowOverrideTypeface || !state2.panose) && themeInfo.panose) state2.panose = themeInfo.panose;
|
|
33325
|
+
}
|
|
33326
|
+
const ascii = fontsNode.attributes["w:ascii"];
|
|
33327
|
+
if ((allowOverrideTypeface || !state2.typeface) && ascii) {
|
|
33328
|
+
state2.typeface = ascii;
|
|
33329
|
+
}
|
|
33330
|
+
}
|
|
33331
|
+
const sizeNode = runProps.elements.find((el) => el.name === "w:sz");
|
|
33332
|
+
if (sizeNode?.attributes?.["w:val"]) {
|
|
33333
|
+
const sizeTwips = Number(sizeNode.attributes["w:val"]);
|
|
33334
|
+
if (Number.isFinite(sizeTwips)) {
|
|
33335
|
+
if (state2.fallbackSzTwips === void 0) state2.fallbackSzTwips = sizeTwips;
|
|
33336
|
+
const sizePt = sizeTwips / 2;
|
|
33337
|
+
if (allowOverrideSize || state2.fontSizePt === void 0) state2.fontSizePt = sizePt;
|
|
33338
|
+
}
|
|
33339
|
+
}
|
|
33340
|
+
const kernNode = runProps.elements.find((el) => el.name === "w:kern");
|
|
33341
|
+
if (kernNode?.attributes?.["w:val"]) {
|
|
33342
|
+
if (allowOverrideSize || state2.kern === void 0) state2.kern = kernNode.attributes["w:val"];
|
|
33343
|
+
}
|
|
33344
|
+
};
|
|
33026
33345
|
const _SuperConverter = class _SuperConverter {
|
|
33027
33346
|
constructor(params = null) {
|
|
33028
33347
|
__privateAdd(this, _SuperConverter_instances);
|
|
@@ -33128,7 +33447,7 @@ const _SuperConverter = class _SuperConverter {
|
|
|
33128
33447
|
return;
|
|
33129
33448
|
}
|
|
33130
33449
|
}
|
|
33131
|
-
static updateDocumentVersion(docx = this.convertedXml, version = "0.
|
|
33450
|
+
static updateDocumentVersion(docx = this.convertedXml, version = "0.21.2") {
|
|
33132
33451
|
const customLocation = "docProps/custom.xml";
|
|
33133
33452
|
if (!docx[customLocation]) {
|
|
33134
33453
|
docx[customLocation] = generateCustomXml();
|
|
@@ -33150,49 +33469,45 @@ const _SuperConverter = class _SuperConverter {
|
|
|
33150
33469
|
}
|
|
33151
33470
|
getDocumentDefaultStyles() {
|
|
33152
33471
|
const styles = this.convertedXml["word/styles.xml"];
|
|
33153
|
-
|
|
33154
|
-
const
|
|
33155
|
-
|
|
33156
|
-
|
|
33157
|
-
const
|
|
33158
|
-
const
|
|
33159
|
-
|
|
33160
|
-
|
|
33161
|
-
|
|
33162
|
-
|
|
33163
|
-
|
|
33164
|
-
|
|
33165
|
-
|
|
33166
|
-
|
|
33167
|
-
|
|
33168
|
-
|
|
33169
|
-
|
|
33170
|
-
|
|
33171
|
-
|
|
33172
|
-
|
|
33173
|
-
|
|
33174
|
-
|
|
33175
|
-
|
|
33176
|
-
|
|
33177
|
-
|
|
33178
|
-
|
|
33179
|
-
|
|
33180
|
-
|
|
33181
|
-
|
|
33182
|
-
|
|
33183
|
-
|
|
33184
|
-
|
|
33185
|
-
|
|
33186
|
-
|
|
33187
|
-
|
|
33188
|
-
|
|
33189
|
-
|
|
33190
|
-
|
|
33191
|
-
|
|
33192
|
-
const kern = rElements.find((el) => el.name === "w:kern")?.attributes["w:val"];
|
|
33193
|
-
const fontFamilyCss = _SuperConverter.toCssFontFamily(typeface, this.convertedXml);
|
|
33194
|
-
return { fontSizePt, kern, typeface, panose, fontFamilyCss };
|
|
33195
|
-
}
|
|
33472
|
+
const styleRoot = styles?.elements?.[0];
|
|
33473
|
+
const styleElements = styleRoot?.elements || [];
|
|
33474
|
+
if (!styleElements.length) return {};
|
|
33475
|
+
const defaults = styleElements.find((el) => el.name === "w:docDefaults");
|
|
33476
|
+
const normalStyle = styleElements.find((el) => el.name === "w:style" && el.attributes?.["w:styleId"] === "Normal");
|
|
33477
|
+
const defaultsState = {
|
|
33478
|
+
typeface: void 0,
|
|
33479
|
+
panose: void 0,
|
|
33480
|
+
fontSizePt: void 0,
|
|
33481
|
+
kern: void 0,
|
|
33482
|
+
fallbackSzTwips: void 0
|
|
33483
|
+
};
|
|
33484
|
+
const docDefaultRun = defaults?.elements?.find((el) => el.name === "w:rPrDefault");
|
|
33485
|
+
const docDefaultProps = docDefaultRun?.elements?.find((el) => el.name === "w:rPr") ?? docDefaultRun;
|
|
33486
|
+
collectRunDefaultProperties(docDefaultProps, {
|
|
33487
|
+
allowOverrideTypeface: true,
|
|
33488
|
+
allowOverrideSize: true,
|
|
33489
|
+
themeResolver: (theme) => this.getThemeInfo(theme),
|
|
33490
|
+
state: defaultsState
|
|
33491
|
+
});
|
|
33492
|
+
const normalRunProps = normalStyle?.elements?.find((el) => el.name === "w:rPr") ?? null;
|
|
33493
|
+
collectRunDefaultProperties(normalRunProps, {
|
|
33494
|
+
allowOverrideTypeface: true,
|
|
33495
|
+
allowOverrideSize: true,
|
|
33496
|
+
themeResolver: (theme) => this.getThemeInfo(theme),
|
|
33497
|
+
state: defaultsState
|
|
33498
|
+
});
|
|
33499
|
+
if (defaultsState.fontSizePt === void 0) {
|
|
33500
|
+
if (Number.isFinite(defaultsState.fallbackSzTwips)) defaultsState.fontSizePt = defaultsState.fallbackSzTwips / 2;
|
|
33501
|
+
else defaultsState.fontSizePt = DEFAULT_FONT_SIZE_PT;
|
|
33502
|
+
}
|
|
33503
|
+
const fontFamilyCss = defaultsState.typeface ? _SuperConverter.toCssFontFamily(defaultsState.typeface, this.convertedXml) : void 0;
|
|
33504
|
+
const result = {};
|
|
33505
|
+
if (defaultsState.fontSizePt !== void 0) result.fontSizePt = defaultsState.fontSizePt;
|
|
33506
|
+
if (defaultsState.kern !== void 0) result.kern = defaultsState.kern;
|
|
33507
|
+
if (defaultsState.typeface) result.typeface = defaultsState.typeface;
|
|
33508
|
+
if (defaultsState.panose) result.panose = defaultsState.panose;
|
|
33509
|
+
if (fontFamilyCss) result.fontFamilyCss = fontFamilyCss;
|
|
33510
|
+
return result;
|
|
33196
33511
|
}
|
|
33197
33512
|
getDocumentFonts() {
|
|
33198
33513
|
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
@@ -33624,7 +33939,7 @@ function storeSuperdocVersion(docx) {
|
|
|
33624
33939
|
function generateCustomXml() {
|
|
33625
33940
|
return DEFAULT_CUSTOM_XML;
|
|
33626
33941
|
}
|
|
33627
|
-
function generateSuperdocVersion(pid = 2, version = "0.
|
|
33942
|
+
function generateSuperdocVersion(pid = 2, version = "0.21.2") {
|
|
33628
33943
|
return {
|
|
33629
33944
|
type: "element",
|
|
33630
33945
|
name: "property",
|
|
@@ -33677,7 +33992,7 @@ export {
|
|
|
33677
33992
|
objectIncludes as Z,
|
|
33678
33993
|
AddMarkStep as _,
|
|
33679
33994
|
Plugin as a,
|
|
33680
|
-
translator$
|
|
33995
|
+
translator$M as a$,
|
|
33681
33996
|
twipsToLines as a0,
|
|
33682
33997
|
pixelsToTwips as a1,
|
|
33683
33998
|
helpers as a2,
|
|
@@ -33692,29 +34007,29 @@ export {
|
|
|
33692
34007
|
handleClipboardPaste as aB,
|
|
33693
34008
|
getFileObject as aC,
|
|
33694
34009
|
runPropertyTranslators as aD,
|
|
33695
|
-
translator as aE,
|
|
33696
|
-
translator$
|
|
33697
|
-
translator$
|
|
33698
|
-
translator$
|
|
33699
|
-
translator$
|
|
33700
|
-
translator$
|
|
33701
|
-
translator$
|
|
33702
|
-
translator$
|
|
33703
|
-
translator$
|
|
33704
|
-
translator$
|
|
33705
|
-
translator$
|
|
33706
|
-
translator$
|
|
33707
|
-
translator$
|
|
33708
|
-
translator$
|
|
33709
|
-
translator$
|
|
33710
|
-
translator$
|
|
33711
|
-
translator$
|
|
33712
|
-
translator$
|
|
33713
|
-
translator$
|
|
33714
|
-
translator$
|
|
33715
|
-
translator$
|
|
33716
|
-
translator$
|
|
33717
|
-
translator$
|
|
34010
|
+
translator$5 as aE,
|
|
34011
|
+
translator$6 as aF,
|
|
34012
|
+
translator$I as aG,
|
|
34013
|
+
translator$J as aH,
|
|
34014
|
+
translator$10 as aI,
|
|
34015
|
+
translator$H as aJ,
|
|
34016
|
+
translator$K as aK,
|
|
34017
|
+
translator$G as aL,
|
|
34018
|
+
translator$g as aM,
|
|
34019
|
+
translator$8 as aN,
|
|
34020
|
+
translator$t as aO,
|
|
34021
|
+
translator$u as aP,
|
|
34022
|
+
translator$v as aQ,
|
|
34023
|
+
translator$w as aR,
|
|
34024
|
+
translator$x as aS,
|
|
34025
|
+
translator$c as aT,
|
|
34026
|
+
translator$y as aU,
|
|
34027
|
+
translator$z as aV,
|
|
34028
|
+
translator$A as aW,
|
|
34029
|
+
translator$B as aX,
|
|
34030
|
+
translator$L as aY,
|
|
34031
|
+
translator$a as aZ,
|
|
34032
|
+
translator$C as a_,
|
|
33718
34033
|
hasSomeParentWithClass as aa,
|
|
33719
34034
|
isActive as ab,
|
|
33720
34035
|
unflattenListsInHtml as ac,
|
|
@@ -33742,9 +34057,48 @@ export {
|
|
|
33742
34057
|
vClickOutside as ay,
|
|
33743
34058
|
getActiveFormatting as az,
|
|
33744
34059
|
Slice as b,
|
|
33745
|
-
translator$
|
|
33746
|
-
translator$
|
|
33747
|
-
|
|
34060
|
+
translator$d as b0,
|
|
34061
|
+
translator$D as b1,
|
|
34062
|
+
translator$e as b2,
|
|
34063
|
+
translator$9 as b3,
|
|
34064
|
+
translator$14 as b4,
|
|
34065
|
+
translator$W as b5,
|
|
34066
|
+
translator$X as b6,
|
|
34067
|
+
translator$$ as b7,
|
|
34068
|
+
translator$i as b8,
|
|
34069
|
+
translator$E as b9,
|
|
34070
|
+
translator$2 as bA,
|
|
34071
|
+
translator$1 as bB,
|
|
34072
|
+
translator$F as bC,
|
|
34073
|
+
translator$12 as bD,
|
|
34074
|
+
translator as bE,
|
|
34075
|
+
_sfc_main as bF,
|
|
34076
|
+
translator$3 as ba,
|
|
34077
|
+
translator$k as bb,
|
|
34078
|
+
translator$Y as bc,
|
|
34079
|
+
translator$V as bd,
|
|
34080
|
+
translator$Z as be,
|
|
34081
|
+
translator$U as bf,
|
|
34082
|
+
translator$13 as bg,
|
|
34083
|
+
translator$m as bh,
|
|
34084
|
+
translator$N as bi,
|
|
34085
|
+
translator$n as bj,
|
|
34086
|
+
translator$o as bk,
|
|
34087
|
+
translator$11 as bl,
|
|
34088
|
+
translator$7 as bm,
|
|
34089
|
+
translator$15 as bn,
|
|
34090
|
+
translator$O as bo,
|
|
34091
|
+
translator$b as bp,
|
|
34092
|
+
translator$P as bq,
|
|
34093
|
+
translator$Q as br,
|
|
34094
|
+
translator$q as bs,
|
|
34095
|
+
translator$4 as bt,
|
|
34096
|
+
translator$R as bu,
|
|
34097
|
+
translator$_ as bv,
|
|
34098
|
+
translator$S as bw,
|
|
34099
|
+
translator$T as bx,
|
|
34100
|
+
translator$16 as by,
|
|
34101
|
+
translator$s as bz,
|
|
33748
34102
|
DOMParser$1 as c,
|
|
33749
34103
|
Mark as d,
|
|
33750
34104
|
dropPoint as e,
|