@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
|
@@ -24333,37 +24333,37 @@ const _NodeTranslator = class _NodeTranslator2 {
|
|
|
24333
24333
|
};
|
|
24334
24334
|
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
24335
24335
|
let NodeTranslator = _NodeTranslator;
|
|
24336
|
-
const encode$
|
|
24336
|
+
const encode$18 = (attributes) => {
|
|
24337
24337
|
return attributes["w:type"];
|
|
24338
24338
|
};
|
|
24339
|
-
const decode
|
|
24339
|
+
const decode$$ = (attrs) => {
|
|
24340
24340
|
const { lineBreakType } = attrs;
|
|
24341
24341
|
return lineBreakType;
|
|
24342
24342
|
};
|
|
24343
24343
|
const attrConfig$F = Object.freeze({
|
|
24344
24344
|
xmlName: "w:type",
|
|
24345
24345
|
sdName: "lineBreakType",
|
|
24346
|
-
encode: encode$
|
|
24347
|
-
decode: decode
|
|
24346
|
+
encode: encode$18,
|
|
24347
|
+
decode: decode$$
|
|
24348
24348
|
});
|
|
24349
|
-
const encode$
|
|
24349
|
+
const encode$17 = (attributes) => {
|
|
24350
24350
|
const xmlAttrValue = attributes["w:clear"];
|
|
24351
24351
|
return xmlAttrValue;
|
|
24352
24352
|
};
|
|
24353
|
-
const decode$
|
|
24353
|
+
const decode$_ = (attrs) => {
|
|
24354
24354
|
const { clear } = attrs;
|
|
24355
24355
|
return clear;
|
|
24356
24356
|
};
|
|
24357
24357
|
const attrConfig$E = Object.freeze({
|
|
24358
24358
|
xmlName: "w:clear",
|
|
24359
24359
|
sdName: "clear",
|
|
24360
|
-
encode: encode$
|
|
24361
|
-
decode: decode$
|
|
24360
|
+
encode: encode$17,
|
|
24361
|
+
decode: decode$_
|
|
24362
24362
|
});
|
|
24363
|
-
const validXmlAttributes$
|
|
24364
|
-
const XML_NODE_NAME$
|
|
24365
|
-
const SD_NODE_NAME$
|
|
24366
|
-
const encode$
|
|
24363
|
+
const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
|
|
24364
|
+
const XML_NODE_NAME$u = "w:br";
|
|
24365
|
+
const SD_NODE_NAME$d = "lineBreak";
|
|
24366
|
+
const encode$16 = (_2, encodedAttrs) => {
|
|
24367
24367
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
24368
24368
|
const translated = {
|
|
24369
24369
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -24373,7 +24373,7 @@ const encode$15 = (_2, encodedAttrs) => {
|
|
|
24373
24373
|
}
|
|
24374
24374
|
return translated;
|
|
24375
24375
|
};
|
|
24376
|
-
const decode$
|
|
24376
|
+
const decode$Z = (params2, decodedAttrs) => {
|
|
24377
24377
|
const { node } = params2;
|
|
24378
24378
|
if (!node) return;
|
|
24379
24379
|
const wBreak = { name: "w:br" };
|
|
@@ -24390,39 +24390,39 @@ const decode$Y = (params2, decodedAttrs) => {
|
|
|
24390
24390
|
};
|
|
24391
24391
|
return translated;
|
|
24392
24392
|
};
|
|
24393
|
-
const config$
|
|
24394
|
-
xmlName: XML_NODE_NAME$
|
|
24395
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24393
|
+
const config$s = {
|
|
24394
|
+
xmlName: XML_NODE_NAME$u,
|
|
24395
|
+
sdNodeOrKeyName: SD_NODE_NAME$d,
|
|
24396
24396
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24397
|
-
encode: encode$
|
|
24398
|
-
decode: decode$
|
|
24399
|
-
attributes: validXmlAttributes$
|
|
24397
|
+
encode: encode$16,
|
|
24398
|
+
decode: decode$Z,
|
|
24399
|
+
attributes: validXmlAttributes$m
|
|
24400
24400
|
};
|
|
24401
|
-
const translator$
|
|
24402
|
-
const encode$
|
|
24403
|
-
const decode$
|
|
24401
|
+
const translator$16 = NodeTranslator.from(config$s);
|
|
24402
|
+
const encode$15 = (attributes) => attributes?.["w:val"];
|
|
24403
|
+
const decode$Y = (attrs) => attrs?.highlight;
|
|
24404
24404
|
const attrConfig$D = Object.freeze({
|
|
24405
24405
|
xmlName: "w:val",
|
|
24406
24406
|
sdName: "highlight",
|
|
24407
|
-
encode: encode$
|
|
24408
|
-
decode: decode$
|
|
24407
|
+
encode: encode$15,
|
|
24408
|
+
decode: decode$Y
|
|
24409
24409
|
});
|
|
24410
|
-
const validXmlAttributes$
|
|
24411
|
-
const XML_NODE_NAME$
|
|
24410
|
+
const validXmlAttributes$l = [attrConfig$D];
|
|
24411
|
+
const XML_NODE_NAME$t = "w:highlight";
|
|
24412
24412
|
const SD_ATTR_KEY$f = "highlight";
|
|
24413
24413
|
const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
|
|
24414
|
-
const encode$
|
|
24414
|
+
const encode$14 = (params2, encodedAttrs = {}) => {
|
|
24415
24415
|
const { nodes } = params2;
|
|
24416
24416
|
const node = nodes?.[0];
|
|
24417
24417
|
const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
|
|
24418
24418
|
return {
|
|
24419
24419
|
type: "attr",
|
|
24420
|
-
xmlName: XML_NODE_NAME$
|
|
24420
|
+
xmlName: XML_NODE_NAME$t,
|
|
24421
24421
|
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
24422
24422
|
attributes: { "w:val": value ?? null }
|
|
24423
24423
|
};
|
|
24424
24424
|
};
|
|
24425
|
-
const decode$
|
|
24425
|
+
const decode$X = (params2) => {
|
|
24426
24426
|
const attrs = params2?.node?.attrs || {};
|
|
24427
24427
|
const highlightValue = attrs.highlight ?? attrs.color ?? null;
|
|
24428
24428
|
if (!highlightValue) return void 0;
|
|
@@ -24430,14 +24430,14 @@ const decode$W = (params2) => {
|
|
|
24430
24430
|
if (!normalizedValue) return void 0;
|
|
24431
24431
|
if (DISABLED_TOKENS.has(normalizedValue)) {
|
|
24432
24432
|
return {
|
|
24433
|
-
name: XML_NODE_NAME$
|
|
24433
|
+
name: XML_NODE_NAME$t,
|
|
24434
24434
|
attributes: { "w:val": "none" }
|
|
24435
24435
|
};
|
|
24436
24436
|
}
|
|
24437
24437
|
const keyword = getDocxHighlightKeywordFromHex(highlightValue);
|
|
24438
24438
|
if (keyword) {
|
|
24439
24439
|
return {
|
|
24440
|
-
name: XML_NODE_NAME$
|
|
24440
|
+
name: XML_NODE_NAME$t,
|
|
24441
24441
|
attributes: { "w:val": keyword }
|
|
24442
24442
|
};
|
|
24443
24443
|
}
|
|
@@ -24452,63 +24452,63 @@ const decode$W = (params2) => {
|
|
|
24452
24452
|
}
|
|
24453
24453
|
};
|
|
24454
24454
|
};
|
|
24455
|
-
const config$
|
|
24456
|
-
xmlName: XML_NODE_NAME$
|
|
24455
|
+
const config$r = {
|
|
24456
|
+
xmlName: XML_NODE_NAME$t,
|
|
24457
24457
|
sdNodeOrKeyName: SD_ATTR_KEY$f,
|
|
24458
24458
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
24459
|
-
encode: encode$
|
|
24460
|
-
decode: decode$
|
|
24461
|
-
attributes: validXmlAttributes$
|
|
24459
|
+
encode: encode$14,
|
|
24460
|
+
decode: decode$X,
|
|
24461
|
+
attributes: validXmlAttributes$l
|
|
24462
24462
|
};
|
|
24463
|
-
const translator$
|
|
24464
|
-
const encode$
|
|
24463
|
+
const translator$15 = NodeTranslator.from(config$r);
|
|
24464
|
+
const encode$13 = (attributes) => {
|
|
24465
24465
|
return attributes["w:val"];
|
|
24466
24466
|
};
|
|
24467
|
-
const decode$
|
|
24467
|
+
const decode$W = (attrs) => {
|
|
24468
24468
|
const { tabSize } = attrs || {};
|
|
24469
24469
|
return tabSize;
|
|
24470
24470
|
};
|
|
24471
24471
|
const attrConfig$C = Object.freeze({
|
|
24472
24472
|
xmlName: "w:val",
|
|
24473
24473
|
sdName: "tabSize",
|
|
24474
|
-
encode: encode$
|
|
24475
|
-
decode: decode$
|
|
24474
|
+
encode: encode$13,
|
|
24475
|
+
decode: decode$W
|
|
24476
24476
|
});
|
|
24477
|
-
const encode$
|
|
24477
|
+
const encode$12 = (attributes) => {
|
|
24478
24478
|
return attributes["w:leader"];
|
|
24479
24479
|
};
|
|
24480
|
-
const decode$
|
|
24480
|
+
const decode$V = (attrs) => {
|
|
24481
24481
|
const { leader } = attrs || {};
|
|
24482
24482
|
return leader;
|
|
24483
24483
|
};
|
|
24484
24484
|
const attrConfig$B = Object.freeze({
|
|
24485
24485
|
xmlName: "w:leader",
|
|
24486
24486
|
sdName: "leader",
|
|
24487
|
-
encode: encode$
|
|
24488
|
-
decode: decode$
|
|
24487
|
+
encode: encode$12,
|
|
24488
|
+
decode: decode$V
|
|
24489
24489
|
});
|
|
24490
|
-
const encode$
|
|
24490
|
+
const encode$11 = (attributes) => {
|
|
24491
24491
|
return attributes["w:pos"];
|
|
24492
24492
|
};
|
|
24493
|
-
const decode$
|
|
24493
|
+
const decode$U = (attrs) => {
|
|
24494
24494
|
const { pos } = attrs || {};
|
|
24495
24495
|
return pos;
|
|
24496
24496
|
};
|
|
24497
24497
|
const attrConfig$A = Object.freeze({
|
|
24498
24498
|
xmlName: "w:pos",
|
|
24499
24499
|
sdName: "pos",
|
|
24500
|
-
encode: encode$
|
|
24501
|
-
decode: decode$
|
|
24500
|
+
encode: encode$11,
|
|
24501
|
+
decode: decode$U
|
|
24502
24502
|
});
|
|
24503
|
-
const validXmlAttributes$
|
|
24504
|
-
const XML_NODE_NAME$
|
|
24505
|
-
const SD_NODE_NAME$
|
|
24506
|
-
const encode
|
|
24503
|
+
const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
|
|
24504
|
+
const XML_NODE_NAME$s = "w:tab";
|
|
24505
|
+
const SD_NODE_NAME$c = "tab";
|
|
24506
|
+
const encode$10 = (_2, encodedAttrs = {}) => {
|
|
24507
24507
|
const translated = { type: "tab" };
|
|
24508
24508
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
24509
24509
|
return translated;
|
|
24510
24510
|
};
|
|
24511
|
-
const decode$
|
|
24511
|
+
const decode$T = (params2, decodedAttrs = {}) => {
|
|
24512
24512
|
const { node } = params2 || {};
|
|
24513
24513
|
if (!node) return;
|
|
24514
24514
|
const wTab = { name: "w:tab" };
|
|
@@ -24524,15 +24524,15 @@ const decode$S = (params2, decodedAttrs = {}) => {
|
|
|
24524
24524
|
}
|
|
24525
24525
|
return translated;
|
|
24526
24526
|
};
|
|
24527
|
-
const config$
|
|
24528
|
-
xmlName: XML_NODE_NAME$
|
|
24529
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24527
|
+
const config$q = {
|
|
24528
|
+
xmlName: XML_NODE_NAME$s,
|
|
24529
|
+
sdNodeOrKeyName: SD_NODE_NAME$c,
|
|
24530
24530
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24531
|
-
encode: encode
|
|
24532
|
-
decode: decode$
|
|
24533
|
-
attributes: validXmlAttributes$
|
|
24531
|
+
encode: encode$10,
|
|
24532
|
+
decode: decode$T,
|
|
24533
|
+
attributes: validXmlAttributes$k
|
|
24534
24534
|
};
|
|
24535
|
-
const translator$
|
|
24535
|
+
const translator$14 = NodeTranslator.from(config$q);
|
|
24536
24536
|
const mergeTextNodes = (nodes) => {
|
|
24537
24537
|
if (!nodes || !Array.isArray(nodes)) {
|
|
24538
24538
|
return nodes;
|
|
@@ -24856,17 +24856,16 @@ const getParagraphSpacing = (node, docx, styleId = "", marks = [], options = {})
|
|
|
24856
24856
|
};
|
|
24857
24857
|
const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
24858
24858
|
const styles = docx["word/styles.xml"];
|
|
24859
|
-
|
|
24859
|
+
const rootElements = styles?.elements?.[0]?.elements;
|
|
24860
|
+
if (!rootElements?.length) {
|
|
24860
24861
|
return {};
|
|
24861
24862
|
}
|
|
24862
|
-
const defaults =
|
|
24863
|
-
const pDefault = defaults
|
|
24863
|
+
const defaults = rootElements.find((el) => el.name === "w:docDefaults");
|
|
24864
|
+
const pDefault = defaults?.elements?.find((el) => el.name === "w:pPrDefault") || {};
|
|
24864
24865
|
const pPrDefault = pDefault?.elements?.find((el) => el.name === "w:pPr");
|
|
24865
24866
|
const pPrDefaultSpacingTag = pPrDefault?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24866
24867
|
const pPrDefaultIndentTag = pPrDefault?.elements?.find((el) => el.name === "w:ind") || {};
|
|
24867
|
-
const stylesNormal =
|
|
24868
|
-
(el) => el.name === "w:style" && el.attributes["w:styleId"] === "Normal"
|
|
24869
|
-
);
|
|
24868
|
+
const stylesNormal = rootElements.find((el) => el.name === "w:style" && el.attributes["w:styleId"] === "Normal");
|
|
24870
24869
|
const pPrNormal = stylesNormal?.elements?.find((el) => el.name === "w:pPr");
|
|
24871
24870
|
const pPrNormalSpacingTag = pPrNormal?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24872
24871
|
const pPrNormalIndentTag = pPrNormal?.elements?.find((el) => el.name === "w:ind") || {};
|
|
@@ -24875,9 +24874,7 @@ const getDefaultParagraphStyle = (docx, styleId = "") => {
|
|
|
24875
24874
|
let pPrStyleIdIndentTag = {};
|
|
24876
24875
|
let pPrStyleJc = {};
|
|
24877
24876
|
if (styleId) {
|
|
24878
|
-
const stylesById =
|
|
24879
|
-
(el) => el.name === "w:style" && el.attributes["w:styleId"] === styleId
|
|
24880
|
-
);
|
|
24877
|
+
const stylesById = rootElements.find((el) => el.name === "w:style" && el.attributes["w:styleId"] === styleId);
|
|
24881
24878
|
const pPrById = stylesById?.elements?.find((el) => el.name === "w:pPr");
|
|
24882
24879
|
pPrStyleIdSpacingTag = pPrById?.elements?.find((el) => el.name === "w:spacing") || {};
|
|
24883
24880
|
pPrStyleIdIndentTag = pPrById?.elements?.find((el) => el.name === "w:ind") || {};
|
|
@@ -25147,91 +25144,91 @@ const handleParagraphNode$1 = (params2) => {
|
|
|
25147
25144
|
}
|
|
25148
25145
|
return schemaNode;
|
|
25149
25146
|
};
|
|
25150
|
-
const encode
|
|
25147
|
+
const encode$$ = (attributes) => {
|
|
25151
25148
|
return attributes["w:rsidDel"];
|
|
25152
25149
|
};
|
|
25153
|
-
const decode$
|
|
25150
|
+
const decode$S = (attrs) => {
|
|
25154
25151
|
return attrs.rsidDel;
|
|
25155
25152
|
};
|
|
25156
25153
|
const attrConfig$z = Object.freeze({
|
|
25157
25154
|
xmlName: "w:rsidDel",
|
|
25158
25155
|
sdName: "rsidDel",
|
|
25159
|
-
encode: encode
|
|
25160
|
-
decode: decode$
|
|
25156
|
+
encode: encode$$,
|
|
25157
|
+
decode: decode$S
|
|
25161
25158
|
});
|
|
25162
|
-
const encode$
|
|
25159
|
+
const encode$_ = (attributes) => {
|
|
25163
25160
|
return attributes["w:rsidP"];
|
|
25164
25161
|
};
|
|
25165
|
-
const decode$
|
|
25162
|
+
const decode$R = (attrs) => {
|
|
25166
25163
|
return attrs.rsidP;
|
|
25167
25164
|
};
|
|
25168
25165
|
const attrConfig$y = Object.freeze({
|
|
25169
25166
|
xmlName: "w:rsidP",
|
|
25170
25167
|
sdName: "rsidP",
|
|
25171
|
-
encode: encode$
|
|
25172
|
-
decode: decode$
|
|
25168
|
+
encode: encode$_,
|
|
25169
|
+
decode: decode$R
|
|
25173
25170
|
});
|
|
25174
|
-
const encode$
|
|
25171
|
+
const encode$Z = (attributes) => {
|
|
25175
25172
|
return attributes["w:rsidR"];
|
|
25176
25173
|
};
|
|
25177
|
-
const decode$
|
|
25174
|
+
const decode$Q = (attrs) => {
|
|
25178
25175
|
return attrs.rsidR;
|
|
25179
25176
|
};
|
|
25180
25177
|
const attrConfig$x = Object.freeze({
|
|
25181
25178
|
xmlName: "w:rsidR",
|
|
25182
25179
|
sdName: "rsidR",
|
|
25183
|
-
encode: encode$
|
|
25184
|
-
decode: decode$
|
|
25180
|
+
encode: encode$Z,
|
|
25181
|
+
decode: decode$Q
|
|
25185
25182
|
});
|
|
25186
|
-
const encode$
|
|
25183
|
+
const encode$Y = (attributes) => {
|
|
25187
25184
|
return attributes["w:rsidRPr"];
|
|
25188
25185
|
};
|
|
25189
|
-
const decode$
|
|
25186
|
+
const decode$P = (attrs) => {
|
|
25190
25187
|
return attrs.rsidRPr;
|
|
25191
25188
|
};
|
|
25192
25189
|
const attrConfig$w = Object.freeze({
|
|
25193
25190
|
xmlName: "w:rsidRPr",
|
|
25194
25191
|
sdName: "rsidRPr",
|
|
25195
|
-
encode: encode$
|
|
25196
|
-
decode: decode$
|
|
25192
|
+
encode: encode$Y,
|
|
25193
|
+
decode: decode$P
|
|
25197
25194
|
});
|
|
25198
|
-
const encode$
|
|
25195
|
+
const encode$X = (attributes) => {
|
|
25199
25196
|
return attributes["w:rsidRDefault"];
|
|
25200
25197
|
};
|
|
25201
|
-
const decode$
|
|
25198
|
+
const decode$O = (attrs) => {
|
|
25202
25199
|
return attrs.rsidRDefault;
|
|
25203
25200
|
};
|
|
25204
25201
|
const attrConfig$v = Object.freeze({
|
|
25205
25202
|
xmlName: "w:rsidRDefault",
|
|
25206
25203
|
sdName: "rsidRDefault",
|
|
25207
|
-
encode: encode$
|
|
25208
|
-
decode: decode$
|
|
25204
|
+
encode: encode$X,
|
|
25205
|
+
decode: decode$O
|
|
25209
25206
|
});
|
|
25210
|
-
const encode$
|
|
25207
|
+
const encode$W = (attributes) => {
|
|
25211
25208
|
return attributes["w14:paraId"];
|
|
25212
25209
|
};
|
|
25213
|
-
const decode$
|
|
25210
|
+
const decode$N = (attrs) => {
|
|
25214
25211
|
return attrs.paraId;
|
|
25215
25212
|
};
|
|
25216
25213
|
const attrConfig$u = Object.freeze({
|
|
25217
25214
|
xmlName: "w14:paraId",
|
|
25218
25215
|
sdName: "paraId",
|
|
25219
|
-
encode: encode$
|
|
25220
|
-
decode: decode$
|
|
25216
|
+
encode: encode$W,
|
|
25217
|
+
decode: decode$N
|
|
25221
25218
|
});
|
|
25222
|
-
const encode$
|
|
25219
|
+
const encode$V = (attributes) => {
|
|
25223
25220
|
return attributes["w14:textId"];
|
|
25224
25221
|
};
|
|
25225
|
-
const decode$
|
|
25222
|
+
const decode$M = (attrs) => {
|
|
25226
25223
|
return attrs.textId;
|
|
25227
25224
|
};
|
|
25228
25225
|
const attrConfig$t = Object.freeze({
|
|
25229
25226
|
xmlName: "w14:textId",
|
|
25230
25227
|
sdName: "textId",
|
|
25231
|
-
encode: encode$
|
|
25232
|
-
decode: decode$
|
|
25228
|
+
encode: encode$V,
|
|
25229
|
+
decode: decode$M
|
|
25233
25230
|
});
|
|
25234
|
-
const validXmlAttributes$
|
|
25231
|
+
const validXmlAttributes$j = [
|
|
25235
25232
|
attrConfig$u,
|
|
25236
25233
|
attrConfig$t,
|
|
25237
25234
|
attrConfig$x,
|
|
@@ -25240,9 +25237,9 @@ const validXmlAttributes$i = [
|
|
|
25240
25237
|
attrConfig$w,
|
|
25241
25238
|
attrConfig$z
|
|
25242
25239
|
];
|
|
25243
|
-
const XML_NODE_NAME$
|
|
25244
|
-
const SD_NODE_NAME$
|
|
25245
|
-
const encode$
|
|
25240
|
+
const XML_NODE_NAME$r = "w:p";
|
|
25241
|
+
const SD_NODE_NAME$b = "paragraph";
|
|
25242
|
+
const encode$U = (params2, encodedAttrs = {}) => {
|
|
25246
25243
|
const node = handleParagraphNode$1(params2);
|
|
25247
25244
|
if (!node) return void 0;
|
|
25248
25245
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -25250,7 +25247,7 @@ const encode$T = (params2, encodedAttrs = {}) => {
|
|
|
25250
25247
|
}
|
|
25251
25248
|
return node;
|
|
25252
25249
|
};
|
|
25253
|
-
const decode$
|
|
25250
|
+
const decode$L = (params2, decodedAttrs = {}) => {
|
|
25254
25251
|
const translated = translateParagraphNode(params2);
|
|
25255
25252
|
if (!translated) return void 0;
|
|
25256
25253
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -25258,16 +25255,16 @@ const decode$K = (params2, decodedAttrs = {}) => {
|
|
|
25258
25255
|
}
|
|
25259
25256
|
return translated;
|
|
25260
25257
|
};
|
|
25261
|
-
const config$
|
|
25262
|
-
xmlName: XML_NODE_NAME$
|
|
25263
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
25258
|
+
const config$p = {
|
|
25259
|
+
xmlName: XML_NODE_NAME$r,
|
|
25260
|
+
sdNodeOrKeyName: SD_NODE_NAME$b,
|
|
25264
25261
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25265
|
-
encode: encode$
|
|
25266
|
-
decode: decode$
|
|
25267
|
-
attributes: validXmlAttributes$
|
|
25262
|
+
encode: encode$U,
|
|
25263
|
+
decode: decode$L,
|
|
25264
|
+
attributes: validXmlAttributes$j
|
|
25268
25265
|
};
|
|
25269
|
-
const translator$
|
|
25270
|
-
const encode$
|
|
25266
|
+
const translator$13 = NodeTranslator.from(config$p);
|
|
25267
|
+
const encode$T = (attributes) => {
|
|
25271
25268
|
const raw = attributes?.["w:val"];
|
|
25272
25269
|
if (raw === void 0 || raw === null) return void 0;
|
|
25273
25270
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25277,20 +25274,20 @@ const encode$S = (attributes) => {
|
|
|
25277
25274
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25278
25275
|
return void 0;
|
|
25279
25276
|
};
|
|
25280
|
-
const decode$
|
|
25277
|
+
const decode$K = (runProps) => {
|
|
25281
25278
|
if (runProps?.bold === false) return "0";
|
|
25282
25279
|
return void 0;
|
|
25283
25280
|
};
|
|
25284
25281
|
const attrConfig$s = Object.freeze({
|
|
25285
25282
|
xmlName: "w:val",
|
|
25286
25283
|
sdName: "bold",
|
|
25287
|
-
encode: encode$
|
|
25288
|
-
decode: decode$
|
|
25284
|
+
encode: encode$T,
|
|
25285
|
+
decode: decode$K
|
|
25289
25286
|
});
|
|
25290
|
-
const validXmlAttributes$
|
|
25291
|
-
const XML_NODE_NAME$
|
|
25287
|
+
const validXmlAttributes$i = [attrConfig$s];
|
|
25288
|
+
const XML_NODE_NAME$q = "w:b";
|
|
25292
25289
|
const SD_ATTR_KEY$e = "bold";
|
|
25293
|
-
const encode$
|
|
25290
|
+
const encode$S = (params2, encodedAttrs = {}) => {
|
|
25294
25291
|
const { nodes } = params2;
|
|
25295
25292
|
const node = nodes[0];
|
|
25296
25293
|
if (!node) return void 0;
|
|
@@ -25302,85 +25299,85 @@ const encode$R = (params2, encodedAttrs = {}) => {
|
|
|
25302
25299
|
else attributes = node.attributes || {};
|
|
25303
25300
|
return {
|
|
25304
25301
|
type: "attr",
|
|
25305
|
-
xmlName: XML_NODE_NAME$
|
|
25302
|
+
xmlName: XML_NODE_NAME$q,
|
|
25306
25303
|
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25307
25304
|
attributes
|
|
25308
25305
|
};
|
|
25309
25306
|
};
|
|
25310
|
-
const config$
|
|
25311
|
-
xmlName: XML_NODE_NAME$
|
|
25307
|
+
const config$o = {
|
|
25308
|
+
xmlName: XML_NODE_NAME$q,
|
|
25312
25309
|
sdNodeOrKeyName: SD_ATTR_KEY$e,
|
|
25313
25310
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25314
|
-
encode: encode$
|
|
25315
|
-
attributes: validXmlAttributes$
|
|
25311
|
+
encode: encode$S,
|
|
25312
|
+
attributes: validXmlAttributes$i
|
|
25316
25313
|
};
|
|
25317
|
-
const translator$
|
|
25318
|
-
const XML_NODE_NAME$
|
|
25314
|
+
const translator$12 = NodeTranslator.from(config$o);
|
|
25315
|
+
const XML_NODE_NAME$p = "w:i";
|
|
25319
25316
|
const SD_ATTR_KEY$d = "italic";
|
|
25320
|
-
const encode$
|
|
25317
|
+
const encode$R = (params2) => {
|
|
25321
25318
|
const { nodes } = params2;
|
|
25322
25319
|
const node = nodes?.[0];
|
|
25323
25320
|
if (!node) return void 0;
|
|
25324
25321
|
return {
|
|
25325
25322
|
type: "attr",
|
|
25326
|
-
xmlName: XML_NODE_NAME$
|
|
25323
|
+
xmlName: XML_NODE_NAME$p,
|
|
25327
25324
|
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25328
25325
|
attributes: {
|
|
25329
25326
|
"w:val": node.attributes?.["w:val"] ?? null
|
|
25330
25327
|
}
|
|
25331
25328
|
};
|
|
25332
25329
|
};
|
|
25333
|
-
const config$
|
|
25334
|
-
xmlName: XML_NODE_NAME$
|
|
25330
|
+
const config$n = {
|
|
25331
|
+
xmlName: XML_NODE_NAME$p,
|
|
25335
25332
|
sdNodeOrKeyName: SD_ATTR_KEY$d,
|
|
25336
25333
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25337
|
-
encode: encode$
|
|
25334
|
+
encode: encode$R
|
|
25338
25335
|
};
|
|
25339
|
-
const translator$
|
|
25340
|
-
const encode$
|
|
25341
|
-
const decode$
|
|
25336
|
+
const translator$11 = NodeTranslator.from(config$n);
|
|
25337
|
+
const encode$Q = (attributes) => attributes?.["w:val"];
|
|
25338
|
+
const decode$J = (attrs) => attrs?.underline;
|
|
25342
25339
|
const attrConfig$r = Object.freeze({
|
|
25343
25340
|
xmlName: "w:val",
|
|
25344
25341
|
sdName: "underline",
|
|
25345
|
-
encode: encode$
|
|
25346
|
-
decode: decode$
|
|
25342
|
+
encode: encode$Q,
|
|
25343
|
+
decode: decode$J
|
|
25347
25344
|
});
|
|
25348
|
-
const encode$
|
|
25349
|
-
const decode$
|
|
25345
|
+
const encode$P = (attributes) => attributes?.["w:color"];
|
|
25346
|
+
const decode$I = (attrs) => attrs?.color;
|
|
25350
25347
|
const attrConfig$q = Object.freeze({
|
|
25351
25348
|
xmlName: "w:color",
|
|
25352
25349
|
sdName: "color",
|
|
25353
|
-
encode: encode$
|
|
25354
|
-
decode: decode$
|
|
25350
|
+
encode: encode$P,
|
|
25351
|
+
decode: decode$I
|
|
25355
25352
|
});
|
|
25356
|
-
const encode$
|
|
25357
|
-
const decode$
|
|
25353
|
+
const encode$O = (attributes) => attributes?.["w:themeColor"];
|
|
25354
|
+
const decode$H = (attrs) => attrs?.themeColor;
|
|
25358
25355
|
const attrConfig$p = Object.freeze({
|
|
25359
25356
|
xmlName: "w:themeColor",
|
|
25360
25357
|
sdName: "themeColor",
|
|
25361
|
-
encode: encode$
|
|
25362
|
-
decode: decode$
|
|
25358
|
+
encode: encode$O,
|
|
25359
|
+
decode: decode$H
|
|
25363
25360
|
});
|
|
25364
|
-
const encode$
|
|
25365
|
-
const decode$
|
|
25361
|
+
const encode$N = (attributes) => attributes?.["w:themeTint"];
|
|
25362
|
+
const decode$G = (attrs) => attrs?.themeTint;
|
|
25366
25363
|
const attrConfig$o = Object.freeze({
|
|
25367
25364
|
xmlName: "w:themeTint",
|
|
25368
25365
|
sdName: "themeTint",
|
|
25369
|
-
encode: encode$
|
|
25370
|
-
decode: decode$
|
|
25366
|
+
encode: encode$N,
|
|
25367
|
+
decode: decode$G
|
|
25371
25368
|
});
|
|
25372
|
-
const encode$
|
|
25373
|
-
const decode$
|
|
25369
|
+
const encode$M = (attributes) => attributes?.["w:themeShade"];
|
|
25370
|
+
const decode$F = (attrs) => attrs?.themeShade;
|
|
25374
25371
|
const attrConfig$n = Object.freeze({
|
|
25375
25372
|
xmlName: "w:themeShade",
|
|
25376
25373
|
sdName: "themeShade",
|
|
25377
|
-
encode: encode$
|
|
25378
|
-
decode: decode$
|
|
25374
|
+
encode: encode$M,
|
|
25375
|
+
decode: decode$F
|
|
25379
25376
|
});
|
|
25380
|
-
const validXmlAttributes$
|
|
25381
|
-
const XML_NODE_NAME$
|
|
25377
|
+
const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
|
|
25378
|
+
const XML_NODE_NAME$o = "w:u";
|
|
25382
25379
|
const SD_ATTR_KEY$c = "underline";
|
|
25383
|
-
const encode$
|
|
25380
|
+
const encode$L = (params2, encodedAttrs = {}) => {
|
|
25384
25381
|
const { nodes } = params2;
|
|
25385
25382
|
const node = nodes?.[0];
|
|
25386
25383
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25396,12 +25393,12 @@ const encode$K = (params2, encodedAttrs = {}) => {
|
|
|
25396
25393
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25397
25394
|
return {
|
|
25398
25395
|
type: "attr",
|
|
25399
|
-
xmlName: XML_NODE_NAME$
|
|
25396
|
+
xmlName: XML_NODE_NAME$o,
|
|
25400
25397
|
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25401
25398
|
attributes
|
|
25402
25399
|
};
|
|
25403
25400
|
};
|
|
25404
|
-
const decode$
|
|
25401
|
+
const decode$E = (params2) => {
|
|
25405
25402
|
const attrs = params2?.node?.attrs || {};
|
|
25406
25403
|
const underlineType = attrs.underlineType ?? attrs.underline ?? null;
|
|
25407
25404
|
const color = attrs.underlineColor ?? attrs.color ?? null;
|
|
@@ -25419,20 +25416,20 @@ const decode$D = (params2) => {
|
|
|
25419
25416
|
if (themeTint) attributes["w:themeTint"] = themeTint;
|
|
25420
25417
|
if (themeShade) attributes["w:themeShade"] = themeShade;
|
|
25421
25418
|
return {
|
|
25422
|
-
name: XML_NODE_NAME$
|
|
25419
|
+
name: XML_NODE_NAME$o,
|
|
25423
25420
|
attributes
|
|
25424
25421
|
};
|
|
25425
25422
|
};
|
|
25426
|
-
const config$
|
|
25427
|
-
xmlName: XML_NODE_NAME$
|
|
25423
|
+
const config$m = {
|
|
25424
|
+
xmlName: XML_NODE_NAME$o,
|
|
25428
25425
|
sdNodeOrKeyName: SD_ATTR_KEY$c,
|
|
25429
25426
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25430
|
-
encode: encode$
|
|
25431
|
-
decode: decode$
|
|
25432
|
-
attributes: validXmlAttributes$
|
|
25427
|
+
encode: encode$L,
|
|
25428
|
+
decode: decode$E,
|
|
25429
|
+
attributes: validXmlAttributes$h
|
|
25433
25430
|
};
|
|
25434
|
-
const translator
|
|
25435
|
-
const encode$
|
|
25431
|
+
const translator$10 = NodeTranslator.from(config$m);
|
|
25432
|
+
const encode$K = (attributes) => {
|
|
25436
25433
|
const raw = attributes?.["w:val"];
|
|
25437
25434
|
if (raw === void 0 || raw === null) return void 0;
|
|
25438
25435
|
if (typeof raw === "boolean") return raw;
|
|
@@ -25442,20 +25439,20 @@ const encode$J = (attributes) => {
|
|
|
25442
25439
|
if (val === "1" || val === "true" || val === "on") return true;
|
|
25443
25440
|
return void 0;
|
|
25444
25441
|
};
|
|
25445
|
-
const decode$
|
|
25442
|
+
const decode$D = (attrs) => {
|
|
25446
25443
|
if (attrs?.strike === false) return "0";
|
|
25447
25444
|
return void 0;
|
|
25448
25445
|
};
|
|
25449
25446
|
const attrConfig$m = Object.freeze({
|
|
25450
25447
|
xmlName: "w:val",
|
|
25451
25448
|
sdName: "strike",
|
|
25452
|
-
encode: encode$
|
|
25453
|
-
decode: decode$
|
|
25449
|
+
encode: encode$K,
|
|
25450
|
+
decode: decode$D
|
|
25454
25451
|
});
|
|
25455
|
-
const validXmlAttributes$
|
|
25456
|
-
const XML_NODE_NAME$
|
|
25452
|
+
const validXmlAttributes$g = [attrConfig$m];
|
|
25453
|
+
const XML_NODE_NAME$n = "w:strike";
|
|
25457
25454
|
const SD_ATTR_KEY$b = "strike";
|
|
25458
|
-
const encode$
|
|
25455
|
+
const encode$J = (params2, encodedAttrs = {}) => {
|
|
25459
25456
|
const { nodes } = params2;
|
|
25460
25457
|
const node = nodes?.[0];
|
|
25461
25458
|
if (!node) return void 0;
|
|
@@ -25468,55 +25465,55 @@ const encode$I = (params2, encodedAttrs = {}) => {
|
|
|
25468
25465
|
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25469
25466
|
return {
|
|
25470
25467
|
type: "attr",
|
|
25471
|
-
xmlName: XML_NODE_NAME$
|
|
25468
|
+
xmlName: XML_NODE_NAME$n,
|
|
25472
25469
|
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25473
25470
|
attributes
|
|
25474
25471
|
};
|
|
25475
25472
|
};
|
|
25476
|
-
const config$
|
|
25477
|
-
xmlName: XML_NODE_NAME$
|
|
25473
|
+
const config$l = {
|
|
25474
|
+
xmlName: XML_NODE_NAME$n,
|
|
25478
25475
|
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
25479
25476
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25480
|
-
encode: encode$
|
|
25481
|
-
attributes: validXmlAttributes$
|
|
25477
|
+
encode: encode$J,
|
|
25478
|
+
attributes: validXmlAttributes$g
|
|
25482
25479
|
};
|
|
25483
|
-
const translator
|
|
25484
|
-
const encode$
|
|
25485
|
-
const decode$
|
|
25480
|
+
const translator$$ = NodeTranslator.from(config$l);
|
|
25481
|
+
const encode$I = (attributes) => attributes?.["w:val"];
|
|
25482
|
+
const decode$C = (attrs) => attrs?.color;
|
|
25486
25483
|
const attrConfig$l = Object.freeze({
|
|
25487
25484
|
xmlName: "w:val",
|
|
25488
25485
|
sdName: "color",
|
|
25489
|
-
encode: encode$
|
|
25490
|
-
decode: decode$
|
|
25486
|
+
encode: encode$I,
|
|
25487
|
+
decode: decode$C
|
|
25491
25488
|
});
|
|
25492
|
-
const encode$
|
|
25493
|
-
const decode$
|
|
25489
|
+
const encode$H = (attributes) => attributes?.["w:themeColor"];
|
|
25490
|
+
const decode$B = (attrs) => attrs?.themeColor;
|
|
25494
25491
|
const attrConfig$k = Object.freeze({
|
|
25495
25492
|
xmlName: "w:themeColor",
|
|
25496
25493
|
sdName: "themeColor",
|
|
25497
|
-
encode: encode$
|
|
25498
|
-
decode: decode$
|
|
25494
|
+
encode: encode$H,
|
|
25495
|
+
decode: decode$B
|
|
25499
25496
|
});
|
|
25500
|
-
const encode$
|
|
25501
|
-
const decode$
|
|
25497
|
+
const encode$G = (attributes) => attributes?.["w:themeTint"];
|
|
25498
|
+
const decode$A = (attrs) => attrs?.themeTint;
|
|
25502
25499
|
const attrConfig$j = Object.freeze({
|
|
25503
25500
|
xmlName: "w:themeTint",
|
|
25504
25501
|
sdName: "themeTint",
|
|
25505
|
-
encode: encode$
|
|
25506
|
-
decode: decode$
|
|
25502
|
+
encode: encode$G,
|
|
25503
|
+
decode: decode$A
|
|
25507
25504
|
});
|
|
25508
|
-
const encode$
|
|
25509
|
-
const decode$
|
|
25505
|
+
const encode$F = (attributes) => attributes?.["w:themeShade"];
|
|
25506
|
+
const decode$z = (attrs) => attrs?.themeShade;
|
|
25510
25507
|
const attrConfig$i = Object.freeze({
|
|
25511
25508
|
xmlName: "w:themeShade",
|
|
25512
25509
|
sdName: "themeShade",
|
|
25513
|
-
encode: encode$
|
|
25514
|
-
decode: decode$
|
|
25510
|
+
encode: encode$F,
|
|
25511
|
+
decode: decode$z
|
|
25515
25512
|
});
|
|
25516
|
-
const validXmlAttributes$
|
|
25517
|
-
const XML_NODE_NAME$
|
|
25513
|
+
const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
25514
|
+
const XML_NODE_NAME$m = "w:color";
|
|
25518
25515
|
const SD_ATTR_KEY$a = "color";
|
|
25519
|
-
const encode$
|
|
25516
|
+
const encode$E = (params2, encodedAttrs = {}) => {
|
|
25520
25517
|
const { nodes } = params2;
|
|
25521
25518
|
const node = nodes?.[0];
|
|
25522
25519
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25531,63 +25528,63 @@ const encode$D = (params2, encodedAttrs = {}) => {
|
|
|
25531
25528
|
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
25532
25529
|
return {
|
|
25533
25530
|
type: "attr",
|
|
25534
|
-
xmlName: XML_NODE_NAME$
|
|
25531
|
+
xmlName: XML_NODE_NAME$m,
|
|
25535
25532
|
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25536
25533
|
attributes
|
|
25537
25534
|
};
|
|
25538
25535
|
};
|
|
25539
|
-
const config$
|
|
25540
|
-
xmlName: XML_NODE_NAME$
|
|
25536
|
+
const config$k = {
|
|
25537
|
+
xmlName: XML_NODE_NAME$m,
|
|
25541
25538
|
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25542
25539
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25543
|
-
encode: encode$
|
|
25544
|
-
attributes: validXmlAttributes$
|
|
25540
|
+
encode: encode$E,
|
|
25541
|
+
attributes: validXmlAttributes$f
|
|
25545
25542
|
};
|
|
25546
|
-
const translator$
|
|
25547
|
-
const encode$
|
|
25548
|
-
const decode$
|
|
25543
|
+
const translator$_ = NodeTranslator.from(config$k);
|
|
25544
|
+
const encode$D = (attributes) => attributes?.["w:eastAsia"];
|
|
25545
|
+
const decode$y = (attrs) => attrs?.eastAsia;
|
|
25549
25546
|
const attrConfig$h = Object.freeze({
|
|
25550
25547
|
xmlName: "w:eastAsia",
|
|
25551
25548
|
sdName: "eastAsia",
|
|
25552
|
-
encode: encode$
|
|
25553
|
-
decode: decode$
|
|
25549
|
+
encode: encode$D,
|
|
25550
|
+
decode: decode$y
|
|
25554
25551
|
});
|
|
25555
|
-
const encode$
|
|
25556
|
-
const decode$
|
|
25552
|
+
const encode$C = (attributes) => attributes?.["w:ascii"];
|
|
25553
|
+
const decode$x = (attrs) => attrs?.ascii;
|
|
25557
25554
|
const attrConfig$g = Object.freeze({
|
|
25558
25555
|
xmlName: "w:ascii",
|
|
25559
25556
|
sdName: "ascii",
|
|
25560
|
-
encode: encode$
|
|
25561
|
-
decode: decode$
|
|
25557
|
+
encode: encode$C,
|
|
25558
|
+
decode: decode$x
|
|
25562
25559
|
});
|
|
25563
|
-
const encode$
|
|
25564
|
-
const decode$
|
|
25560
|
+
const encode$B = (attributes) => attributes?.["w:hAnsi"];
|
|
25561
|
+
const decode$w = (attrs) => attrs?.hAnsi;
|
|
25565
25562
|
const attrConfig$f = Object.freeze({
|
|
25566
25563
|
xmlName: "w:hAnsi",
|
|
25567
25564
|
sdName: "hAnsi",
|
|
25568
|
-
encode: encode$
|
|
25569
|
-
decode: decode$
|
|
25565
|
+
encode: encode$B,
|
|
25566
|
+
decode: decode$w
|
|
25570
25567
|
});
|
|
25571
|
-
const encode$
|
|
25572
|
-
const decode$
|
|
25568
|
+
const encode$A = (attributes) => attributes?.["w:cs"];
|
|
25569
|
+
const decode$v = (attrs) => attrs?.cs;
|
|
25573
25570
|
const attrConfig$e = Object.freeze({
|
|
25574
25571
|
xmlName: "w:cs",
|
|
25575
25572
|
sdName: "cs",
|
|
25576
|
-
encode: encode$
|
|
25577
|
-
decode: decode$
|
|
25573
|
+
encode: encode$A,
|
|
25574
|
+
decode: decode$v
|
|
25578
25575
|
});
|
|
25579
|
-
const encode$
|
|
25580
|
-
const decode$
|
|
25576
|
+
const encode$z = (attributes) => attributes?.["w:val"];
|
|
25577
|
+
const decode$u = (attrs) => attrs?.value;
|
|
25581
25578
|
const attrConfig$d = Object.freeze({
|
|
25582
25579
|
xmlName: "w:val",
|
|
25583
25580
|
sdName: "value",
|
|
25584
|
-
encode: encode$
|
|
25585
|
-
decode: decode$
|
|
25581
|
+
encode: encode$z,
|
|
25582
|
+
decode: decode$u
|
|
25586
25583
|
});
|
|
25587
|
-
const validXmlAttributes$
|
|
25588
|
-
const XML_NODE_NAME$
|
|
25584
|
+
const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
|
|
25585
|
+
const XML_NODE_NAME$l = "w:rFonts";
|
|
25589
25586
|
const SD_ATTR_KEY$9 = "fontFamily";
|
|
25590
|
-
const encode$
|
|
25587
|
+
const encode$y = (params2, encodedAttrs = {}) => {
|
|
25591
25588
|
const { nodes } = params2;
|
|
25592
25589
|
const node = nodes?.[0];
|
|
25593
25590
|
const sourceAttrs = node?.attributes || {};
|
|
@@ -25613,120 +25610,120 @@ const encode$x = (params2, encodedAttrs = {}) => {
|
|
|
25613
25610
|
if (attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
25614
25611
|
return {
|
|
25615
25612
|
type: "attr",
|
|
25616
|
-
xmlName: XML_NODE_NAME$
|
|
25613
|
+
xmlName: XML_NODE_NAME$l,
|
|
25617
25614
|
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25618
25615
|
attributes
|
|
25619
25616
|
};
|
|
25620
25617
|
};
|
|
25621
|
-
const config$
|
|
25622
|
-
xmlName: XML_NODE_NAME$
|
|
25618
|
+
const config$j = {
|
|
25619
|
+
xmlName: XML_NODE_NAME$l,
|
|
25623
25620
|
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
25624
25621
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25625
|
-
encode: encode$
|
|
25626
|
-
attributes: validXmlAttributes$
|
|
25622
|
+
encode: encode$y,
|
|
25623
|
+
attributes: validXmlAttributes$e
|
|
25627
25624
|
};
|
|
25628
|
-
const translator$
|
|
25629
|
-
const encode$
|
|
25630
|
-
const decode$
|
|
25625
|
+
const translator$Z = NodeTranslator.from(config$j);
|
|
25626
|
+
const encode$x = (attributes) => attributes?.["w:val"];
|
|
25627
|
+
const decode$t = (attrs) => attrs?.styleId;
|
|
25631
25628
|
const attrConfig$c = Object.freeze({
|
|
25632
25629
|
xmlName: "w:val",
|
|
25633
25630
|
sdName: "styleId",
|
|
25634
|
-
encode: encode$
|
|
25635
|
-
decode: decode$
|
|
25631
|
+
encode: encode$x,
|
|
25632
|
+
decode: decode$t
|
|
25636
25633
|
});
|
|
25637
|
-
const validXmlAttributes$
|
|
25638
|
-
const XML_NODE_NAME$
|
|
25634
|
+
const validXmlAttributes$d = [attrConfig$c];
|
|
25635
|
+
const XML_NODE_NAME$k = "w:rStyle";
|
|
25639
25636
|
const SD_ATTR_KEY$8 = "styleId";
|
|
25640
|
-
const encode$
|
|
25637
|
+
const encode$w = (params2, encodedAttrs = {}) => {
|
|
25641
25638
|
const { nodes } = params2;
|
|
25642
25639
|
const node = nodes?.[0];
|
|
25643
25640
|
const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
|
|
25644
25641
|
return {
|
|
25645
25642
|
type: "attr",
|
|
25646
|
-
xmlName: XML_NODE_NAME$
|
|
25643
|
+
xmlName: XML_NODE_NAME$k,
|
|
25647
25644
|
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25648
25645
|
attributes: { "w:val": value ?? null }
|
|
25649
25646
|
};
|
|
25650
25647
|
};
|
|
25651
|
-
const config$
|
|
25652
|
-
xmlName: XML_NODE_NAME$
|
|
25648
|
+
const config$i = {
|
|
25649
|
+
xmlName: XML_NODE_NAME$k,
|
|
25653
25650
|
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
25654
25651
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25655
|
-
encode: encode$
|
|
25656
|
-
attributes: validXmlAttributes$
|
|
25652
|
+
encode: encode$w,
|
|
25653
|
+
attributes: validXmlAttributes$d
|
|
25657
25654
|
};
|
|
25658
|
-
const translator$
|
|
25659
|
-
const encode$
|
|
25660
|
-
const decode$
|
|
25655
|
+
const translator$Y = NodeTranslator.from(config$i);
|
|
25656
|
+
const encode$v = (attributes) => attributes?.["w:val"];
|
|
25657
|
+
const decode$s = (attrs) => attrs?.fontSize;
|
|
25661
25658
|
const attrConfig$b = Object.freeze({
|
|
25662
25659
|
xmlName: "w:val",
|
|
25663
25660
|
sdName: "fontSize",
|
|
25664
|
-
encode: encode$
|
|
25665
|
-
decode: decode$
|
|
25661
|
+
encode: encode$v,
|
|
25662
|
+
decode: decode$s
|
|
25666
25663
|
});
|
|
25667
|
-
const validXmlAttributes$
|
|
25668
|
-
const XML_NODE_NAME$
|
|
25664
|
+
const validXmlAttributes$c = [attrConfig$b];
|
|
25665
|
+
const XML_NODE_NAME$j = "w:sz";
|
|
25669
25666
|
const SD_ATTR_KEY$7 = "fontSize";
|
|
25670
|
-
const encode$
|
|
25667
|
+
const encode$u = (params2, encodedAttrs = {}) => {
|
|
25671
25668
|
const { nodes } = params2;
|
|
25672
25669
|
const node = nodes?.[0];
|
|
25673
25670
|
const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
|
|
25674
25671
|
return {
|
|
25675
25672
|
type: "attr",
|
|
25676
|
-
xmlName: XML_NODE_NAME$
|
|
25673
|
+
xmlName: XML_NODE_NAME$j,
|
|
25677
25674
|
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25678
25675
|
attributes: { "w:val": value ?? null }
|
|
25679
25676
|
};
|
|
25680
25677
|
};
|
|
25681
|
-
const config$
|
|
25682
|
-
xmlName: XML_NODE_NAME$
|
|
25678
|
+
const config$h = {
|
|
25679
|
+
xmlName: XML_NODE_NAME$j,
|
|
25683
25680
|
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
25684
25681
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25685
|
-
encode: encode$
|
|
25686
|
-
attributes: validXmlAttributes$
|
|
25682
|
+
encode: encode$u,
|
|
25683
|
+
attributes: validXmlAttributes$c
|
|
25687
25684
|
};
|
|
25688
|
-
const translator$
|
|
25689
|
-
const encode$
|
|
25690
|
-
const decode$
|
|
25685
|
+
const translator$X = NodeTranslator.from(config$h);
|
|
25686
|
+
const encode$t = (attributes) => attributes?.["w:val"];
|
|
25687
|
+
const decode$r = (attrs) => attrs?.fontSizeCs;
|
|
25691
25688
|
const attrConfig$a = Object.freeze({
|
|
25692
25689
|
xmlName: "w:val",
|
|
25693
25690
|
sdName: "fontSizeCs",
|
|
25694
|
-
encode: encode$
|
|
25695
|
-
decode: decode$
|
|
25691
|
+
encode: encode$t,
|
|
25692
|
+
decode: decode$r
|
|
25696
25693
|
});
|
|
25697
|
-
const validXmlAttributes$
|
|
25698
|
-
const XML_NODE_NAME$
|
|
25694
|
+
const validXmlAttributes$b = [attrConfig$a];
|
|
25695
|
+
const XML_NODE_NAME$i = "w:szCs";
|
|
25699
25696
|
const SD_ATTR_KEY$6 = "fontSizeCs";
|
|
25700
|
-
const encode$
|
|
25697
|
+
const encode$s = (params2, encodedAttrs = {}) => {
|
|
25701
25698
|
const { nodes } = params2;
|
|
25702
25699
|
const node = nodes?.[0];
|
|
25703
25700
|
const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
|
|
25704
25701
|
return {
|
|
25705
25702
|
type: "attr",
|
|
25706
|
-
xmlName: XML_NODE_NAME$
|
|
25703
|
+
xmlName: XML_NODE_NAME$i,
|
|
25707
25704
|
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25708
25705
|
attributes: { "w:val": value ?? null }
|
|
25709
25706
|
};
|
|
25710
25707
|
};
|
|
25711
|
-
const config$
|
|
25712
|
-
xmlName: XML_NODE_NAME$
|
|
25708
|
+
const config$g = {
|
|
25709
|
+
xmlName: XML_NODE_NAME$i,
|
|
25713
25710
|
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
25714
25711
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25715
|
-
encode: encode$
|
|
25716
|
-
attributes: validXmlAttributes$
|
|
25712
|
+
encode: encode$s,
|
|
25713
|
+
attributes: validXmlAttributes$b
|
|
25717
25714
|
};
|
|
25718
|
-
const translator$
|
|
25715
|
+
const translator$W = NodeTranslator.from(config$g);
|
|
25719
25716
|
const runPropertyTranslators = Object.freeze({
|
|
25720
|
-
"w:b": translator$
|
|
25721
|
-
"w:i": translator$
|
|
25722
|
-
"w:u": translator
|
|
25723
|
-
"w:strike": translator
|
|
25724
|
-
"w:color": translator$
|
|
25725
|
-
"w:highlight": translator$
|
|
25726
|
-
"w:rFonts": translator$
|
|
25727
|
-
"w:rStyle": translator$
|
|
25728
|
-
"w:sz": translator$
|
|
25729
|
-
"w:szCs": translator$
|
|
25717
|
+
"w:b": translator$12,
|
|
25718
|
+
"w:i": translator$11,
|
|
25719
|
+
"w:u": translator$10,
|
|
25720
|
+
"w:strike": translator$$,
|
|
25721
|
+
"w:color": translator$_,
|
|
25722
|
+
"w:highlight": translator$15,
|
|
25723
|
+
"w:rFonts": translator$Z,
|
|
25724
|
+
"w:rStyle": translator$Y,
|
|
25725
|
+
"w:sz": translator$X,
|
|
25726
|
+
"w:szCs": translator$W
|
|
25730
25727
|
});
|
|
25731
25728
|
const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
|
|
25732
25729
|
const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
|
|
@@ -25740,9 +25737,9 @@ const toRunPropertyEntry = (candidate) => {
|
|
|
25740
25737
|
attributes: { ...candidate.attributes || {} }
|
|
25741
25738
|
};
|
|
25742
25739
|
};
|
|
25743
|
-
const XML_NODE_NAME$
|
|
25740
|
+
const XML_NODE_NAME$h = "w:rPr";
|
|
25744
25741
|
const SD_ATTR_KEY$5 = "runProperties";
|
|
25745
|
-
const encode$
|
|
25742
|
+
const encode$r = (params2) => {
|
|
25746
25743
|
const { nodes } = params2;
|
|
25747
25744
|
const node = nodes?.[0] || {};
|
|
25748
25745
|
const contents = Array.isArray(node.elements) ? node.elements : [];
|
|
@@ -25776,16 +25773,16 @@ const encode$q = (params2) => {
|
|
|
25776
25773
|
attributes: runPropsArray
|
|
25777
25774
|
};
|
|
25778
25775
|
};
|
|
25779
|
-
const config$
|
|
25780
|
-
xmlName: XML_NODE_NAME$
|
|
25776
|
+
const config$f = {
|
|
25777
|
+
xmlName: XML_NODE_NAME$h,
|
|
25781
25778
|
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
25782
25779
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25783
|
-
encode: encode$
|
|
25780
|
+
encode: encode$r
|
|
25784
25781
|
};
|
|
25785
|
-
const translator$
|
|
25782
|
+
const translator$V = NodeTranslator.from(config$f);
|
|
25786
25783
|
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;
|
|
25787
25784
|
const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
|
|
25788
|
-
const collectRunProperties = (params2, rPrNode, translator2 = translator$
|
|
25785
|
+
const collectRunProperties = (params2, rPrNode, translator2 = translator$V) => {
|
|
25789
25786
|
if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
|
|
25790
25787
|
const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
|
|
25791
25788
|
let entries = [];
|
|
@@ -26247,46 +26244,46 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
|
|
|
26247
26244
|
}
|
|
26248
26245
|
return runs;
|
|
26249
26246
|
};
|
|
26250
|
-
const encode$
|
|
26247
|
+
const encode$q = (attributes) => {
|
|
26251
26248
|
return attributes["w:rsidR"];
|
|
26252
26249
|
};
|
|
26253
|
-
const decode$
|
|
26250
|
+
const decode$q = (attrs) => {
|
|
26254
26251
|
return attrs.rsidR;
|
|
26255
26252
|
};
|
|
26256
26253
|
const attrConfig$9 = Object.freeze({
|
|
26257
26254
|
xmlName: "w:rsidR",
|
|
26258
26255
|
sdName: "rsidR",
|
|
26259
|
-
encode: encode$
|
|
26260
|
-
decode: decode$
|
|
26256
|
+
encode: encode$q,
|
|
26257
|
+
decode: decode$q
|
|
26261
26258
|
});
|
|
26262
|
-
const encode$
|
|
26259
|
+
const encode$p = (attributes) => {
|
|
26263
26260
|
return attributes["w:rsidRPr"];
|
|
26264
26261
|
};
|
|
26265
|
-
const decode$
|
|
26262
|
+
const decode$p = (attrs) => {
|
|
26266
26263
|
return attrs.rsidRPr;
|
|
26267
26264
|
};
|
|
26268
26265
|
const attrConfig$8 = Object.freeze({
|
|
26269
26266
|
xmlName: "w:rsidRPr",
|
|
26270
26267
|
sdName: "rsidRPr",
|
|
26271
|
-
encode: encode$
|
|
26272
|
-
decode: decode$
|
|
26268
|
+
encode: encode$p,
|
|
26269
|
+
decode: decode$p
|
|
26273
26270
|
});
|
|
26274
|
-
const encode$
|
|
26271
|
+
const encode$o = (attributes) => {
|
|
26275
26272
|
return attributes["w:rsidDel"];
|
|
26276
26273
|
};
|
|
26277
|
-
const decode$
|
|
26274
|
+
const decode$o = (attrs) => {
|
|
26278
26275
|
return attrs.rsidDel;
|
|
26279
26276
|
};
|
|
26280
26277
|
const attrConfig$7 = Object.freeze({
|
|
26281
26278
|
xmlName: "w:rsidDel",
|
|
26282
26279
|
sdName: "rsidDel",
|
|
26283
|
-
encode: encode$
|
|
26284
|
-
decode: decode$
|
|
26280
|
+
encode: encode$o,
|
|
26281
|
+
decode: decode$o
|
|
26285
26282
|
});
|
|
26286
|
-
const validXmlAttributes$
|
|
26287
|
-
const XML_NODE_NAME$
|
|
26283
|
+
const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
|
|
26284
|
+
const XML_NODE_NAME$g = "w:r";
|
|
26288
26285
|
const SD_KEY_NAME = "run";
|
|
26289
|
-
const encode$
|
|
26286
|
+
const encode$n = (params2, encodedAttrs = {}) => {
|
|
26290
26287
|
const { nodes = [], nodeListHandler } = params2 || {};
|
|
26291
26288
|
const runNode = nodes[0];
|
|
26292
26289
|
if (!runNode) return void 0;
|
|
@@ -26334,7 +26331,7 @@ const encode$m = (params2, encodedAttrs = {}) => {
|
|
|
26334
26331
|
}
|
|
26335
26332
|
return runNodeResult;
|
|
26336
26333
|
};
|
|
26337
|
-
const decode$
|
|
26334
|
+
const decode$n = (params2, decodedAttrs = {}) => {
|
|
26338
26335
|
const { node } = params2 || {};
|
|
26339
26336
|
if (!node) return void 0;
|
|
26340
26337
|
const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
|
|
@@ -26391,7 +26388,7 @@ const decode$m = (params2, decodedAttrs = {}) => {
|
|
|
26391
26388
|
runs.push(trackedClone);
|
|
26392
26389
|
return;
|
|
26393
26390
|
}
|
|
26394
|
-
const runWrapper = { name: XML_NODE_NAME$
|
|
26391
|
+
const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
|
|
26395
26392
|
applyBaseRunProps(runWrapper);
|
|
26396
26393
|
if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
|
|
26397
26394
|
runWrapper.elements.push(cloneXmlNode(child));
|
|
@@ -26399,7 +26396,7 @@ const decode$m = (params2, decodedAttrs = {}) => {
|
|
|
26399
26396
|
});
|
|
26400
26397
|
const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
|
|
26401
26398
|
if (!trackedRuns.length) {
|
|
26402
|
-
const emptyRun = { name: XML_NODE_NAME$
|
|
26399
|
+
const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
|
|
26403
26400
|
applyBaseRunProps(emptyRun);
|
|
26404
26401
|
trackedRuns.push(emptyRun);
|
|
26405
26402
|
}
|
|
@@ -26413,15 +26410,15 @@ const decode$m = (params2, decodedAttrs = {}) => {
|
|
|
26413
26410
|
}
|
|
26414
26411
|
return trackedRuns;
|
|
26415
26412
|
};
|
|
26416
|
-
const config$
|
|
26417
|
-
xmlName: XML_NODE_NAME$
|
|
26413
|
+
const config$e = {
|
|
26414
|
+
xmlName: XML_NODE_NAME$g,
|
|
26418
26415
|
sdNodeOrKeyName: SD_KEY_NAME,
|
|
26419
26416
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26420
|
-
encode: encode$
|
|
26421
|
-
decode: decode$
|
|
26422
|
-
attributes: validXmlAttributes$
|
|
26417
|
+
encode: encode$n,
|
|
26418
|
+
decode: decode$n,
|
|
26419
|
+
attributes: validXmlAttributes$a
|
|
26423
26420
|
};
|
|
26424
|
-
const translator$
|
|
26421
|
+
const translator$U = NodeTranslator.from(config$e);
|
|
26425
26422
|
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
26426
26423
|
handlerName,
|
|
26427
26424
|
handler: (params2) => {
|
|
@@ -26595,13 +26592,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
|
26595
26592
|
}
|
|
26596
26593
|
return table;
|
|
26597
26594
|
}
|
|
26598
|
-
const translator$
|
|
26595
|
+
const translator$T = NodeTranslator.from({
|
|
26599
26596
|
xmlName: "w:cantSplit",
|
|
26600
26597
|
sdNodeOrKeyName: "cantSplit",
|
|
26601
26598
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26602
26599
|
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
26603
26600
|
});
|
|
26604
|
-
const translator$
|
|
26601
|
+
const translator$S = NodeTranslator.from({
|
|
26605
26602
|
xmlName: "w:cnfStyle",
|
|
26606
26603
|
sdNodeOrKeyName: "cnfStyle",
|
|
26607
26604
|
attributes: [
|
|
@@ -26627,8 +26624,8 @@ const translator$R = NodeTranslator.from({
|
|
|
26627
26624
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26628
26625
|
}
|
|
26629
26626
|
});
|
|
26630
|
-
const translator$
|
|
26631
|
-
const translator$
|
|
26627
|
+
const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
26628
|
+
const translator$Q = NodeTranslator.from(
|
|
26632
26629
|
createSingleAttrPropertyHandler(
|
|
26633
26630
|
"w:gridAfter",
|
|
26634
26631
|
null,
|
|
@@ -26637,7 +26634,7 @@ const translator$P = NodeTranslator.from(
|
|
|
26637
26634
|
(v2) => integerToString(v2)
|
|
26638
26635
|
)
|
|
26639
26636
|
);
|
|
26640
|
-
const translator$
|
|
26637
|
+
const translator$P = NodeTranslator.from(
|
|
26641
26638
|
createSingleAttrPropertyHandler(
|
|
26642
26639
|
"w:gridBefore",
|
|
26643
26640
|
null,
|
|
@@ -26646,21 +26643,21 @@ const translator$O = NodeTranslator.from(
|
|
|
26646
26643
|
(v2) => integerToString(v2)
|
|
26647
26644
|
)
|
|
26648
26645
|
);
|
|
26649
|
-
const translator$
|
|
26646
|
+
const translator$O = NodeTranslator.from({
|
|
26650
26647
|
xmlName: "w:hidden",
|
|
26651
26648
|
sdNodeOrKeyName: "hidden",
|
|
26652
26649
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26653
26650
|
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
26654
26651
|
});
|
|
26655
|
-
const translator$
|
|
26656
|
-
const translator$
|
|
26657
|
-
const translator$
|
|
26652
|
+
const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
26653
|
+
const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
26654
|
+
const translator$L = NodeTranslator.from({
|
|
26658
26655
|
xmlName: "w:tblHeader",
|
|
26659
26656
|
sdNodeOrKeyName: "repeatHeader",
|
|
26660
26657
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26661
26658
|
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
26662
26659
|
});
|
|
26663
|
-
const translator$
|
|
26660
|
+
const translator$K = NodeTranslator.from({
|
|
26664
26661
|
xmlName: "w:trHeight",
|
|
26665
26662
|
sdNodeOrKeyName: "rowHeight",
|
|
26666
26663
|
encode: ({ nodes }) => {
|
|
@@ -26687,11 +26684,11 @@ const translator$J = NodeTranslator.from({
|
|
|
26687
26684
|
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
26688
26685
|
}
|
|
26689
26686
|
});
|
|
26690
|
-
const translator$
|
|
26691
|
-
const translator$
|
|
26692
|
-
const XML_NODE_NAME$
|
|
26687
|
+
const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
26688
|
+
const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
26689
|
+
const XML_NODE_NAME$f = "w:trPr";
|
|
26693
26690
|
const SD_ATTR_KEY$4 = "tableRowProperties";
|
|
26694
|
-
const encode$
|
|
26691
|
+
const encode$m = (params2) => {
|
|
26695
26692
|
const { nodes } = params2;
|
|
26696
26693
|
const node = nodes[0];
|
|
26697
26694
|
let attributes = {
|
|
@@ -26705,12 +26702,12 @@ const encode$l = (params2) => {
|
|
|
26705
26702
|
};
|
|
26706
26703
|
return {
|
|
26707
26704
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
26708
|
-
xmlName: XML_NODE_NAME$
|
|
26705
|
+
xmlName: XML_NODE_NAME$f,
|
|
26709
26706
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
26710
26707
|
attributes
|
|
26711
26708
|
};
|
|
26712
26709
|
};
|
|
26713
|
-
const decode$
|
|
26710
|
+
const decode$m = (params2) => {
|
|
26714
26711
|
const { tableRowProperties = {} } = params2.node.attrs || {};
|
|
26715
26712
|
const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
|
|
26716
26713
|
const newNode = {
|
|
@@ -26722,6 +26719,7 @@ const decode$l = (params2) => {
|
|
|
26722
26719
|
return newNode;
|
|
26723
26720
|
};
|
|
26724
26721
|
const propertyTranslators$3 = [
|
|
26722
|
+
translator$T,
|
|
26725
26723
|
translator$S,
|
|
26726
26724
|
translator$R,
|
|
26727
26725
|
translator$Q,
|
|
@@ -26732,8 +26730,7 @@ const propertyTranslators$3 = [
|
|
|
26732
26730
|
translator$L,
|
|
26733
26731
|
translator$K,
|
|
26734
26732
|
translator$J,
|
|
26735
|
-
translator$I
|
|
26736
|
-
translator$H
|
|
26733
|
+
translator$I
|
|
26737
26734
|
];
|
|
26738
26735
|
const propertyTranslatorsByXmlName$2 = {};
|
|
26739
26736
|
propertyTranslators$3.forEach((translator2) => {
|
|
@@ -26743,25 +26740,25 @@ const propertyTranslatorsBySdName$2 = {};
|
|
|
26743
26740
|
propertyTranslators$3.forEach((translator2) => {
|
|
26744
26741
|
propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
|
|
26745
26742
|
});
|
|
26746
|
-
const config$
|
|
26747
|
-
xmlName: XML_NODE_NAME$
|
|
26743
|
+
const config$d = {
|
|
26744
|
+
xmlName: XML_NODE_NAME$f,
|
|
26748
26745
|
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
26749
26746
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
26750
|
-
encode: encode$
|
|
26751
|
-
decode: decode$
|
|
26747
|
+
encode: encode$m,
|
|
26748
|
+
decode: decode$m
|
|
26752
26749
|
};
|
|
26753
|
-
const translator$
|
|
26754
|
-
const XML_NODE_NAME$
|
|
26755
|
-
const SD_NODE_NAME$
|
|
26756
|
-
const validXmlAttributes$
|
|
26750
|
+
const translator$H = NodeTranslator.from(config$d);
|
|
26751
|
+
const XML_NODE_NAME$e = "w:tr";
|
|
26752
|
+
const SD_NODE_NAME$a = "tableRow";
|
|
26753
|
+
const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
26757
26754
|
(xmlName) => createAttributeHandler(xmlName)
|
|
26758
26755
|
);
|
|
26759
|
-
const encode$
|
|
26756
|
+
const encode$l = (params2, encodedAttrs) => {
|
|
26760
26757
|
const { row } = params2.extraParams;
|
|
26761
26758
|
let tableRowProperties = {};
|
|
26762
26759
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
26763
26760
|
if (tPr) {
|
|
26764
|
-
({ attributes: tableRowProperties } = translator$
|
|
26761
|
+
({ attributes: tableRowProperties } = translator$H.encode({
|
|
26765
26762
|
...params2,
|
|
26766
26763
|
nodes: [tPr]
|
|
26767
26764
|
}));
|
|
@@ -26774,7 +26771,7 @@ const encode$k = (params2, encodedAttrs) => {
|
|
|
26774
26771
|
let currentColumnIndex = 0;
|
|
26775
26772
|
const content = cellNodes?.map((n) => {
|
|
26776
26773
|
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
26777
|
-
const result = translator$
|
|
26774
|
+
const result = translator$8.encode({
|
|
26778
26775
|
...params2,
|
|
26779
26776
|
extraParams: {
|
|
26780
26777
|
...params2.extraParams,
|
|
@@ -26796,7 +26793,7 @@ const encode$k = (params2, encodedAttrs) => {
|
|
|
26796
26793
|
};
|
|
26797
26794
|
return newNode;
|
|
26798
26795
|
};
|
|
26799
|
-
const decode$
|
|
26796
|
+
const decode$l = (params2, decodedAttrs) => {
|
|
26800
26797
|
const { node } = params2;
|
|
26801
26798
|
const elements = translateChildNodes(params2);
|
|
26802
26799
|
if (node.attrs?.tableRowProperties) {
|
|
@@ -26808,7 +26805,7 @@ const decode$k = (params2, decodedAttrs) => {
|
|
|
26808
26805
|
}
|
|
26809
26806
|
}
|
|
26810
26807
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
26811
|
-
const trPr = translator$
|
|
26808
|
+
const trPr = translator$H.decode({
|
|
26812
26809
|
...params2,
|
|
26813
26810
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
26814
26811
|
});
|
|
@@ -26820,22 +26817,22 @@ const decode$k = (params2, decodedAttrs) => {
|
|
|
26820
26817
|
elements
|
|
26821
26818
|
};
|
|
26822
26819
|
};
|
|
26823
|
-
const config$
|
|
26824
|
-
xmlName: XML_NODE_NAME$
|
|
26825
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
26820
|
+
const config$c = {
|
|
26821
|
+
xmlName: XML_NODE_NAME$e,
|
|
26822
|
+
sdNodeOrKeyName: SD_NODE_NAME$a,
|
|
26826
26823
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26827
|
-
encode: encode$
|
|
26828
|
-
decode: decode$
|
|
26829
|
-
attributes: validXmlAttributes$
|
|
26824
|
+
encode: encode$l,
|
|
26825
|
+
decode: decode$l,
|
|
26826
|
+
attributes: validXmlAttributes$9
|
|
26830
26827
|
};
|
|
26831
|
-
const translator$
|
|
26832
|
-
const translator$
|
|
26828
|
+
const translator$G = NodeTranslator.from(config$c);
|
|
26829
|
+
const translator$F = NodeTranslator.from({
|
|
26833
26830
|
xmlName: "w:bidiVisual",
|
|
26834
26831
|
sdNodeOrKeyName: "rightToLeft",
|
|
26835
26832
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26836
26833
|
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
26837
26834
|
});
|
|
26838
|
-
const translator$
|
|
26835
|
+
const translator$E = NodeTranslator.from({
|
|
26839
26836
|
xmlName: "w:shd",
|
|
26840
26837
|
sdNodeOrKeyName: "shading",
|
|
26841
26838
|
attributes: [
|
|
@@ -26857,11 +26854,11 @@ const translator$D = NodeTranslator.from({
|
|
|
26857
26854
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26858
26855
|
}
|
|
26859
26856
|
});
|
|
26860
|
-
const translator$
|
|
26861
|
-
const translator$
|
|
26862
|
-
const translator$
|
|
26863
|
-
const translator$
|
|
26864
|
-
const translator$
|
|
26857
|
+
const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
26858
|
+
const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
26859
|
+
const translator$B = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
26860
|
+
const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
26861
|
+
const translator$z = NodeTranslator.from({
|
|
26865
26862
|
xmlName: "w:tblLook",
|
|
26866
26863
|
sdNodeOrKeyName: "tblLook",
|
|
26867
26864
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
@@ -26873,16 +26870,16 @@ const translator$y = NodeTranslator.from({
|
|
|
26873
26870
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26874
26871
|
}
|
|
26875
26872
|
});
|
|
26876
|
-
const translator$
|
|
26877
|
-
const translator$
|
|
26878
|
-
const translator$
|
|
26873
|
+
const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
26874
|
+
const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
26875
|
+
const translator$w = NodeTranslator.from(
|
|
26879
26876
|
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
26880
26877
|
);
|
|
26881
|
-
const translator$
|
|
26878
|
+
const translator$v = NodeTranslator.from(
|
|
26882
26879
|
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
26883
26880
|
);
|
|
26884
|
-
const translator$
|
|
26885
|
-
const translator$
|
|
26881
|
+
const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
26882
|
+
const translator$t = NodeTranslator.from({
|
|
26886
26883
|
xmlName: "w:tblpPr",
|
|
26887
26884
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
26888
26885
|
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))),
|
|
@@ -26894,29 +26891,29 @@ const translator$s = NodeTranslator.from({
|
|
|
26894
26891
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26895
26892
|
}
|
|
26896
26893
|
});
|
|
26897
|
-
const translator$
|
|
26898
|
-
const translator$
|
|
26899
|
-
const translator$
|
|
26900
|
-
const translator$
|
|
26901
|
-
const translator$
|
|
26902
|
-
const translator$
|
|
26903
|
-
const translator$
|
|
26904
|
-
const translator$
|
|
26905
|
-
const translator$
|
|
26906
|
-
const translator$
|
|
26907
|
-
const translator$
|
|
26908
|
-
const translator$
|
|
26909
|
-
const translator$
|
|
26910
|
-
const translator$
|
|
26911
|
-
const XML_NODE_NAME$
|
|
26894
|
+
const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
26895
|
+
const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
26896
|
+
const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
26897
|
+
const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
26898
|
+
const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
26899
|
+
const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
26900
|
+
const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
26901
|
+
const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
26902
|
+
const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
26903
|
+
const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
26904
|
+
const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
26905
|
+
const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
26906
|
+
const translator$g = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
26907
|
+
const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
26908
|
+
const XML_NODE_NAME$d = "w:tblBorders";
|
|
26912
26909
|
const SD_ATTR_KEY$3 = "borders";
|
|
26913
|
-
const encode$
|
|
26910
|
+
const encode$k = (params2) => {
|
|
26914
26911
|
const { nodes } = params2;
|
|
26915
26912
|
const node = nodes[0];
|
|
26916
26913
|
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
26917
26914
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
26918
26915
|
};
|
|
26919
|
-
const decode$
|
|
26916
|
+
const decode$k = (params2) => {
|
|
26920
26917
|
const { borders = {} } = params2.node.attrs || {};
|
|
26921
26918
|
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
26922
26919
|
const newNode = {
|
|
@@ -26928,14 +26925,14 @@ const decode$j = (params2) => {
|
|
|
26928
26925
|
return newNode;
|
|
26929
26926
|
};
|
|
26930
26927
|
const propertyTranslators$2 = [
|
|
26931
|
-
translator$
|
|
26932
|
-
translator$
|
|
26928
|
+
translator$s,
|
|
26929
|
+
translator$q,
|
|
26930
|
+
translator$o,
|
|
26933
26931
|
translator$n,
|
|
26934
26932
|
translator$m,
|
|
26935
|
-
translator$
|
|
26936
|
-
translator$
|
|
26937
|
-
translator$
|
|
26938
|
-
translator$f
|
|
26933
|
+
translator$k,
|
|
26934
|
+
translator$i,
|
|
26935
|
+
translator$g
|
|
26939
26936
|
];
|
|
26940
26937
|
const tblBordersTranslatorsByXmlName = {};
|
|
26941
26938
|
const tblBordersTranslatorsBySdName = {};
|
|
@@ -26943,27 +26940,27 @@ propertyTranslators$2.forEach((translator2) => {
|
|
|
26943
26940
|
tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
26944
26941
|
tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
26945
26942
|
});
|
|
26946
|
-
const translator$
|
|
26947
|
-
xmlName: XML_NODE_NAME$
|
|
26943
|
+
const translator$e = NodeTranslator.from({
|
|
26944
|
+
xmlName: XML_NODE_NAME$d,
|
|
26948
26945
|
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
26949
26946
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26950
26947
|
attributes: [],
|
|
26951
|
-
encode: encode$
|
|
26952
|
-
decode: decode$
|
|
26948
|
+
encode: encode$k,
|
|
26949
|
+
decode: decode$k
|
|
26953
26950
|
});
|
|
26954
|
-
const XML_NODE_NAME$
|
|
26951
|
+
const XML_NODE_NAME$c = "w:tblCellMar";
|
|
26955
26952
|
const SD_ATTR_KEY$2 = "cellMargins";
|
|
26956
|
-
const encode$
|
|
26953
|
+
const encode$j = (params2) => {
|
|
26957
26954
|
const { nodes } = params2;
|
|
26958
26955
|
const node = nodes[0];
|
|
26959
26956
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
26960
26957
|
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
26961
26958
|
};
|
|
26962
|
-
const decode$
|
|
26959
|
+
const decode$j = (params2) => {
|
|
26963
26960
|
const { cellMargins = {} } = params2.node.attrs || {};
|
|
26964
26961
|
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
26965
26962
|
const newNode = {
|
|
26966
|
-
name: XML_NODE_NAME$
|
|
26963
|
+
name: XML_NODE_NAME$c,
|
|
26967
26964
|
type: "element",
|
|
26968
26965
|
attributes: {},
|
|
26969
26966
|
elements
|
|
@@ -26971,12 +26968,12 @@ const decode$i = (params2) => {
|
|
|
26971
26968
|
return newNode;
|
|
26972
26969
|
};
|
|
26973
26970
|
const propertyTranslators$1 = [
|
|
26974
|
-
translator$
|
|
26975
|
-
translator$
|
|
26976
|
-
translator$
|
|
26977
|
-
translator$
|
|
26978
|
-
translator$
|
|
26979
|
-
translator$
|
|
26971
|
+
translator$r,
|
|
26972
|
+
translator$p,
|
|
26973
|
+
translator$l,
|
|
26974
|
+
translator$j,
|
|
26975
|
+
translator$h,
|
|
26976
|
+
translator$f
|
|
26980
26977
|
];
|
|
26981
26978
|
const propertyTranslatorsByXmlName$1 = {};
|
|
26982
26979
|
const propertyTranslatorsBySdName$1 = {};
|
|
@@ -26984,27 +26981,27 @@ propertyTranslators$1.forEach((translator2) => {
|
|
|
26984
26981
|
propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
|
|
26985
26982
|
propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
|
|
26986
26983
|
});
|
|
26987
|
-
const translator$
|
|
26988
|
-
xmlName: XML_NODE_NAME$
|
|
26984
|
+
const translator$d = NodeTranslator.from({
|
|
26985
|
+
xmlName: XML_NODE_NAME$c,
|
|
26989
26986
|
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
26990
26987
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26991
26988
|
attributes: [],
|
|
26992
|
-
encode: encode$
|
|
26993
|
-
decode: decode$
|
|
26989
|
+
encode: encode$j,
|
|
26990
|
+
decode: decode$j
|
|
26994
26991
|
});
|
|
26995
|
-
const XML_NODE_NAME$
|
|
26992
|
+
const XML_NODE_NAME$b = "w:tblPr";
|
|
26996
26993
|
const SD_ATTR_KEY$1 = "tableProperties";
|
|
26997
|
-
const encode$
|
|
26994
|
+
const encode$i = (params2) => {
|
|
26998
26995
|
const { nodes } = params2;
|
|
26999
26996
|
const node = nodes[0];
|
|
27000
26997
|
const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
|
|
27001
26998
|
return {
|
|
27002
|
-
xmlName: XML_NODE_NAME$
|
|
26999
|
+
xmlName: XML_NODE_NAME$b,
|
|
27003
27000
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
27004
27001
|
attributes
|
|
27005
27002
|
};
|
|
27006
27003
|
};
|
|
27007
|
-
const decode$
|
|
27004
|
+
const decode$i = (params2) => {
|
|
27008
27005
|
const { tableProperties = {} } = params2.node.attrs || {};
|
|
27009
27006
|
const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
|
|
27010
27007
|
const newNode = {
|
|
@@ -27016,11 +27013,12 @@ const decode$h = (params2) => {
|
|
|
27016
27013
|
return newNode;
|
|
27017
27014
|
};
|
|
27018
27015
|
const propertyTranslators = [
|
|
27016
|
+
translator$F,
|
|
27017
|
+
translator$N,
|
|
27019
27018
|
translator$E,
|
|
27020
|
-
translator$M,
|
|
27021
27019
|
translator$D,
|
|
27020
|
+
translator$M,
|
|
27022
27021
|
translator$C,
|
|
27023
|
-
translator$L,
|
|
27024
27022
|
translator$B,
|
|
27025
27023
|
translator$A,
|
|
27026
27024
|
translator$z,
|
|
@@ -27030,9 +27028,8 @@ const propertyTranslators = [
|
|
|
27030
27028
|
translator$v,
|
|
27031
27029
|
translator$u,
|
|
27032
27030
|
translator$t,
|
|
27033
|
-
translator$
|
|
27034
|
-
translator$d
|
|
27035
|
-
translator$c
|
|
27031
|
+
translator$e,
|
|
27032
|
+
translator$d
|
|
27036
27033
|
];
|
|
27037
27034
|
const propertyTranslatorsByXmlName = {};
|
|
27038
27035
|
const propertyTranslatorsBySdName = {};
|
|
@@ -27040,14 +27037,14 @@ propertyTranslators.forEach((translator2) => {
|
|
|
27040
27037
|
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
27041
27038
|
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
27042
27039
|
});
|
|
27043
|
-
const config$
|
|
27044
|
-
xmlName: XML_NODE_NAME$
|
|
27040
|
+
const config$b = {
|
|
27041
|
+
xmlName: XML_NODE_NAME$b,
|
|
27045
27042
|
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
27046
|
-
encode: encode$
|
|
27047
|
-
decode: decode$
|
|
27043
|
+
encode: encode$i,
|
|
27044
|
+
decode: decode$i
|
|
27048
27045
|
};
|
|
27049
|
-
const translator$
|
|
27050
|
-
const translator$
|
|
27046
|
+
const translator$c = NodeTranslator.from(config$b);
|
|
27047
|
+
const translator$b = NodeTranslator.from(
|
|
27051
27048
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
27052
27049
|
);
|
|
27053
27050
|
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
@@ -27097,20 +27094,20 @@ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwip
|
|
|
27097
27094
|
}
|
|
27098
27095
|
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
27099
27096
|
};
|
|
27100
|
-
const XML_NODE_NAME$
|
|
27097
|
+
const XML_NODE_NAME$a = "w:tblGrid";
|
|
27101
27098
|
const SD_ATTR_KEY = "grid";
|
|
27102
27099
|
const cellMinWidth = pixelsToTwips(10);
|
|
27103
|
-
const encode$
|
|
27100
|
+
const encode$h = (params2) => {
|
|
27104
27101
|
const { nodes } = params2;
|
|
27105
27102
|
const node = nodes[0];
|
|
27106
|
-
const attributes = encodeProperties(node, { [translator$
|
|
27103
|
+
const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
|
|
27107
27104
|
return {
|
|
27108
|
-
xmlName: XML_NODE_NAME$
|
|
27105
|
+
xmlName: XML_NODE_NAME$a,
|
|
27109
27106
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
27110
27107
|
attributes
|
|
27111
27108
|
};
|
|
27112
27109
|
};
|
|
27113
|
-
const decode$
|
|
27110
|
+
const decode$h = (params2) => {
|
|
27114
27111
|
const { grid: rawGrid } = params2.node.attrs || {};
|
|
27115
27112
|
const grid = Array.isArray(rawGrid) ? rawGrid : [];
|
|
27116
27113
|
const { firstRow = {} } = params2.extraParams || {};
|
|
@@ -27129,10 +27126,10 @@ const decode$g = (params2) => {
|
|
|
27129
27126
|
numericWidth = fallbackColumnWidthTwips;
|
|
27130
27127
|
}
|
|
27131
27128
|
numericWidth = Math.max(numericWidth, cellMinWidth);
|
|
27132
|
-
const decoded = translator$
|
|
27129
|
+
const decoded = translator$b.decode({
|
|
27133
27130
|
node: { type: (
|
|
27134
27131
|
/** @type {string} */
|
|
27135
|
-
translator$
|
|
27132
|
+
translator$b.sdNodeOrKeyName
|
|
27136
27133
|
), attrs: { col: numericWidth } }
|
|
27137
27134
|
});
|
|
27138
27135
|
if (decoded) elements.push(decoded);
|
|
@@ -27167,39 +27164,100 @@ const decode$g = (params2) => {
|
|
|
27167
27164
|
columnIndex++;
|
|
27168
27165
|
}
|
|
27169
27166
|
const newNode = {
|
|
27170
|
-
name: XML_NODE_NAME$
|
|
27167
|
+
name: XML_NODE_NAME$a,
|
|
27171
27168
|
attributes: {},
|
|
27172
27169
|
elements
|
|
27173
27170
|
};
|
|
27174
27171
|
return newNode;
|
|
27175
27172
|
};
|
|
27176
|
-
const config$
|
|
27177
|
-
xmlName: XML_NODE_NAME$
|
|
27173
|
+
const config$a = {
|
|
27174
|
+
xmlName: XML_NODE_NAME$a,
|
|
27178
27175
|
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
27179
|
-
encode: encode$
|
|
27180
|
-
decode: decode$
|
|
27176
|
+
encode: encode$h,
|
|
27177
|
+
decode: decode$h
|
|
27181
27178
|
};
|
|
27182
|
-
const translator$
|
|
27183
|
-
const
|
|
27184
|
-
const
|
|
27185
|
-
const
|
|
27179
|
+
const translator$a = NodeTranslator.from(config$a);
|
|
27180
|
+
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
27181
|
+
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
27182
|
+
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
27183
|
+
const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
|
|
27184
|
+
const pctToPercent = (value) => {
|
|
27185
|
+
if (value == null) return null;
|
|
27186
|
+
return value / 50;
|
|
27187
|
+
};
|
|
27188
|
+
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
27189
|
+
const resolveMeasurementWidthPx = (measurement) => {
|
|
27190
|
+
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
27191
|
+
const { value, type: type2 } = measurement;
|
|
27192
|
+
if (!type2 || type2 === "auto") return null;
|
|
27193
|
+
if (type2 === "dxa") return twipsToPixels(value);
|
|
27194
|
+
if (type2 === "pct") {
|
|
27195
|
+
const percent2 = pctToPercent(value);
|
|
27196
|
+
if (percent2 == null || percent2 <= 0) return null;
|
|
27197
|
+
const widthTwips = resolveContentWidthTwips() * percent2 / 100;
|
|
27198
|
+
return twipsToPixels(widthTwips);
|
|
27199
|
+
}
|
|
27200
|
+
return null;
|
|
27201
|
+
};
|
|
27202
|
+
const countColumnsInRow = (row) => {
|
|
27203
|
+
if (!row?.elements?.length) return 0;
|
|
27204
|
+
return row.elements.reduce((count, element) => {
|
|
27205
|
+
if (element.name !== "w:tc") return count;
|
|
27206
|
+
const tcPr = element.elements?.find((el) => el.name === "w:tcPr");
|
|
27207
|
+
const gridSpan = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27208
|
+
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
27209
|
+
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
27210
|
+
}, 0);
|
|
27211
|
+
};
|
|
27212
|
+
const clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
27213
|
+
const createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
27214
|
+
const buildFallbackGridForTable = ({ params: params2, rows, tableWidth, tableWidthMeasurement }) => {
|
|
27215
|
+
const firstRow = rows.find((row) => row.elements?.some((el) => el.name === "w:tc"));
|
|
27216
|
+
const columnCount = countColumnsInRow(firstRow);
|
|
27217
|
+
if (!columnCount) return null;
|
|
27218
|
+
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(
|
|
27219
|
+
/** @type {any} */
|
|
27220
|
+
params2
|
|
27221
|
+
);
|
|
27222
|
+
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : DEFAULT_COLUMN_WIDTH_PX;
|
|
27223
|
+
let totalWidthPx;
|
|
27224
|
+
if (tableWidthMeasurement) {
|
|
27225
|
+
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
27226
|
+
if (resolved != null) totalWidthPx = resolved;
|
|
27227
|
+
}
|
|
27228
|
+
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) {
|
|
27229
|
+
totalWidthPx = tableWidth.width;
|
|
27230
|
+
}
|
|
27231
|
+
if (totalWidthPx == null) {
|
|
27232
|
+
totalWidthPx = minimumColumnWidthPx * columnCount;
|
|
27233
|
+
}
|
|
27234
|
+
const rawColumnWidthPx = Math.max(totalWidthPx / columnCount, minimumColumnWidthPx);
|
|
27235
|
+
const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(rawColumnWidthPx));
|
|
27236
|
+
const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
|
|
27237
|
+
return {
|
|
27238
|
+
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
27239
|
+
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27240
|
+
};
|
|
27241
|
+
};
|
|
27242
|
+
const XML_NODE_NAME$9 = "w:tbl";
|
|
27243
|
+
const SD_NODE_NAME$9 = "table";
|
|
27244
|
+
const encode$g = (params2, encodedAttrs) => {
|
|
27186
27245
|
const { nodes } = params2;
|
|
27187
27246
|
const node = nodes[0];
|
|
27188
27247
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
27189
27248
|
if (tblPr) {
|
|
27190
|
-
const encodedProperties = translator$
|
|
27249
|
+
const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
|
|
27191
27250
|
encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
|
|
27192
27251
|
}
|
|
27193
27252
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
27194
27253
|
if (tblGrid) {
|
|
27195
|
-
encodedAttrs["grid"] = translator$
|
|
27254
|
+
encodedAttrs["grid"] = translator$a.encode({ ...params2, nodes: [tblGrid] }).attributes;
|
|
27196
27255
|
}
|
|
27197
27256
|
[
|
|
27198
27257
|
"tableStyleId",
|
|
27199
27258
|
"justification",
|
|
27200
27259
|
"tableLayout",
|
|
27201
27260
|
["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
27202
|
-
["tableWidth", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
27203
27261
|
["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
|
|
27204
27262
|
].forEach((prop) => {
|
|
27205
27263
|
let key2;
|
|
@@ -27217,6 +27275,21 @@ const encode$f = (params2, encodedAttrs) => {
|
|
|
27217
27275
|
if (encodedAttrs.tableCellSpacing) {
|
|
27218
27276
|
encodedAttrs["borderCollapse"] = "separate";
|
|
27219
27277
|
}
|
|
27278
|
+
if (encodedAttrs.tableProperties?.tableWidth) {
|
|
27279
|
+
const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
|
|
27280
|
+
const widthPx = twipsToPixels(tableWidthMeasurement.value);
|
|
27281
|
+
if (widthPx != null) {
|
|
27282
|
+
encodedAttrs.tableWidth = {
|
|
27283
|
+
width: widthPx,
|
|
27284
|
+
type: tableWidthMeasurement.type
|
|
27285
|
+
};
|
|
27286
|
+
} else if (tableWidthMeasurement.type === "auto") {
|
|
27287
|
+
encodedAttrs.tableWidth = {
|
|
27288
|
+
width: 0,
|
|
27289
|
+
type: tableWidthMeasurement.type
|
|
27290
|
+
};
|
|
27291
|
+
}
|
|
27292
|
+
}
|
|
27220
27293
|
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
27221
27294
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
|
|
27222
27295
|
if (referencedStyles?.cellMargins && !encodedAttrs.tableProperties?.cellMargins) {
|
|
@@ -27230,10 +27303,22 @@ const encode$f = (params2, encodedAttrs) => {
|
|
|
27230
27303
|
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
27231
27304
|
encodedAttrs["borders"] = borderData;
|
|
27232
27305
|
const tblStyleTag = tblPr?.elements?.find((el) => el.name === "w:tblStyle");
|
|
27233
|
-
|
|
27306
|
+
let columnWidths = Array.isArray(encodedAttrs["grid"]) ? encodedAttrs["grid"].map((item) => twipsToPixels(item.col)) : [];
|
|
27307
|
+
if (!columnWidths.length) {
|
|
27308
|
+
const fallback = buildFallbackGridForTable({
|
|
27309
|
+
params: params2,
|
|
27310
|
+
rows,
|
|
27311
|
+
tableWidth: encodedAttrs.tableWidth,
|
|
27312
|
+
tableWidthMeasurement: encodedAttrs.tableProperties?.tableWidth
|
|
27313
|
+
});
|
|
27314
|
+
if (fallback) {
|
|
27315
|
+
encodedAttrs.grid = fallback.grid;
|
|
27316
|
+
columnWidths = fallback.columnWidths;
|
|
27317
|
+
}
|
|
27318
|
+
}
|
|
27234
27319
|
const content = [];
|
|
27235
27320
|
rows.forEach((row) => {
|
|
27236
|
-
const result = translator$
|
|
27321
|
+
const result = translator$G.encode({
|
|
27237
27322
|
...params2,
|
|
27238
27323
|
nodes: [row],
|
|
27239
27324
|
extraParams: {
|
|
@@ -27252,13 +27337,13 @@ const encode$f = (params2, encodedAttrs) => {
|
|
|
27252
27337
|
attrs: encodedAttrs
|
|
27253
27338
|
};
|
|
27254
27339
|
};
|
|
27255
|
-
const decode$
|
|
27340
|
+
const decode$g = (params2, decodedAttrs) => {
|
|
27256
27341
|
params2.node = preProcessVerticalMergeCells(params2.node, params2);
|
|
27257
27342
|
const { node } = params2;
|
|
27258
27343
|
const elements = translateChildNodes(params2);
|
|
27259
27344
|
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
27260
27345
|
const properties = node.attrs.grid;
|
|
27261
|
-
const element = translator$
|
|
27346
|
+
const element = translator$a.decode({
|
|
27262
27347
|
...params2,
|
|
27263
27348
|
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
27264
27349
|
extraParams: {
|
|
@@ -27268,7 +27353,7 @@ const decode$f = (params2, decodedAttrs) => {
|
|
|
27268
27353
|
if (element) elements.unshift(element);
|
|
27269
27354
|
if (node.attrs?.tableProperties) {
|
|
27270
27355
|
const properties2 = { ...node.attrs.tableProperties };
|
|
27271
|
-
const element2 = translator$
|
|
27356
|
+
const element2 = translator$c.decode({
|
|
27272
27357
|
...params2,
|
|
27273
27358
|
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
27274
27359
|
});
|
|
@@ -27334,7 +27419,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
|
|
|
27334
27419
|
if (baseTblPr && baseTblPr.elements) {
|
|
27335
27420
|
tblPr.elements.push(...baseTblPr.elements);
|
|
27336
27421
|
}
|
|
27337
|
-
const tableProperties = translator$
|
|
27422
|
+
const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] }).attributes;
|
|
27338
27423
|
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
27339
27424
|
if (borders) stylesToReturn.borders = borders;
|
|
27340
27425
|
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
@@ -27351,16 +27436,16 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
|
|
|
27351
27436
|
}
|
|
27352
27437
|
return stylesToReturn;
|
|
27353
27438
|
}
|
|
27354
|
-
const config$
|
|
27355
|
-
xmlName: XML_NODE_NAME$
|
|
27356
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
27439
|
+
const config$9 = {
|
|
27440
|
+
xmlName: XML_NODE_NAME$9,
|
|
27441
|
+
sdNodeOrKeyName: SD_NODE_NAME$9,
|
|
27357
27442
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27358
|
-
encode: encode$
|
|
27359
|
-
decode: decode$
|
|
27443
|
+
encode: encode$g,
|
|
27444
|
+
decode: decode$g,
|
|
27360
27445
|
attributes: []
|
|
27361
27446
|
};
|
|
27362
|
-
const translator$
|
|
27363
|
-
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$
|
|
27447
|
+
const translator$9 = NodeTranslator.from(config$9);
|
|
27448
|
+
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
|
|
27364
27449
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
27365
27450
|
if (!tblStyleTag) return null;
|
|
27366
27451
|
const stylesToReturn = {};
|
|
@@ -27722,10 +27807,10 @@ function generateCellMargins(cellMargins) {
|
|
|
27722
27807
|
if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
|
|
27723
27808
|
return elements;
|
|
27724
27809
|
}
|
|
27725
|
-
const XML_NODE_NAME$
|
|
27726
|
-
const SD_NODE_NAME$
|
|
27727
|
-
const validXmlAttributes$
|
|
27728
|
-
function encode$
|
|
27810
|
+
const XML_NODE_NAME$8 = "w:tc";
|
|
27811
|
+
const SD_NODE_NAME$8 = "tableCell";
|
|
27812
|
+
const validXmlAttributes$8 = [];
|
|
27813
|
+
function encode$f(params2, encodedAttrs) {
|
|
27729
27814
|
const {
|
|
27730
27815
|
node,
|
|
27731
27816
|
table,
|
|
@@ -27752,31 +27837,31 @@ function encode$e(params2, encodedAttrs) {
|
|
|
27752
27837
|
}
|
|
27753
27838
|
return schemaNode;
|
|
27754
27839
|
}
|
|
27755
|
-
function decode$
|
|
27840
|
+
function decode$f(params2, decodedAttrs) {
|
|
27756
27841
|
const translated = translateTableCell(params2);
|
|
27757
27842
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
27758
27843
|
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
27759
27844
|
}
|
|
27760
27845
|
return translated;
|
|
27761
27846
|
}
|
|
27762
|
-
const config$
|
|
27763
|
-
xmlName: XML_NODE_NAME$
|
|
27764
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
27847
|
+
const config$8 = {
|
|
27848
|
+
xmlName: XML_NODE_NAME$8,
|
|
27849
|
+
sdNodeOrKeyName: SD_NODE_NAME$8,
|
|
27765
27850
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27766
|
-
encode: encode$
|
|
27767
|
-
decode: decode$
|
|
27768
|
-
attributes: validXmlAttributes$
|
|
27851
|
+
encode: encode$f,
|
|
27852
|
+
decode: decode$f,
|
|
27853
|
+
attributes: validXmlAttributes$8
|
|
27769
27854
|
};
|
|
27770
|
-
const translator$
|
|
27771
|
-
const XML_NODE_NAME$
|
|
27772
|
-
const SD_NODE_NAME$
|
|
27855
|
+
const translator$8 = NodeTranslator.from(config$8);
|
|
27856
|
+
const XML_NODE_NAME$7 = "w:hyperlink";
|
|
27857
|
+
const SD_NODE_NAME$7 = "link";
|
|
27773
27858
|
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
27774
27859
|
xmlName,
|
|
27775
27860
|
sdName,
|
|
27776
27861
|
encode: (attributes) => attributes[xmlName],
|
|
27777
27862
|
decode: (attributes) => attributes[sdName]
|
|
27778
27863
|
});
|
|
27779
|
-
const validXmlAttributes$
|
|
27864
|
+
const validXmlAttributes$7 = [
|
|
27780
27865
|
_createAttributeHandler("w:anchor", "anchor"),
|
|
27781
27866
|
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
27782
27867
|
{
|
|
@@ -27789,7 +27874,7 @@ const validXmlAttributes$6 = [
|
|
|
27789
27874
|
_createAttributeHandler("r:id", "rId"),
|
|
27790
27875
|
_createAttributeHandler("w:tgtFrame", "target")
|
|
27791
27876
|
];
|
|
27792
|
-
const encode$
|
|
27877
|
+
const encode$e = (params2, encodedAttrs) => {
|
|
27793
27878
|
const { nodes, docx, nodeListHandler } = params2;
|
|
27794
27879
|
const node = nodes[0];
|
|
27795
27880
|
let href = _resolveHref(docx, encodedAttrs);
|
|
@@ -27855,7 +27940,7 @@ const _resolveHref = (docx, encodedAttrs) => {
|
|
|
27855
27940
|
}
|
|
27856
27941
|
return href;
|
|
27857
27942
|
};
|
|
27858
|
-
function decode$
|
|
27943
|
+
function decode$e(params2) {
|
|
27859
27944
|
const { node } = params2;
|
|
27860
27945
|
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
27861
27946
|
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
@@ -27899,15 +27984,15 @@ function _addNewLinkRelationship(params2, link, rId) {
|
|
|
27899
27984
|
});
|
|
27900
27985
|
return rId;
|
|
27901
27986
|
}
|
|
27902
|
-
const config$
|
|
27903
|
-
xmlName: XML_NODE_NAME$
|
|
27904
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
27987
|
+
const config$7 = {
|
|
27988
|
+
xmlName: XML_NODE_NAME$7,
|
|
27989
|
+
sdNodeOrKeyName: SD_NODE_NAME$7,
|
|
27905
27990
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27906
|
-
encode: encode$
|
|
27907
|
-
decode: decode$
|
|
27908
|
-
attributes: validXmlAttributes$
|
|
27991
|
+
encode: encode$e,
|
|
27992
|
+
decode: decode$e,
|
|
27993
|
+
attributes: validXmlAttributes$7
|
|
27909
27994
|
};
|
|
27910
|
-
const translator$
|
|
27995
|
+
const translator$7 = NodeTranslator.from(config$7);
|
|
27911
27996
|
function parseTagValueJSON(json) {
|
|
27912
27997
|
if (typeof json !== "string") {
|
|
27913
27998
|
return {};
|
|
@@ -28702,32 +28787,32 @@ function translateAnchorNode(params2) {
|
|
|
28702
28787
|
elements: [...anchorElements, ...elementsWithWrap]
|
|
28703
28788
|
};
|
|
28704
28789
|
}
|
|
28705
|
-
const XML_NODE_NAME$
|
|
28706
|
-
const SD_NODE_NAME$
|
|
28707
|
-
const validXmlAttributes$
|
|
28708
|
-
function encode$
|
|
28790
|
+
const XML_NODE_NAME$6 = "wp:anchor";
|
|
28791
|
+
const SD_NODE_NAME$6 = ["image"];
|
|
28792
|
+
const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
28793
|
+
function encode$d(params2) {
|
|
28709
28794
|
const { node } = params2.extraParams;
|
|
28710
28795
|
if (!node || !node.type) {
|
|
28711
28796
|
return null;
|
|
28712
28797
|
}
|
|
28713
28798
|
return handleAnchorNode(params2);
|
|
28714
28799
|
}
|
|
28715
|
-
function decode$
|
|
28800
|
+
function decode$d(params2) {
|
|
28716
28801
|
const { node } = params2;
|
|
28717
28802
|
if (!node || !node.type) {
|
|
28718
28803
|
return null;
|
|
28719
28804
|
}
|
|
28720
28805
|
return translateAnchorNode(params2);
|
|
28721
28806
|
}
|
|
28722
|
-
const config$
|
|
28723
|
-
xmlName: XML_NODE_NAME$
|
|
28724
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28807
|
+
const config$6 = {
|
|
28808
|
+
xmlName: XML_NODE_NAME$6,
|
|
28809
|
+
sdNodeOrKeyName: SD_NODE_NAME$6,
|
|
28725
28810
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28726
|
-
encode: encode$
|
|
28727
|
-
decode: decode$
|
|
28728
|
-
attributes: validXmlAttributes$
|
|
28811
|
+
encode: encode$d,
|
|
28812
|
+
decode: decode$d,
|
|
28813
|
+
attributes: validXmlAttributes$6
|
|
28729
28814
|
};
|
|
28730
|
-
const translator$
|
|
28815
|
+
const translator$6 = NodeTranslator.from(config$6);
|
|
28731
28816
|
function handleInlineNode(params2) {
|
|
28732
28817
|
const { node } = params2.extraParams;
|
|
28733
28818
|
if (node.name !== "wp:inline") {
|
|
@@ -28743,41 +28828,41 @@ function translateInlineNode(params2) {
|
|
|
28743
28828
|
elements: nodeElements.elements
|
|
28744
28829
|
};
|
|
28745
28830
|
}
|
|
28746
|
-
const XML_NODE_NAME$
|
|
28747
|
-
const SD_NODE_NAME$
|
|
28748
|
-
const validXmlAttributes$
|
|
28749
|
-
function encode$
|
|
28831
|
+
const XML_NODE_NAME$5 = "wp:inline";
|
|
28832
|
+
const SD_NODE_NAME$5 = ["image"];
|
|
28833
|
+
const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
|
|
28834
|
+
function encode$c(params2) {
|
|
28750
28835
|
const { node } = params2.extraParams;
|
|
28751
28836
|
if (!node || !node.type) {
|
|
28752
28837
|
return null;
|
|
28753
28838
|
}
|
|
28754
28839
|
return handleInlineNode(params2);
|
|
28755
28840
|
}
|
|
28756
|
-
function decode$
|
|
28841
|
+
function decode$c(params2) {
|
|
28757
28842
|
const { node } = params2;
|
|
28758
28843
|
if (!node || !node.type) {
|
|
28759
28844
|
return null;
|
|
28760
28845
|
}
|
|
28761
28846
|
return translateInlineNode(params2);
|
|
28762
28847
|
}
|
|
28763
|
-
const config$
|
|
28764
|
-
xmlName: XML_NODE_NAME$
|
|
28765
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28848
|
+
const config$5 = {
|
|
28849
|
+
xmlName: XML_NODE_NAME$5,
|
|
28850
|
+
sdNodeOrKeyName: SD_NODE_NAME$5,
|
|
28766
28851
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28767
|
-
encode: encode$
|
|
28768
|
-
decode: decode$
|
|
28769
|
-
attributes: validXmlAttributes$
|
|
28852
|
+
encode: encode$c,
|
|
28853
|
+
decode: decode$c,
|
|
28854
|
+
attributes: validXmlAttributes$5
|
|
28770
28855
|
};
|
|
28771
|
-
const translator$
|
|
28772
|
-
const XML_NODE_NAME$
|
|
28773
|
-
const SD_NODE_NAME$
|
|
28774
|
-
const validXmlAttributes$
|
|
28775
|
-
function encode$
|
|
28856
|
+
const translator$5 = NodeTranslator.from(config$5);
|
|
28857
|
+
const XML_NODE_NAME$4 = "w:drawing";
|
|
28858
|
+
const SD_NODE_NAME$4 = [];
|
|
28859
|
+
const validXmlAttributes$4 = [];
|
|
28860
|
+
function encode$b(params2) {
|
|
28776
28861
|
const nodes = params2.nodes;
|
|
28777
28862
|
const node = nodes[0];
|
|
28778
28863
|
const translatorByChildName = {
|
|
28779
|
-
"wp:anchor": translator$
|
|
28780
|
-
"wp:inline": translator$
|
|
28864
|
+
"wp:anchor": translator$6,
|
|
28865
|
+
"wp:inline": translator$5
|
|
28781
28866
|
};
|
|
28782
28867
|
return node.elements.reduce((acc, child) => {
|
|
28783
28868
|
if (acc) return acc;
|
|
@@ -28786,12 +28871,12 @@ function encode$a(params2) {
|
|
|
28786
28871
|
return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
|
|
28787
28872
|
}, null);
|
|
28788
28873
|
}
|
|
28789
|
-
function decode$
|
|
28874
|
+
function decode$b(params2) {
|
|
28790
28875
|
const { node } = params2;
|
|
28791
28876
|
if (!node || !node.type) {
|
|
28792
28877
|
return null;
|
|
28793
28878
|
}
|
|
28794
|
-
const childTranslator = node.attrs.isAnchor ? translator$
|
|
28879
|
+
const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
|
|
28795
28880
|
const resultNode = childTranslator.decode(params2);
|
|
28796
28881
|
return wrapTextInRun(
|
|
28797
28882
|
{
|
|
@@ -28801,15 +28886,15 @@ function decode$a(params2) {
|
|
|
28801
28886
|
[]
|
|
28802
28887
|
);
|
|
28803
28888
|
}
|
|
28804
|
-
const config$
|
|
28805
|
-
xmlName: XML_NODE_NAME$
|
|
28806
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
28889
|
+
const config$4 = {
|
|
28890
|
+
xmlName: XML_NODE_NAME$4,
|
|
28891
|
+
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
28807
28892
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28808
|
-
encode: encode$
|
|
28809
|
-
decode: decode$
|
|
28810
|
-
attributes: validXmlAttributes$
|
|
28893
|
+
encode: encode$b,
|
|
28894
|
+
decode: decode$b,
|
|
28895
|
+
attributes: validXmlAttributes$4
|
|
28811
28896
|
};
|
|
28812
|
-
const translator$
|
|
28897
|
+
const translator$4 = NodeTranslator.from(config$4);
|
|
28813
28898
|
class CommandService {
|
|
28814
28899
|
/**
|
|
28815
28900
|
* @param {import('./commands/types/index.js').CommandServiceOptions} props
|
|
@@ -30147,7 +30232,7 @@ function prepareTextAnnotation(params2) {
|
|
|
30147
30232
|
return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
|
|
30148
30233
|
}
|
|
30149
30234
|
function prepareImageAnnotation(params2, imageSize) {
|
|
30150
|
-
return translator$
|
|
30235
|
+
return translator$4.decode({
|
|
30151
30236
|
...params2,
|
|
30152
30237
|
imageSize
|
|
30153
30238
|
});
|
|
@@ -30384,10 +30469,10 @@ function translateStructuredContent(params2) {
|
|
|
30384
30469
|
};
|
|
30385
30470
|
return result;
|
|
30386
30471
|
}
|
|
30387
|
-
const XML_NODE_NAME$
|
|
30388
|
-
const SD_NODE_NAME$
|
|
30389
|
-
const validXmlAttributes$
|
|
30390
|
-
function encode$
|
|
30472
|
+
const XML_NODE_NAME$3 = "w:sdt";
|
|
30473
|
+
const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
30474
|
+
const validXmlAttributes$3 = [];
|
|
30475
|
+
function encode$a(params2) {
|
|
30391
30476
|
const nodes = params2.nodes;
|
|
30392
30477
|
const node = nodes[0];
|
|
30393
30478
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -30397,7 +30482,7 @@ function encode$9(params2) {
|
|
|
30397
30482
|
const result = handler2(params2);
|
|
30398
30483
|
return result;
|
|
30399
30484
|
}
|
|
30400
|
-
function decode$
|
|
30485
|
+
function decode$a(params2) {
|
|
30401
30486
|
const { node } = params2;
|
|
30402
30487
|
if (!node || !node.type) {
|
|
30403
30488
|
return null;
|
|
@@ -30413,85 +30498,85 @@ function decode$9(params2) {
|
|
|
30413
30498
|
const result = decoder();
|
|
30414
30499
|
return result;
|
|
30415
30500
|
}
|
|
30416
|
-
const config$
|
|
30417
|
-
xmlName: XML_NODE_NAME$
|
|
30418
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
30501
|
+
const config$3 = {
|
|
30502
|
+
xmlName: XML_NODE_NAME$3,
|
|
30503
|
+
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
30419
30504
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30420
|
-
encode: encode$
|
|
30421
|
-
decode: decode$
|
|
30422
|
-
attributes: validXmlAttributes$
|
|
30505
|
+
encode: encode$a,
|
|
30506
|
+
decode: decode$a,
|
|
30507
|
+
attributes: validXmlAttributes$3
|
|
30423
30508
|
};
|
|
30424
|
-
const translator$
|
|
30425
|
-
const encode$
|
|
30509
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
30510
|
+
const encode$9 = (attributes) => {
|
|
30426
30511
|
return attributes["w:id"];
|
|
30427
30512
|
};
|
|
30428
|
-
const decode$
|
|
30513
|
+
const decode$9 = (attrs) => {
|
|
30429
30514
|
return attrs.id;
|
|
30430
30515
|
};
|
|
30431
30516
|
const attrConfig$6 = Object.freeze({
|
|
30432
30517
|
xmlName: "w:id",
|
|
30433
30518
|
sdName: "id",
|
|
30434
|
-
encode: encode$
|
|
30435
|
-
decode: decode$
|
|
30519
|
+
encode: encode$9,
|
|
30520
|
+
decode: decode$9
|
|
30436
30521
|
});
|
|
30437
|
-
const encode$
|
|
30522
|
+
const encode$8 = (attributes) => {
|
|
30438
30523
|
return attributes["w:name"];
|
|
30439
30524
|
};
|
|
30440
|
-
const decode$
|
|
30525
|
+
const decode$8 = (attrs) => {
|
|
30441
30526
|
return attrs.name;
|
|
30442
30527
|
};
|
|
30443
30528
|
const attrConfig$5 = Object.freeze({
|
|
30444
30529
|
xmlName: "w:name",
|
|
30445
30530
|
sdName: "name",
|
|
30446
|
-
encode: encode$
|
|
30447
|
-
decode: decode$
|
|
30531
|
+
encode: encode$8,
|
|
30532
|
+
decode: decode$8
|
|
30448
30533
|
});
|
|
30449
|
-
const encode$
|
|
30534
|
+
const encode$7 = (attributes) => {
|
|
30450
30535
|
return attributes["w:colFirst"];
|
|
30451
30536
|
};
|
|
30452
|
-
const decode$
|
|
30537
|
+
const decode$7 = (attrs) => {
|
|
30453
30538
|
return attrs.colFirst;
|
|
30454
30539
|
};
|
|
30455
30540
|
const attrConfig$4 = Object.freeze({
|
|
30456
30541
|
xmlName: "w:colFirst",
|
|
30457
30542
|
sdName: "colFirst",
|
|
30458
|
-
encode: encode$
|
|
30459
|
-
decode: decode$
|
|
30543
|
+
encode: encode$7,
|
|
30544
|
+
decode: decode$7
|
|
30460
30545
|
});
|
|
30461
|
-
const encode$
|
|
30546
|
+
const encode$6 = (attributes) => {
|
|
30462
30547
|
return attributes["w:colLast"];
|
|
30463
30548
|
};
|
|
30464
|
-
const decode$
|
|
30549
|
+
const decode$6 = (attrs) => {
|
|
30465
30550
|
return attrs.colLast;
|
|
30466
30551
|
};
|
|
30467
30552
|
const attrConfig$3 = Object.freeze({
|
|
30468
30553
|
xmlName: "w:colLast",
|
|
30469
30554
|
sdName: "colLast",
|
|
30470
|
-
encode: encode$
|
|
30471
|
-
decode: decode$
|
|
30555
|
+
encode: encode$6,
|
|
30556
|
+
decode: decode$6
|
|
30472
30557
|
});
|
|
30473
|
-
const encode$
|
|
30558
|
+
const encode$5 = (attributes) => {
|
|
30474
30559
|
return attributes["w:displacedByCustomXml"];
|
|
30475
30560
|
};
|
|
30476
|
-
const decode$
|
|
30561
|
+
const decode$5 = (attrs) => {
|
|
30477
30562
|
return attrs.displacedByCustomXml;
|
|
30478
30563
|
};
|
|
30479
30564
|
const attrConfig$2 = Object.freeze({
|
|
30480
30565
|
xmlName: "w:displacedByCustomXml",
|
|
30481
30566
|
sdName: "displacedByCustomXml",
|
|
30482
|
-
encode: encode$
|
|
30483
|
-
decode: decode$
|
|
30567
|
+
encode: encode$5,
|
|
30568
|
+
decode: decode$5
|
|
30484
30569
|
});
|
|
30485
|
-
const validXmlAttributes$
|
|
30486
|
-
const XML_NODE_NAME$
|
|
30487
|
-
const SD_NODE_NAME$
|
|
30488
|
-
const encode$
|
|
30570
|
+
const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
|
|
30571
|
+
const XML_NODE_NAME$2 = "w:bookmarkStart";
|
|
30572
|
+
const SD_NODE_NAME$2 = "bookmarkStart";
|
|
30573
|
+
const encode$4 = (params2, encodedAttrs = {}) => {
|
|
30489
30574
|
return {
|
|
30490
30575
|
type: "bookmarkStart",
|
|
30491
30576
|
attrs: encodedAttrs
|
|
30492
30577
|
};
|
|
30493
30578
|
};
|
|
30494
|
-
const decode$
|
|
30579
|
+
const decode$4 = (params2, decodedAttrs = {}) => {
|
|
30495
30580
|
const result = {
|
|
30496
30581
|
name: "w:bookmarkStart",
|
|
30497
30582
|
elements: []
|
|
@@ -30501,49 +30586,49 @@ const decode$3 = (params2, decodedAttrs = {}) => {
|
|
|
30501
30586
|
}
|
|
30502
30587
|
return result;
|
|
30503
30588
|
};
|
|
30504
|
-
const config$
|
|
30505
|
-
xmlName: XML_NODE_NAME$
|
|
30506
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
30589
|
+
const config$2 = {
|
|
30590
|
+
xmlName: XML_NODE_NAME$2,
|
|
30591
|
+
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
30507
30592
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30508
|
-
encode: encode$
|
|
30509
|
-
decode: decode$
|
|
30510
|
-
attributes: validXmlAttributes$
|
|
30593
|
+
encode: encode$4,
|
|
30594
|
+
decode: decode$4,
|
|
30595
|
+
attributes: validXmlAttributes$2
|
|
30511
30596
|
};
|
|
30512
|
-
const translator$
|
|
30513
|
-
const encode$
|
|
30597
|
+
const translator$2 = NodeTranslator.from(config$2);
|
|
30598
|
+
const encode$3 = (attributes) => {
|
|
30514
30599
|
return attributes["w:id"];
|
|
30515
30600
|
};
|
|
30516
|
-
const decode$
|
|
30601
|
+
const decode$3 = (attrs) => {
|
|
30517
30602
|
return attrs.id;
|
|
30518
30603
|
};
|
|
30519
30604
|
const attrConfig$1 = Object.freeze({
|
|
30520
30605
|
xmlName: "w:id",
|
|
30521
30606
|
sdName: "id",
|
|
30522
|
-
encode: encode$
|
|
30523
|
-
decode: decode$
|
|
30607
|
+
encode: encode$3,
|
|
30608
|
+
decode: decode$3
|
|
30524
30609
|
});
|
|
30525
|
-
const encode$
|
|
30610
|
+
const encode$2 = (attributes) => {
|
|
30526
30611
|
return attributes["w:displacedByCustomXml"];
|
|
30527
30612
|
};
|
|
30528
|
-
const decode$
|
|
30613
|
+
const decode$2 = (attrs) => {
|
|
30529
30614
|
return attrs.displacedByCustomXml;
|
|
30530
30615
|
};
|
|
30531
30616
|
const attrConfig = Object.freeze({
|
|
30532
30617
|
xmlName: "w:displacedByCustomXml",
|
|
30533
30618
|
sdName: "displacedByCustomXml",
|
|
30534
|
-
encode: encode$
|
|
30535
|
-
decode: decode$
|
|
30619
|
+
encode: encode$2,
|
|
30620
|
+
decode: decode$2
|
|
30536
30621
|
});
|
|
30537
|
-
const validXmlAttributes = [attrConfig$1, attrConfig];
|
|
30538
|
-
const XML_NODE_NAME = "w:bookmarkEnd";
|
|
30539
|
-
const SD_NODE_NAME = "bookmarkEnd";
|
|
30540
|
-
const encode$
|
|
30622
|
+
const validXmlAttributes$1 = [attrConfig$1, attrConfig];
|
|
30623
|
+
const XML_NODE_NAME$1 = "w:bookmarkEnd";
|
|
30624
|
+
const SD_NODE_NAME$1 = "bookmarkEnd";
|
|
30625
|
+
const encode$1 = (params2, encodedAttrs = {}) => {
|
|
30541
30626
|
return {
|
|
30542
30627
|
type: "bookmarkEnd",
|
|
30543
30628
|
attrs: encodedAttrs
|
|
30544
30629
|
};
|
|
30545
30630
|
};
|
|
30546
|
-
const decode = (params2, decodedAttrs = {}) => {
|
|
30631
|
+
const decode$1 = (params2, decodedAttrs = {}) => {
|
|
30547
30632
|
const result = {
|
|
30548
30633
|
name: "w:bookmarkEnd",
|
|
30549
30634
|
elements: []
|
|
@@ -30553,15 +30638,121 @@ const decode = (params2, decodedAttrs = {}) => {
|
|
|
30553
30638
|
}
|
|
30554
30639
|
return result;
|
|
30555
30640
|
};
|
|
30641
|
+
const config$1 = {
|
|
30642
|
+
xmlName: XML_NODE_NAME$1,
|
|
30643
|
+
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
30644
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
30645
|
+
encode: encode$1,
|
|
30646
|
+
decode: decode$1,
|
|
30647
|
+
attributes: validXmlAttributes$1
|
|
30648
|
+
};
|
|
30649
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
30650
|
+
const XML_NODE_NAME = "mc:AlternateContent";
|
|
30651
|
+
const SD_NODE_NAME = [];
|
|
30652
|
+
const validXmlAttributes = [];
|
|
30653
|
+
function encode$19(params2) {
|
|
30654
|
+
const { nodeListHandler } = params2;
|
|
30655
|
+
const { node } = params2.extraParams;
|
|
30656
|
+
if (!node || !node.type) {
|
|
30657
|
+
return null;
|
|
30658
|
+
}
|
|
30659
|
+
const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
|
|
30660
|
+
const wpsNode = node.elements.find(
|
|
30661
|
+
(el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
|
|
30662
|
+
);
|
|
30663
|
+
if (!wpsNode) {
|
|
30664
|
+
return null;
|
|
30665
|
+
}
|
|
30666
|
+
const contents = wpsNode.elements;
|
|
30667
|
+
return nodeListHandler.handler({
|
|
30668
|
+
...params2,
|
|
30669
|
+
nodes: contents,
|
|
30670
|
+
path: [...params2.path || [], wpsNode]
|
|
30671
|
+
});
|
|
30672
|
+
}
|
|
30673
|
+
function decode(params2) {
|
|
30674
|
+
const { node } = params2;
|
|
30675
|
+
const { drawingContent } = node.attrs;
|
|
30676
|
+
const drawing = {
|
|
30677
|
+
name: "w:drawing",
|
|
30678
|
+
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
30679
|
+
};
|
|
30680
|
+
const choice = {
|
|
30681
|
+
name: "mc:Choice",
|
|
30682
|
+
attributes: { Requires: "wps" },
|
|
30683
|
+
elements: [drawing]
|
|
30684
|
+
};
|
|
30685
|
+
return {
|
|
30686
|
+
name: "mc:AlternateContent",
|
|
30687
|
+
elements: [choice]
|
|
30688
|
+
};
|
|
30689
|
+
}
|
|
30556
30690
|
const config = {
|
|
30557
30691
|
xmlName: XML_NODE_NAME,
|
|
30558
30692
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
30559
30693
|
type: NodeTranslator.translatorTypes.NODE,
|
|
30560
|
-
encode: encode$
|
|
30694
|
+
encode: encode$19,
|
|
30561
30695
|
decode,
|
|
30562
30696
|
attributes: validXmlAttributes
|
|
30563
30697
|
};
|
|
30564
30698
|
const translator = NodeTranslator.from(config);
|
|
30699
|
+
const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
|
|
30700
|
+
pageSize: Object.freeze({ width: "12240", height: "15840" }),
|
|
30701
|
+
pageMargins: Object.freeze({
|
|
30702
|
+
top: "1440",
|
|
30703
|
+
right: "1440",
|
|
30704
|
+
bottom: "1440",
|
|
30705
|
+
left: "1440",
|
|
30706
|
+
header: "720",
|
|
30707
|
+
footer: "720",
|
|
30708
|
+
gutter: "0"
|
|
30709
|
+
})
|
|
30710
|
+
});
|
|
30711
|
+
const ensureSectionLayoutDefaults = (sectPr, converter) => {
|
|
30712
|
+
if (!sectPr) {
|
|
30713
|
+
return {
|
|
30714
|
+
type: "element",
|
|
30715
|
+
name: "w:sectPr",
|
|
30716
|
+
elements: []
|
|
30717
|
+
};
|
|
30718
|
+
}
|
|
30719
|
+
if (!sectPr.elements) sectPr.elements = [];
|
|
30720
|
+
const ensureChild = (name) => {
|
|
30721
|
+
let child = sectPr.elements.find((n) => n.name === name);
|
|
30722
|
+
if (!child) {
|
|
30723
|
+
child = {
|
|
30724
|
+
type: "element",
|
|
30725
|
+
name,
|
|
30726
|
+
elements: [],
|
|
30727
|
+
attributes: {}
|
|
30728
|
+
};
|
|
30729
|
+
sectPr.elements.push(child);
|
|
30730
|
+
} else {
|
|
30731
|
+
if (!child.elements) child.elements = [];
|
|
30732
|
+
if (!child.attributes) child.attributes = {};
|
|
30733
|
+
}
|
|
30734
|
+
return child;
|
|
30735
|
+
};
|
|
30736
|
+
const pageSize = converter?.pageStyles?.pageSize;
|
|
30737
|
+
const pgSz = ensureChild("w:pgSz");
|
|
30738
|
+
if (pageSize?.width != null) pgSz.attributes["w:w"] = String(inchesToTwips(pageSize.width));
|
|
30739
|
+
if (pageSize?.height != null) pgSz.attributes["w:h"] = String(inchesToTwips(pageSize.height));
|
|
30740
|
+
if (pgSz.attributes["w:w"] == null) pgSz.attributes["w:w"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.width;
|
|
30741
|
+
if (pgSz.attributes["w:h"] == null) pgSz.attributes["w:h"] = DEFAULT_SECTION_PROPS_TWIPS.pageSize.height;
|
|
30742
|
+
const pageMargins = converter?.pageStyles?.pageMargins;
|
|
30743
|
+
const pgMar = ensureChild("w:pgMar");
|
|
30744
|
+
if (pageMargins) {
|
|
30745
|
+
Object.entries(pageMargins).forEach(([key2, value]) => {
|
|
30746
|
+
const converted = inchesToTwips(value);
|
|
30747
|
+
if (converted != null) pgMar.attributes[`w:${key2}`] = String(converted);
|
|
30748
|
+
});
|
|
30749
|
+
}
|
|
30750
|
+
Object.entries(DEFAULT_SECTION_PROPS_TWIPS.pageMargins).forEach(([key2, value]) => {
|
|
30751
|
+
const attrKey = `w:${key2}`;
|
|
30752
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
30753
|
+
});
|
|
30754
|
+
return sectPr;
|
|
30755
|
+
};
|
|
30565
30756
|
const isLineBreakOnlyRun = (node) => {
|
|
30566
30757
|
if (!node) return false;
|
|
30567
30758
|
if (node.type === "lineBreak" || node.type === "hardBreak") return true;
|
|
@@ -30576,30 +30767,30 @@ function exportSchemaToJson(params2) {
|
|
|
30576
30767
|
doc: translateDocumentNode,
|
|
30577
30768
|
body: translateBodyNode,
|
|
30578
30769
|
heading: translateHeadingNode,
|
|
30579
|
-
paragraph: translator$
|
|
30580
|
-
run: translator$
|
|
30770
|
+
paragraph: translator$13,
|
|
30771
|
+
run: translator$U,
|
|
30581
30772
|
text: translateTextNode,
|
|
30582
30773
|
bulletList: translateList,
|
|
30583
30774
|
orderedList: translateList,
|
|
30584
|
-
lineBreak: translator$
|
|
30585
|
-
table: translator$
|
|
30586
|
-
tableRow: translator$
|
|
30587
|
-
tableCell: translator$
|
|
30588
|
-
bookmarkStart: translator$
|
|
30589
|
-
bookmarkEnd: translator,
|
|
30590
|
-
fieldAnnotation: translator$
|
|
30591
|
-
tab: translator$
|
|
30592
|
-
image: translator$
|
|
30593
|
-
hardBreak: translator$
|
|
30775
|
+
lineBreak: translator$16,
|
|
30776
|
+
table: translator$9,
|
|
30777
|
+
tableRow: translator$G,
|
|
30778
|
+
tableCell: translator$8,
|
|
30779
|
+
bookmarkStart: translator$2,
|
|
30780
|
+
bookmarkEnd: translator$1,
|
|
30781
|
+
fieldAnnotation: translator$3,
|
|
30782
|
+
tab: translator$14,
|
|
30783
|
+
image: translator$4,
|
|
30784
|
+
hardBreak: translator$16,
|
|
30594
30785
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
30595
30786
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
30596
30787
|
commentReference: () => null,
|
|
30597
30788
|
shapeContainer: translateShapeContainer,
|
|
30598
30789
|
shapeTextbox: translateShapeTextbox,
|
|
30599
30790
|
contentBlock: translateContentBlock,
|
|
30600
|
-
structuredContent: translator$
|
|
30601
|
-
structuredContentBlock: translator$
|
|
30602
|
-
documentSection: translator$
|
|
30791
|
+
structuredContent: translator$3,
|
|
30792
|
+
structuredContentBlock: translator$3,
|
|
30793
|
+
documentSection: translator$3,
|
|
30603
30794
|
"page-number": translatePageNumberNode,
|
|
30604
30795
|
"total-page-number": translateTotalPageNumberNode
|
|
30605
30796
|
};
|
|
@@ -30614,28 +30805,30 @@ function exportSchemaToJson(params2) {
|
|
|
30614
30805
|
return handler2(params2);
|
|
30615
30806
|
}
|
|
30616
30807
|
function translateBodyNode(params2) {
|
|
30617
|
-
let sectPr = params2.bodyNode?.elements
|
|
30808
|
+
let sectPr = params2.bodyNode?.elements?.find((n) => n.name === "w:sectPr");
|
|
30809
|
+
if (!sectPr) {
|
|
30810
|
+
sectPr = {
|
|
30811
|
+
type: "element",
|
|
30812
|
+
name: "w:sectPr",
|
|
30813
|
+
elements: []
|
|
30814
|
+
};
|
|
30815
|
+
} else if (!sectPr.elements) {
|
|
30816
|
+
sectPr = { ...sectPr, elements: [] };
|
|
30817
|
+
}
|
|
30818
|
+
sectPr = ensureSectionLayoutDefaults(sectPr, params2.converter);
|
|
30618
30819
|
if (params2.converter) {
|
|
30619
|
-
const hasHeader = sectPr
|
|
30820
|
+
const hasHeader = sectPr.elements?.some((n) => n.name === "w:headerReference");
|
|
30620
30821
|
const hasDefaultHeader = params2.converter.headerIds?.default;
|
|
30621
30822
|
if (!hasHeader && hasDefaultHeader && !params2.editor.options.isHeaderOrFooter) {
|
|
30622
30823
|
const defaultHeader = generateDefaultHeaderFooter("header", params2.converter.headerIds?.default);
|
|
30623
30824
|
sectPr.elements.push(defaultHeader);
|
|
30624
30825
|
}
|
|
30625
|
-
const hasFooter = sectPr
|
|
30826
|
+
const hasFooter = sectPr.elements?.some((n) => n.name === "w:footerReference");
|
|
30626
30827
|
const hasDefaultFooter = params2.converter.footerIds?.default;
|
|
30627
30828
|
if (!hasFooter && hasDefaultFooter && !params2.editor.options.isHeaderOrFooter) {
|
|
30628
30829
|
const defaultFooter = generateDefaultHeaderFooter("footer", params2.converter.footerIds?.default);
|
|
30629
30830
|
sectPr.elements.push(defaultFooter);
|
|
30630
30831
|
}
|
|
30631
|
-
const newMargins = params2.converter.pageStyles.pageMargins;
|
|
30632
|
-
const sectPrMargins = sectPr.elements.find((n) => n.name === "w:pgMar");
|
|
30633
|
-
const { attributes } = sectPrMargins;
|
|
30634
|
-
Object.entries(newMargins).forEach(([key2, value]) => {
|
|
30635
|
-
const convertedValue = inchesToTwips(value);
|
|
30636
|
-
attributes[`w:${key2}`] = convertedValue;
|
|
30637
|
-
});
|
|
30638
|
-
sectPrMargins.attributes = attributes;
|
|
30639
30832
|
}
|
|
30640
30833
|
const elements = translateChildNodes(params2);
|
|
30641
30834
|
if (params2.isHeaderFooter) {
|
|
@@ -30938,7 +31131,7 @@ function translateTextNode(params2) {
|
|
|
30938
31131
|
const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
|
|
30939
31132
|
if (isTrackedNode) return translateTrackedNode(params2);
|
|
30940
31133
|
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
30941
|
-
if (isLinkNode) return translator$
|
|
31134
|
+
if (isLinkNode) return translator$7.decode(params2);
|
|
30942
31135
|
const { text, marks = [] } = node;
|
|
30943
31136
|
return getTextNodeForExport(text, marks, params2);
|
|
30944
31137
|
}
|
|
@@ -31244,7 +31437,7 @@ function translateMark(mark) {
|
|
|
31244
31437
|
markElement.type = "element";
|
|
31245
31438
|
break;
|
|
31246
31439
|
case "underline": {
|
|
31247
|
-
const translated = translator
|
|
31440
|
+
const translated = translator$10.decode({
|
|
31248
31441
|
node: {
|
|
31249
31442
|
attrs: {
|
|
31250
31443
|
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
@@ -31308,7 +31501,7 @@ function translateMark(mark) {
|
|
|
31308
31501
|
break;
|
|
31309
31502
|
case "highlight": {
|
|
31310
31503
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
31311
|
-
const translated = translator$
|
|
31504
|
+
const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
31312
31505
|
return translated || {};
|
|
31313
31506
|
}
|
|
31314
31507
|
}
|
|
@@ -31364,23 +31557,11 @@ function translateShapeTextbox(params2) {
|
|
|
31364
31557
|
}
|
|
31365
31558
|
function translateContentBlock(params2) {
|
|
31366
31559
|
const { node } = params2;
|
|
31367
|
-
const {
|
|
31560
|
+
const { vmlAttributes, horizontalRule } = node.attrs;
|
|
31368
31561
|
if (vmlAttributes || horizontalRule) {
|
|
31369
31562
|
return translateVRectContentBlock(params2);
|
|
31370
31563
|
}
|
|
31371
|
-
const
|
|
31372
|
-
name: "w:drawing",
|
|
31373
|
-
elements: [...drawingContent ? [...drawingContent.elements || []] : []]
|
|
31374
|
-
};
|
|
31375
|
-
const choice = {
|
|
31376
|
-
name: "mc:Choice",
|
|
31377
|
-
attributes: { Requires: "wps" },
|
|
31378
|
-
elements: [drawing]
|
|
31379
|
-
};
|
|
31380
|
-
const alternateContent = {
|
|
31381
|
-
name: "mc:AlternateContent",
|
|
31382
|
-
elements: [choice]
|
|
31383
|
-
};
|
|
31564
|
+
const alternateContent = translator.decode(params2);
|
|
31384
31565
|
return wrapTextInRun(alternateContent);
|
|
31385
31566
|
}
|
|
31386
31567
|
function translateVRectContentBlock(params2) {
|
|
@@ -31584,7 +31765,7 @@ const handleDrawingNode = (params2) => {
|
|
|
31584
31765
|
if (mainNode.name === "w:drawing") node = mainNode;
|
|
31585
31766
|
else node = mainNode.elements.find((el) => el.name === "w:drawing");
|
|
31586
31767
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31587
|
-
const schemaNode = translator$
|
|
31768
|
+
const schemaNode = translator$4.encode(params2);
|
|
31588
31769
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
31589
31770
|
return { nodes: newNodes, consumed: 1 };
|
|
31590
31771
|
};
|
|
@@ -31686,8 +31867,8 @@ const trackChangeNodeHandlerEntity = {
|
|
|
31686
31867
|
handlerName: "trackChangeNodeHandler",
|
|
31687
31868
|
handler: handleTrackChangeNode
|
|
31688
31869
|
};
|
|
31689
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
31690
|
-
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$
|
|
31870
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
|
|
31871
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
|
|
31691
31872
|
const handleTextNode = (params2) => {
|
|
31692
31873
|
const { nodes, insideTrackChange } = params2;
|
|
31693
31874
|
if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
|
|
@@ -31728,7 +31909,7 @@ const handleParagraphNode = (params2) => {
|
|
|
31728
31909
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
31729
31910
|
return { nodes: [], consumed: 0 };
|
|
31730
31911
|
}
|
|
31731
|
-
const schemaNode = translator$
|
|
31912
|
+
const schemaNode = translator$13.encode(params2);
|
|
31732
31913
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
31733
31914
|
return { nodes: newNodes, consumed: 1 };
|
|
31734
31915
|
};
|
|
@@ -31741,7 +31922,7 @@ const handleSdtNode = (params2) => {
|
|
|
31741
31922
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
31742
31923
|
return { nodes: [], consumed: 0 };
|
|
31743
31924
|
}
|
|
31744
|
-
const result = translator$
|
|
31925
|
+
const result = translator$3.encode(params2);
|
|
31745
31926
|
if (!result) {
|
|
31746
31927
|
return { nodes: [], consumed: 0 };
|
|
31747
31928
|
}
|
|
@@ -31831,7 +32012,7 @@ const handler = (params2) => {
|
|
|
31831
32012
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
31832
32013
|
return { nodes: [], consumed: 0 };
|
|
31833
32014
|
}
|
|
31834
|
-
const result = translator$
|
|
32015
|
+
const result = translator$16.encode(params2);
|
|
31835
32016
|
if (!result) return { nodes: [], consumed: 0 };
|
|
31836
32017
|
return {
|
|
31837
32018
|
nodes: [result],
|
|
@@ -31903,7 +32084,7 @@ const handleBookmarkStartNode = (params2) => {
|
|
|
31903
32084
|
if (isCustomMarkBookmark(nodes[0], params2.editor)) {
|
|
31904
32085
|
return handleBookmarkNode(params2);
|
|
31905
32086
|
}
|
|
31906
|
-
const node = translator$
|
|
32087
|
+
const node = translator$2.encode(params2);
|
|
31907
32088
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31908
32089
|
return { nodes: [node], consumed: 1 };
|
|
31909
32090
|
};
|
|
@@ -31935,7 +32116,7 @@ const handleBookmarkEndNode = (params2) => {
|
|
|
31935
32116
|
if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
|
|
31936
32117
|
return { nodes: [], consumed: 0 };
|
|
31937
32118
|
}
|
|
31938
|
-
const node = translator.encode(params2);
|
|
32119
|
+
const node = translator$1.encode(params2);
|
|
31939
32120
|
if (!node) return { nodes: [], consumed: 0 };
|
|
31940
32121
|
return { nodes: [node], consumed: 1 };
|
|
31941
32122
|
};
|
|
@@ -31943,32 +32124,86 @@ const bookmarkEndNodeHandlerEntity = {
|
|
|
31943
32124
|
handlerName: "w:bookmarkEndTranslator",
|
|
31944
32125
|
handler: handleBookmarkEndNode
|
|
31945
32126
|
};
|
|
32127
|
+
const ALTERNATE_CONTENT_NODE = "mc:AlternateContent";
|
|
32128
|
+
const SUPPORTED_REQUIRES = /* @__PURE__ */ new Set([
|
|
32129
|
+
"wps",
|
|
32130
|
+
"wp14",
|
|
32131
|
+
"w14",
|
|
32132
|
+
"w15",
|
|
32133
|
+
"w16",
|
|
32134
|
+
"w16cex",
|
|
32135
|
+
"w16cid",
|
|
32136
|
+
"w16du",
|
|
32137
|
+
"w16sdtdh",
|
|
32138
|
+
"w16sdtfl",
|
|
32139
|
+
"w16se"
|
|
32140
|
+
]);
|
|
32141
|
+
const skipHandlerResponse = { nodes: [], consumed: 0 };
|
|
32142
|
+
const isAlternateContentNode = (node) => node?.name === ALTERNATE_CONTENT_NODE;
|
|
32143
|
+
const isSupportedChoice = (choice) => {
|
|
32144
|
+
if (!choice?.attributes) return false;
|
|
32145
|
+
const requires = choice.attributes.Requires || choice.attributes.requires;
|
|
32146
|
+
if (!requires) return false;
|
|
32147
|
+
return requires.split(/\s+/).filter(Boolean).some((namespace2) => SUPPORTED_REQUIRES.has(namespace2));
|
|
32148
|
+
};
|
|
32149
|
+
const resolveAlternateContentElements = (alternateContent) => {
|
|
32150
|
+
if (!alternateContent?.elements?.length) return null;
|
|
32151
|
+
const choices = alternateContent.elements.filter((el) => el.name === "mc:Choice");
|
|
32152
|
+
const fallback = alternateContent.elements.find((el) => el.name === "mc:Fallback");
|
|
32153
|
+
const supportedChoice = choices.find(isSupportedChoice);
|
|
32154
|
+
const selectedElements = supportedChoice?.elements || fallback?.elements || choices[0]?.elements;
|
|
32155
|
+
if (!selectedElements) return null;
|
|
32156
|
+
return carbonCopy(selectedElements);
|
|
32157
|
+
};
|
|
32158
|
+
const buildNodeWithoutAlternateContent = (node) => {
|
|
32159
|
+
const { elements } = node || {};
|
|
32160
|
+
if (!elements?.length) return null;
|
|
32161
|
+
let replaced = false;
|
|
32162
|
+
const updatedElements = [];
|
|
32163
|
+
elements.forEach((element) => {
|
|
32164
|
+
if (isAlternateContentNode(element)) {
|
|
32165
|
+
const resolved = resolveAlternateContentElements(element);
|
|
32166
|
+
if (resolved) {
|
|
32167
|
+
updatedElements.push(...resolved);
|
|
32168
|
+
replaced = true;
|
|
32169
|
+
return;
|
|
32170
|
+
}
|
|
32171
|
+
updatedElements.push(carbonCopy(element));
|
|
32172
|
+
return;
|
|
32173
|
+
}
|
|
32174
|
+
updatedElements.push(carbonCopy(element));
|
|
32175
|
+
});
|
|
32176
|
+
if (!replaced) return null;
|
|
32177
|
+
const clone = carbonCopy(node);
|
|
32178
|
+
clone.elements = updatedElements;
|
|
32179
|
+
return clone;
|
|
32180
|
+
};
|
|
31946
32181
|
const handleAlternateChoice = (params2) => {
|
|
31947
|
-
const skipHandlerResponse = { nodes: [], consumed: 0 };
|
|
31948
32182
|
const { nodes, nodeListHandler } = params2;
|
|
31949
|
-
if (nodes
|
|
32183
|
+
if (!nodes?.length) {
|
|
31950
32184
|
return skipHandlerResponse;
|
|
31951
32185
|
}
|
|
31952
|
-
const
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
32186
|
+
const [currentNode] = nodes;
|
|
32187
|
+
if (isAlternateContentNode(currentNode)) {
|
|
32188
|
+
const resolvedElements = resolveAlternateContentElements(currentNode);
|
|
32189
|
+
if (!resolvedElements) {
|
|
32190
|
+
return skipHandlerResponse;
|
|
32191
|
+
}
|
|
32192
|
+
const result2 = nodeListHandler.handler({
|
|
32193
|
+
...params2,
|
|
32194
|
+
nodes: resolvedElements,
|
|
32195
|
+
path: [...params2.path || [], currentNode]
|
|
32196
|
+
});
|
|
32197
|
+
return { nodes: result2, consumed: 1 };
|
|
31957
32198
|
}
|
|
31958
|
-
const
|
|
31959
|
-
|
|
31960
|
-
const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
|
|
31961
|
-
const wpsNode = altChoiceNode.elements.find(
|
|
31962
|
-
(el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
|
|
31963
|
-
);
|
|
31964
|
-
if (!wpsNode) {
|
|
32199
|
+
const sanitizedNode = buildNodeWithoutAlternateContent(currentNode);
|
|
32200
|
+
if (!sanitizedNode) {
|
|
31965
32201
|
return skipHandlerResponse;
|
|
31966
32202
|
}
|
|
31967
|
-
const contents = wpsNode.elements;
|
|
31968
32203
|
const result = nodeListHandler.handler({
|
|
31969
32204
|
...params2,
|
|
31970
|
-
nodes:
|
|
31971
|
-
path: [...params2.path || [],
|
|
32205
|
+
nodes: [sanitizedNode],
|
|
32206
|
+
path: [...params2.path || [], sanitizedNode]
|
|
31972
32207
|
});
|
|
31973
32208
|
return { nodes: result, consumed: 1 };
|
|
31974
32209
|
};
|
|
@@ -32574,7 +32809,7 @@ const handleTabNode = (params2) => {
|
|
|
32574
32809
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
32575
32810
|
return { nodes: [], consumed: 0 };
|
|
32576
32811
|
}
|
|
32577
|
-
const node = translator$
|
|
32812
|
+
const node = translator$14.encode(params2);
|
|
32578
32813
|
return { nodes: [node], consumed: 1 };
|
|
32579
32814
|
};
|
|
32580
32815
|
const tabNodeEntityHandler = {
|
|
@@ -32608,6 +32843,7 @@ const createDocumentJson = (docx, converter, editor) => {
|
|
|
32608
32843
|
const nodeListHandler = defaultNodeListHandler();
|
|
32609
32844
|
const bodyNode = json.elements[0].elements.find((el) => el.name === "w:body");
|
|
32610
32845
|
if (bodyNode) {
|
|
32846
|
+
ensureSectionProperties(bodyNode);
|
|
32611
32847
|
const node = bodyNode;
|
|
32612
32848
|
const contentElements = node.elements?.filter((n) => n.name !== "w:sectPr") ?? [];
|
|
32613
32849
|
const content = pruneIgnoredNodes(contentElements);
|
|
@@ -32841,6 +33077,59 @@ function getDocumentStyles(node, docx, converter, editor) {
|
|
|
32841
33077
|
styles.alternateHeaders = isAlternatingHeadersOddEven(docx);
|
|
32842
33078
|
return styles;
|
|
32843
33079
|
}
|
|
33080
|
+
const DEFAULT_SECTION_PROPS = Object.freeze({
|
|
33081
|
+
pageSize: Object.freeze({ width: "12240", height: "15840" }),
|
|
33082
|
+
pageMargins: Object.freeze({
|
|
33083
|
+
top: "1440",
|
|
33084
|
+
right: "1440",
|
|
33085
|
+
bottom: "1440",
|
|
33086
|
+
left: "1440",
|
|
33087
|
+
header: "720",
|
|
33088
|
+
footer: "720",
|
|
33089
|
+
gutter: "0"
|
|
33090
|
+
})
|
|
33091
|
+
});
|
|
33092
|
+
function ensureSectionProperties(bodyNode, converter) {
|
|
33093
|
+
if (!bodyNode.elements) bodyNode.elements = [];
|
|
33094
|
+
let sectPr = bodyNode.elements.find((el) => el.name === "w:sectPr");
|
|
33095
|
+
if (!sectPr) {
|
|
33096
|
+
sectPr = {
|
|
33097
|
+
type: "element",
|
|
33098
|
+
name: "w:sectPr",
|
|
33099
|
+
elements: []
|
|
33100
|
+
};
|
|
33101
|
+
bodyNode.elements.push(sectPr);
|
|
33102
|
+
} else if (!sectPr.elements) {
|
|
33103
|
+
sectPr.elements = [];
|
|
33104
|
+
}
|
|
33105
|
+
const ensureChild = (name, factory) => {
|
|
33106
|
+
let child = sectPr.elements.find((el) => el.name === name);
|
|
33107
|
+
if (!child) {
|
|
33108
|
+
child = factory();
|
|
33109
|
+
sectPr.elements.push(child);
|
|
33110
|
+
} else if (!child.attributes) {
|
|
33111
|
+
child.attributes = {};
|
|
33112
|
+
}
|
|
33113
|
+
return child;
|
|
33114
|
+
};
|
|
33115
|
+
const pgSz = ensureChild("w:pgSz", () => ({
|
|
33116
|
+
type: "element",
|
|
33117
|
+
name: "w:pgSz",
|
|
33118
|
+
attributes: {}
|
|
33119
|
+
}));
|
|
33120
|
+
pgSz.attributes["w:w"] = pgSz.attributes["w:w"] ?? DEFAULT_SECTION_PROPS.pageSize.width;
|
|
33121
|
+
pgSz.attributes["w:h"] = pgSz.attributes["w:h"] ?? DEFAULT_SECTION_PROPS.pageSize.height;
|
|
33122
|
+
const pgMar = ensureChild("w:pgMar", () => ({
|
|
33123
|
+
type: "element",
|
|
33124
|
+
name: "w:pgMar",
|
|
33125
|
+
attributes: {}
|
|
33126
|
+
}));
|
|
33127
|
+
Object.entries(DEFAULT_SECTION_PROPS.pageMargins).forEach(([key2, value]) => {
|
|
33128
|
+
const attrKey = `w:${key2}`;
|
|
33129
|
+
if (pgMar.attributes[attrKey] == null) pgMar.attributes[attrKey] = value;
|
|
33130
|
+
});
|
|
33131
|
+
return sectPr;
|
|
33132
|
+
}
|
|
32844
33133
|
function getStyleDefinitions(docx) {
|
|
32845
33134
|
const styles = docx["word/styles.xml"];
|
|
32846
33135
|
if (!styles) return [];
|
|
@@ -33033,6 +33322,36 @@ const FONT_FAMILY_FALLBACKS = Object.freeze({
|
|
|
33033
33322
|
auto: "sans-serif"
|
|
33034
33323
|
});
|
|
33035
33324
|
const DEFAULT_GENERIC_FALLBACK = "sans-serif";
|
|
33325
|
+
const DEFAULT_FONT_SIZE_PT = 10;
|
|
33326
|
+
const collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state: state2 }) => {
|
|
33327
|
+
if (!runProps?.elements?.length || !state2) return;
|
|
33328
|
+
const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
|
|
33329
|
+
if (fontsNode?.attributes) {
|
|
33330
|
+
const themeName = fontsNode.attributes["w:asciiTheme"];
|
|
33331
|
+
if (themeName) {
|
|
33332
|
+
const themeInfo = themeResolver?.(themeName) || {};
|
|
33333
|
+
if ((allowOverrideTypeface || !state2.typeface) && themeInfo.typeface) state2.typeface = themeInfo.typeface;
|
|
33334
|
+
if ((allowOverrideTypeface || !state2.panose) && themeInfo.panose) state2.panose = themeInfo.panose;
|
|
33335
|
+
}
|
|
33336
|
+
const ascii = fontsNode.attributes["w:ascii"];
|
|
33337
|
+
if ((allowOverrideTypeface || !state2.typeface) && ascii) {
|
|
33338
|
+
state2.typeface = ascii;
|
|
33339
|
+
}
|
|
33340
|
+
}
|
|
33341
|
+
const sizeNode = runProps.elements.find((el) => el.name === "w:sz");
|
|
33342
|
+
if (sizeNode?.attributes?.["w:val"]) {
|
|
33343
|
+
const sizeTwips = Number(sizeNode.attributes["w:val"]);
|
|
33344
|
+
if (Number.isFinite(sizeTwips)) {
|
|
33345
|
+
if (state2.fallbackSzTwips === void 0) state2.fallbackSzTwips = sizeTwips;
|
|
33346
|
+
const sizePt = sizeTwips / 2;
|
|
33347
|
+
if (allowOverrideSize || state2.fontSizePt === void 0) state2.fontSizePt = sizePt;
|
|
33348
|
+
}
|
|
33349
|
+
}
|
|
33350
|
+
const kernNode = runProps.elements.find((el) => el.name === "w:kern");
|
|
33351
|
+
if (kernNode?.attributes?.["w:val"]) {
|
|
33352
|
+
if (allowOverrideSize || state2.kern === void 0) state2.kern = kernNode.attributes["w:val"];
|
|
33353
|
+
}
|
|
33354
|
+
};
|
|
33036
33355
|
const _SuperConverter = class _SuperConverter2 {
|
|
33037
33356
|
constructor(params2 = null) {
|
|
33038
33357
|
__privateAdd$2(this, _SuperConverter_instances);
|
|
@@ -33138,7 +33457,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
33138
33457
|
return;
|
|
33139
33458
|
}
|
|
33140
33459
|
}
|
|
33141
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.
|
|
33460
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.21.2") {
|
|
33142
33461
|
const customLocation = "docProps/custom.xml";
|
|
33143
33462
|
if (!docx[customLocation]) {
|
|
33144
33463
|
docx[customLocation] = generateCustomXml();
|
|
@@ -33160,49 +33479,45 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
33160
33479
|
}
|
|
33161
33480
|
getDocumentDefaultStyles() {
|
|
33162
33481
|
const styles = this.convertedXml["word/styles.xml"];
|
|
33163
|
-
|
|
33164
|
-
const
|
|
33165
|
-
|
|
33166
|
-
|
|
33167
|
-
const
|
|
33168
|
-
const
|
|
33169
|
-
|
|
33170
|
-
|
|
33171
|
-
|
|
33172
|
-
|
|
33173
|
-
|
|
33174
|
-
|
|
33175
|
-
|
|
33176
|
-
|
|
33177
|
-
|
|
33178
|
-
|
|
33179
|
-
|
|
33180
|
-
|
|
33181
|
-
|
|
33182
|
-
|
|
33183
|
-
|
|
33184
|
-
|
|
33185
|
-
|
|
33186
|
-
|
|
33187
|
-
|
|
33188
|
-
|
|
33189
|
-
|
|
33190
|
-
|
|
33191
|
-
|
|
33192
|
-
|
|
33193
|
-
|
|
33194
|
-
|
|
33195
|
-
|
|
33196
|
-
|
|
33197
|
-
|
|
33198
|
-
|
|
33199
|
-
|
|
33200
|
-
|
|
33201
|
-
|
|
33202
|
-
const kern = rElements.find((el) => el.name === "w:kern")?.attributes["w:val"];
|
|
33203
|
-
const fontFamilyCss = _SuperConverter2.toCssFontFamily(typeface, this.convertedXml);
|
|
33204
|
-
return { fontSizePt, kern, typeface, panose, fontFamilyCss };
|
|
33205
|
-
}
|
|
33482
|
+
const styleRoot = styles?.elements?.[0];
|
|
33483
|
+
const styleElements = styleRoot?.elements || [];
|
|
33484
|
+
if (!styleElements.length) return {};
|
|
33485
|
+
const defaults = styleElements.find((el) => el.name === "w:docDefaults");
|
|
33486
|
+
const normalStyle = styleElements.find((el) => el.name === "w:style" && el.attributes?.["w:styleId"] === "Normal");
|
|
33487
|
+
const defaultsState = {
|
|
33488
|
+
typeface: void 0,
|
|
33489
|
+
panose: void 0,
|
|
33490
|
+
fontSizePt: void 0,
|
|
33491
|
+
kern: void 0,
|
|
33492
|
+
fallbackSzTwips: void 0
|
|
33493
|
+
};
|
|
33494
|
+
const docDefaultRun = defaults?.elements?.find((el) => el.name === "w:rPrDefault");
|
|
33495
|
+
const docDefaultProps = docDefaultRun?.elements?.find((el) => el.name === "w:rPr") ?? docDefaultRun;
|
|
33496
|
+
collectRunDefaultProperties(docDefaultProps, {
|
|
33497
|
+
allowOverrideTypeface: true,
|
|
33498
|
+
allowOverrideSize: true,
|
|
33499
|
+
themeResolver: (theme) => this.getThemeInfo(theme),
|
|
33500
|
+
state: defaultsState
|
|
33501
|
+
});
|
|
33502
|
+
const normalRunProps = normalStyle?.elements?.find((el) => el.name === "w:rPr") ?? null;
|
|
33503
|
+
collectRunDefaultProperties(normalRunProps, {
|
|
33504
|
+
allowOverrideTypeface: true,
|
|
33505
|
+
allowOverrideSize: true,
|
|
33506
|
+
themeResolver: (theme) => this.getThemeInfo(theme),
|
|
33507
|
+
state: defaultsState
|
|
33508
|
+
});
|
|
33509
|
+
if (defaultsState.fontSizePt === void 0) {
|
|
33510
|
+
if (Number.isFinite(defaultsState.fallbackSzTwips)) defaultsState.fontSizePt = defaultsState.fallbackSzTwips / 2;
|
|
33511
|
+
else defaultsState.fontSizePt = DEFAULT_FONT_SIZE_PT;
|
|
33512
|
+
}
|
|
33513
|
+
const fontFamilyCss = defaultsState.typeface ? _SuperConverter2.toCssFontFamily(defaultsState.typeface, this.convertedXml) : void 0;
|
|
33514
|
+
const result = {};
|
|
33515
|
+
if (defaultsState.fontSizePt !== void 0) result.fontSizePt = defaultsState.fontSizePt;
|
|
33516
|
+
if (defaultsState.kern !== void 0) result.kern = defaultsState.kern;
|
|
33517
|
+
if (defaultsState.typeface) result.typeface = defaultsState.typeface;
|
|
33518
|
+
if (defaultsState.panose) result.panose = defaultsState.panose;
|
|
33519
|
+
if (fontFamilyCss) result.fontFamilyCss = fontFamilyCss;
|
|
33520
|
+
return result;
|
|
33206
33521
|
}
|
|
33207
33522
|
getDocumentFonts() {
|
|
33208
33523
|
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
@@ -33631,7 +33946,7 @@ function storeSuperdocVersion(docx) {
|
|
|
33631
33946
|
function generateCustomXml() {
|
|
33632
33947
|
return DEFAULT_CUSTOM_XML;
|
|
33633
33948
|
}
|
|
33634
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.
|
|
33949
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.21.2") {
|
|
33635
33950
|
return {
|
|
33636
33951
|
type: "element",
|
|
33637
33952
|
name: "property",
|
|
@@ -36069,14 +36384,19 @@ class DocxZipper {
|
|
|
36069
36384
|
/**
|
|
36070
36385
|
* Update [Content_Types].xml with extensions of new Image annotations
|
|
36071
36386
|
*/
|
|
36072
|
-
async updateContentTypes(docx, media, fromJson) {
|
|
36387
|
+
async updateContentTypes(docx, media, fromJson, updatedDocs = {}) {
|
|
36388
|
+
const additionalPartNames = Object.keys(updatedDocs || {});
|
|
36073
36389
|
const newMediaTypes = Object.keys(media).map((name) => {
|
|
36074
36390
|
return this.getFileExtension(name);
|
|
36075
36391
|
}).filter(Boolean);
|
|
36076
36392
|
const contentTypesPath = "[Content_Types].xml";
|
|
36077
36393
|
let contentTypesXml;
|
|
36078
36394
|
if (fromJson) {
|
|
36079
|
-
|
|
36395
|
+
if (Array.isArray(docx.files)) {
|
|
36396
|
+
contentTypesXml = docx.files.find((file) => file.name === contentTypesPath)?.content || "";
|
|
36397
|
+
} else {
|
|
36398
|
+
contentTypesXml = docx.files?.[contentTypesPath] || "";
|
|
36399
|
+
}
|
|
36080
36400
|
} else contentTypesXml = await docx.file(contentTypesPath).async("string");
|
|
36081
36401
|
let typesString = "";
|
|
36082
36402
|
const defaultMediaTypes = getContentTypesFromXml(contentTypesXml);
|
|
@@ -36102,24 +36422,39 @@ class DocxZipper {
|
|
|
36102
36422
|
const hasCommentsExtensible = types2.elements?.some(
|
|
36103
36423
|
(el) => el.name === "Override" && el.attributes.PartName === "/word/commentsExtensible.xml"
|
|
36104
36424
|
);
|
|
36105
|
-
|
|
36425
|
+
const hasFile = (filename) => {
|
|
36426
|
+
if (!docx?.files) return false;
|
|
36427
|
+
if (!fromJson) return Boolean(docx.files[filename]);
|
|
36428
|
+
if (Array.isArray(docx.files)) return docx.files.some((file) => file.name === filename);
|
|
36429
|
+
return Boolean(docx.files[filename]);
|
|
36430
|
+
};
|
|
36431
|
+
if (hasFile("word/comments.xml")) {
|
|
36106
36432
|
const commentsDef = `<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />`;
|
|
36107
36433
|
if (!hasComments) typesString += commentsDef;
|
|
36108
36434
|
}
|
|
36109
|
-
if (
|
|
36435
|
+
if (hasFile("word/commentsExtended.xml")) {
|
|
36110
36436
|
const commentsExtendedDef = `<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />`;
|
|
36111
36437
|
if (!hasCommentsExtended) typesString += commentsExtendedDef;
|
|
36112
36438
|
}
|
|
36113
|
-
if (
|
|
36439
|
+
if (hasFile("word/commentsIds.xml")) {
|
|
36114
36440
|
const commentsIdsDef = `<Override PartName="/word/commentsIds.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml" />`;
|
|
36115
36441
|
if (!hasCommentsIds) typesString += commentsIdsDef;
|
|
36116
36442
|
}
|
|
36117
|
-
if (
|
|
36443
|
+
if (hasFile("word/commentsExtensible.xml")) {
|
|
36118
36444
|
const commentsExtendedDef = `<Override PartName="/word/commentsExtensible.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml" />`;
|
|
36119
36445
|
if (!hasCommentsExtensible) typesString += commentsExtendedDef;
|
|
36120
36446
|
}
|
|
36121
|
-
|
|
36122
|
-
|
|
36447
|
+
const partNames = new Set(additionalPartNames);
|
|
36448
|
+
if (docx?.files) {
|
|
36449
|
+
if (fromJson && Array.isArray(docx.files)) {
|
|
36450
|
+
docx.files.forEach((file) => partNames.add(file.name));
|
|
36451
|
+
} else {
|
|
36452
|
+
Object.keys(docx.files).forEach((key2) => partNames.add(key2));
|
|
36453
|
+
}
|
|
36454
|
+
}
|
|
36455
|
+
partNames.forEach((name) => {
|
|
36456
|
+
if (name.includes(".rels")) return;
|
|
36457
|
+
if (!name.includes("header") && !name.includes("footer")) return;
|
|
36123
36458
|
const hasExtensible = types2.elements?.some(
|
|
36124
36459
|
(el) => el.name === "Override" && el.attributes.PartName === `/${name}`
|
|
36125
36460
|
);
|
|
@@ -36130,7 +36465,48 @@ class DocxZipper {
|
|
|
36130
36465
|
}
|
|
36131
36466
|
});
|
|
36132
36467
|
const beginningString = '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
|
|
36133
|
-
|
|
36468
|
+
let updatedContentTypesXml = contentTypesXml.replace(beginningString, `${beginningString}${typesString}`);
|
|
36469
|
+
let relationshipsXml = updatedDocs["word/_rels/document.xml.rels"];
|
|
36470
|
+
if (!relationshipsXml) {
|
|
36471
|
+
if (fromJson) {
|
|
36472
|
+
if (Array.isArray(docx.files)) {
|
|
36473
|
+
relationshipsXml = docx.files.find((file) => file.name === "word/_rels/document.xml.rels")?.content;
|
|
36474
|
+
} else {
|
|
36475
|
+
relationshipsXml = docx.files?.["word/_rels/document.xml.rels"];
|
|
36476
|
+
}
|
|
36477
|
+
} else {
|
|
36478
|
+
relationshipsXml = await docx.file("word/_rels/document.xml.rels")?.async("string");
|
|
36479
|
+
}
|
|
36480
|
+
}
|
|
36481
|
+
if (relationshipsXml) {
|
|
36482
|
+
try {
|
|
36483
|
+
const relJson = xmljs.xml2js(relationshipsXml, { compact: false });
|
|
36484
|
+
const relationships = relJson.elements?.find((el) => el.name === "Relationships");
|
|
36485
|
+
relationships?.elements?.forEach((rel) => {
|
|
36486
|
+
const type2 = rel.attributes?.Type;
|
|
36487
|
+
const target = rel.attributes?.Target;
|
|
36488
|
+
if (!type2 || !target) return;
|
|
36489
|
+
const isHeader = type2.includes("/header");
|
|
36490
|
+
const isFooter = type2.includes("/footer");
|
|
36491
|
+
if (!isHeader && !isFooter) return;
|
|
36492
|
+
let sanitizedTarget = target.replace(/^\.\//, "");
|
|
36493
|
+
if (sanitizedTarget.startsWith("../")) sanitizedTarget = sanitizedTarget.slice(3);
|
|
36494
|
+
if (sanitizedTarget.startsWith("/")) sanitizedTarget = sanitizedTarget.slice(1);
|
|
36495
|
+
const partName = sanitizedTarget.startsWith("word/") ? sanitizedTarget : `word/${sanitizedTarget}`;
|
|
36496
|
+
partNames.add(partName);
|
|
36497
|
+
});
|
|
36498
|
+
} catch (error) {
|
|
36499
|
+
console.warn("Failed to parse document relationships while updating content types", error);
|
|
36500
|
+
}
|
|
36501
|
+
}
|
|
36502
|
+
partNames.forEach((name) => {
|
|
36503
|
+
if (name.includes(".rels")) return;
|
|
36504
|
+
if (!name.includes("header") && !name.includes("footer")) return;
|
|
36505
|
+
if (updatedContentTypesXml.includes(`PartName="/${name}"`)) return;
|
|
36506
|
+
const type2 = name.includes("header") ? "header" : "footer";
|
|
36507
|
+
const extendedDef = `<Override PartName="/${name}" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.${type2}+xml"/>`;
|
|
36508
|
+
updatedContentTypesXml = updatedContentTypesXml.replace("</Types>", `${extendedDef}</Types>`);
|
|
36509
|
+
});
|
|
36134
36510
|
if (fromJson) return updatedContentTypesXml;
|
|
36135
36511
|
docx.file(contentTypesPath, updatedContentTypesXml);
|
|
36136
36512
|
}
|
|
@@ -36171,7 +36547,7 @@ class DocxZipper {
|
|
|
36171
36547
|
for (const [fontName, fontUintArray] of Object.entries(fonts)) {
|
|
36172
36548
|
zip.file(fontName, fontUintArray);
|
|
36173
36549
|
}
|
|
36174
|
-
await this.updateContentTypes(zip, media);
|
|
36550
|
+
await this.updateContentTypes(zip, media, false, updatedDocs);
|
|
36175
36551
|
return zip;
|
|
36176
36552
|
}
|
|
36177
36553
|
/**
|
|
@@ -36197,7 +36573,7 @@ class DocxZipper {
|
|
|
36197
36573
|
Object.keys(media).forEach((path) => {
|
|
36198
36574
|
unzippedOriginalDocx.file(path, media[path]);
|
|
36199
36575
|
});
|
|
36200
|
-
await this.updateContentTypes(unzippedOriginalDocx, media);
|
|
36576
|
+
await this.updateContentTypes(unzippedOriginalDocx, media, false, updatedDocs);
|
|
36201
36577
|
return unzippedOriginalDocx;
|
|
36202
36578
|
}
|
|
36203
36579
|
}
|
|
@@ -47855,9 +48231,11 @@ const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode,
|
|
|
47855
48231
|
item.editor.view.dom.setAttribute("documentmode", documentMode);
|
|
47856
48232
|
});
|
|
47857
48233
|
if (isEditMode) {
|
|
47858
|
-
const pm =
|
|
47859
|
-
pm
|
|
47860
|
-
|
|
48234
|
+
const pm = editor.view?.dom || editor.options.element?.querySelector?.(".ProseMirror");
|
|
48235
|
+
if (pm) {
|
|
48236
|
+
pm.classList.add("header-footer-edit");
|
|
48237
|
+
pm.setAttribute("aria-readonly", true);
|
|
48238
|
+
}
|
|
47861
48239
|
}
|
|
47862
48240
|
if (focusedSectionEditor) {
|
|
47863
48241
|
focusedSectionEditor.view.focus();
|
|
@@ -48887,6 +49265,7 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state: stat
|
|
|
48887
49265
|
const mappedRowStart = tr.mapping.map(absoluteRowStart);
|
|
48888
49266
|
const rowEnd = mappedRowStart + rowNode.nodeSize;
|
|
48889
49267
|
tr.replaceWith(mappedRowStart, rowEnd, Fragment.from(newRows));
|
|
49268
|
+
tr.setMeta("tableGeneration", true);
|
|
48890
49269
|
} catch (error) {
|
|
48891
49270
|
console.error("Error during row generation:", error);
|
|
48892
49271
|
throw error;
|
|
@@ -49291,7 +49670,7 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
|
|
|
49291
49670
|
}
|
|
49292
49671
|
function findRemovedFieldAnnotations(tr) {
|
|
49293
49672
|
let removedNodes = [];
|
|
49294
|
-
if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true) {
|
|
49673
|
+
if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true || tr.getMeta("tableGeneration") === true) {
|
|
49295
49674
|
return removedNodes;
|
|
49296
49675
|
}
|
|
49297
49676
|
const hasDeletion = transactionDeletedAnything(tr);
|
|
@@ -50469,7 +50848,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
50469
50848
|
setDocumentMode(documentMode) {
|
|
50470
50849
|
let cleanedMode = documentMode?.toLowerCase() || "editing";
|
|
50471
50850
|
if (!this.extensionService || !this.state) return;
|
|
50472
|
-
const pm =
|
|
50851
|
+
const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
|
|
50473
50852
|
if (this.options.role === "viewer") cleanedMode = "viewing";
|
|
50474
50853
|
if (this.options.role === "suggester" && cleanedMode === "editing") cleanedMode = "suggesting";
|
|
50475
50854
|
if (cleanedMode === "viewing") {
|
|
@@ -50699,6 +51078,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
50699
51078
|
element.style.isolation = "isolate";
|
|
50700
51079
|
proseMirror.style.outline = "none";
|
|
50701
51080
|
proseMirror.style.border = "none";
|
|
51081
|
+
element.style.backgroundColor = "#fff";
|
|
51082
|
+
proseMirror.style.backgroundColor = "#fff";
|
|
50702
51083
|
const { typeface, fontSizePt, fontFamilyCss } = this.converter.getDocumentDefaultStyles() ?? {};
|
|
50703
51084
|
const resolvedFontFamily = fontFamilyCss || typeface;
|
|
50704
51085
|
if (resolvedFontFamily) {
|
|
@@ -50955,7 +51336,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
50955
51336
|
files: this.options.content
|
|
50956
51337
|
},
|
|
50957
51338
|
media,
|
|
50958
|
-
true
|
|
51339
|
+
true,
|
|
51340
|
+
updatedDocs
|
|
50959
51341
|
);
|
|
50960
51342
|
return updatedDocs;
|
|
50961
51343
|
}
|
|
@@ -51021,7 +51403,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51021
51403
|
* @returns {Object | void} Migration results
|
|
51022
51404
|
*/
|
|
51023
51405
|
processCollaborationMigrations() {
|
|
51024
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
51406
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.21.2");
|
|
51025
51407
|
if (!this.options.ydoc) return;
|
|
51026
51408
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
51027
51409
|
let docVersion = metaMap.get("version");
|
|
@@ -51441,9 +51823,11 @@ createView_fn = function(element) {
|
|
|
51441
51823
|
isEditMode: false,
|
|
51442
51824
|
documentMode: this.options.documentMode
|
|
51443
51825
|
});
|
|
51444
|
-
const pm =
|
|
51445
|
-
pm
|
|
51446
|
-
|
|
51826
|
+
const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
|
|
51827
|
+
if (pm) {
|
|
51828
|
+
pm.classList.remove("header-footer-edit");
|
|
51829
|
+
pm.setAttribute("aria-readonly", false);
|
|
51830
|
+
}
|
|
51447
51831
|
}
|
|
51448
51832
|
setWordSelection(view, pos);
|
|
51449
51833
|
}
|
|
@@ -53498,6 +53882,30 @@ const intToJapaneseCounting = (num) => {
|
|
|
53498
53882
|
}
|
|
53499
53883
|
return result;
|
|
53500
53884
|
};
|
|
53885
|
+
const isKeyboardInvocation = (event) => {
|
|
53886
|
+
return event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === void 0) && event.clientX === 0 && event.clientY === 0;
|
|
53887
|
+
};
|
|
53888
|
+
const prefersNativeMenu = (event) => {
|
|
53889
|
+
if (!event) return false;
|
|
53890
|
+
if (event.ctrlKey || event.metaKey) {
|
|
53891
|
+
return true;
|
|
53892
|
+
}
|
|
53893
|
+
return isKeyboardInvocation(event);
|
|
53894
|
+
};
|
|
53895
|
+
const shouldAllowNativeContextMenu = (event) => {
|
|
53896
|
+
return prefersNativeMenu(event);
|
|
53897
|
+
};
|
|
53898
|
+
const shouldBypassContextMenu = shouldAllowNativeContextMenu;
|
|
53899
|
+
const DEFAULT_SELECTION_STATE = Object.freeze({
|
|
53900
|
+
focused: false,
|
|
53901
|
+
preservedSelection: null,
|
|
53902
|
+
showVisualSelection: false,
|
|
53903
|
+
skipFocusReset: false
|
|
53904
|
+
});
|
|
53905
|
+
const normalizeSelectionState = (state2 = {}) => ({
|
|
53906
|
+
...DEFAULT_SELECTION_STATE,
|
|
53907
|
+
...state2
|
|
53908
|
+
});
|
|
53501
53909
|
const CustomSelectionPluginKey = new PluginKey("CustomSelection");
|
|
53502
53910
|
const handleClickOutside = (event, editor) => {
|
|
53503
53911
|
const editorElem = editor?.options?.element;
|
|
@@ -53535,11 +53943,7 @@ const CustomSelection = Extension.create({
|
|
|
53535
53943
|
const customSelectionPlugin = new Plugin({
|
|
53536
53944
|
key: CustomSelectionPluginKey,
|
|
53537
53945
|
state: {
|
|
53538
|
-
init: () => ({
|
|
53539
|
-
focused: false,
|
|
53540
|
-
preservedSelection: null,
|
|
53541
|
-
showVisualSelection: false
|
|
53542
|
-
}),
|
|
53946
|
+
init: () => ({ ...DEFAULT_SELECTION_STATE }),
|
|
53543
53947
|
apply: (tr, value) => {
|
|
53544
53948
|
const meta = getFocusMeta(tr);
|
|
53545
53949
|
if (meta !== void 0) {
|
|
@@ -53560,6 +53964,9 @@ const CustomSelection = Extension.create({
|
|
|
53560
53964
|
props: {
|
|
53561
53965
|
handleDOMEvents: {
|
|
53562
53966
|
contextmenu: (view, event) => {
|
|
53967
|
+
if (shouldAllowNativeContextMenu(event)) {
|
|
53968
|
+
return false;
|
|
53969
|
+
}
|
|
53563
53970
|
event.preventDefault();
|
|
53564
53971
|
const { selection } = view.state;
|
|
53565
53972
|
if (!selection.empty) {
|
|
@@ -53567,7 +53974,8 @@ const CustomSelection = Extension.create({
|
|
|
53567
53974
|
setFocusMeta(view.state.tr, {
|
|
53568
53975
|
focused: true,
|
|
53569
53976
|
preservedSelection: selection,
|
|
53570
|
-
showVisualSelection: true
|
|
53977
|
+
showVisualSelection: true,
|
|
53978
|
+
skipFocusReset: true
|
|
53571
53979
|
})
|
|
53572
53980
|
);
|
|
53573
53981
|
}
|
|
@@ -53578,6 +53986,9 @@ const CustomSelection = Extension.create({
|
|
|
53578
53986
|
},
|
|
53579
53987
|
mousedown: (view, event) => {
|
|
53580
53988
|
if (event.button === 2) {
|
|
53989
|
+
if (shouldAllowNativeContextMenu(event)) {
|
|
53990
|
+
return false;
|
|
53991
|
+
}
|
|
53581
53992
|
event.preventDefault();
|
|
53582
53993
|
const { selection: selection2 } = view.state;
|
|
53583
53994
|
if (!selection2.empty) {
|
|
@@ -53585,7 +53996,8 @@ const CustomSelection = Extension.create({
|
|
|
53585
53996
|
setFocusMeta(view.state.tr, {
|
|
53586
53997
|
focused: true,
|
|
53587
53998
|
preservedSelection: selection2,
|
|
53588
|
-
showVisualSelection: true
|
|
53999
|
+
showVisualSelection: true,
|
|
54000
|
+
skipFocusReset: true
|
|
53589
54001
|
})
|
|
53590
54002
|
);
|
|
53591
54003
|
this.editor.setOptions({
|
|
@@ -53608,7 +54020,8 @@ const CustomSelection = Extension.create({
|
|
|
53608
54020
|
setFocusMeta(view.state.tr, {
|
|
53609
54021
|
focused: true,
|
|
53610
54022
|
preservedSelection: selection,
|
|
53611
|
-
showVisualSelection: true
|
|
54023
|
+
showVisualSelection: true,
|
|
54024
|
+
skipFocusReset: false
|
|
53612
54025
|
})
|
|
53613
54026
|
);
|
|
53614
54027
|
this.editor.setOptions({
|
|
@@ -53626,7 +54039,8 @@ const CustomSelection = Extension.create({
|
|
|
53626
54039
|
setFocusMeta(view.state.tr, {
|
|
53627
54040
|
focused: true,
|
|
53628
54041
|
preservedSelection: selection,
|
|
53629
|
-
showVisualSelection: true
|
|
54042
|
+
showVisualSelection: true,
|
|
54043
|
+
skipFocusReset: false
|
|
53630
54044
|
})
|
|
53631
54045
|
);
|
|
53632
54046
|
}
|
|
@@ -53637,7 +54051,8 @@ const CustomSelection = Extension.create({
|
|
|
53637
54051
|
setFocusMeta(view.state.tr, {
|
|
53638
54052
|
focused: false,
|
|
53639
54053
|
preservedSelection: null,
|
|
53640
|
-
showVisualSelection: false
|
|
54054
|
+
showVisualSelection: false,
|
|
54055
|
+
skipFocusReset: false
|
|
53641
54056
|
})
|
|
53642
54057
|
);
|
|
53643
54058
|
if (!selection.empty && !this.editor.options.element?.contains(target)) {
|
|
@@ -53654,12 +54069,20 @@ const CustomSelection = Extension.create({
|
|
|
53654
54069
|
const isElement2 = target instanceof Element;
|
|
53655
54070
|
const isToolbarBtn = isElement2 && isToolbarButton(target);
|
|
53656
54071
|
const isToolbarInp = isElement2 && isToolbarInput(target);
|
|
54072
|
+
const focusState = getFocusState(view.state);
|
|
54073
|
+
if (focusState?.skipFocusReset) {
|
|
54074
|
+
view.dispatch(
|
|
54075
|
+
setFocusMeta(view.state.tr, normalizeSelectionState({ ...focusState, skipFocusReset: false }))
|
|
54076
|
+
);
|
|
54077
|
+
return false;
|
|
54078
|
+
}
|
|
53657
54079
|
if (!isToolbarBtn && !isToolbarInp) {
|
|
53658
54080
|
view.dispatch(
|
|
53659
54081
|
setFocusMeta(view.state.tr, {
|
|
53660
54082
|
focused: false,
|
|
53661
54083
|
preservedSelection: null,
|
|
53662
|
-
showVisualSelection: false
|
|
54084
|
+
showVisualSelection: false,
|
|
54085
|
+
skipFocusReset: false
|
|
53663
54086
|
})
|
|
53664
54087
|
);
|
|
53665
54088
|
}
|
|
@@ -53670,12 +54093,16 @@ const CustomSelection = Extension.create({
|
|
|
53670
54093
|
const isToolbarBtn = isElement2 && isToolbarButton(target);
|
|
53671
54094
|
const isToolbarInp = isElement2 && isToolbarInput(target);
|
|
53672
54095
|
const state2 = getFocusState(view.state);
|
|
54096
|
+
if (state2?.skipFocusReset) {
|
|
54097
|
+
return false;
|
|
54098
|
+
}
|
|
53673
54099
|
if (isToolbarBtn || isToolbarInp) {
|
|
53674
54100
|
view.dispatch(
|
|
53675
54101
|
setFocusMeta(view.state.tr, {
|
|
53676
54102
|
focused: true,
|
|
53677
54103
|
preservedSelection: state2.preservedSelection || view.state.selection,
|
|
53678
|
-
showVisualSelection: true
|
|
54104
|
+
showVisualSelection: true,
|
|
54105
|
+
skipFocusReset: false
|
|
53679
54106
|
})
|
|
53680
54107
|
);
|
|
53681
54108
|
} else {
|
|
@@ -53683,7 +54110,8 @@ const CustomSelection = Extension.create({
|
|
|
53683
54110
|
setFocusMeta(view.state.tr, {
|
|
53684
54111
|
focused: false,
|
|
53685
54112
|
preservedSelection: null,
|
|
53686
|
-
showVisualSelection: false
|
|
54113
|
+
showVisualSelection: false,
|
|
54114
|
+
skipFocusReset: false
|
|
53687
54115
|
})
|
|
53688
54116
|
);
|
|
53689
54117
|
}
|
|
@@ -69458,7 +69886,8 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
|
|
|
69458
69886
|
const prevSelection = prevState.selection;
|
|
69459
69887
|
if (selection.from !== prevSelection.from || selection.to !== prevSelection.to) {
|
|
69460
69888
|
setTimeout(() => {
|
|
69461
|
-
const
|
|
69889
|
+
const searchRoot = editorView?.dom;
|
|
69890
|
+
const selectedResizableWrapper = searchRoot?.querySelector(".sd-editor-resizable-wrapper");
|
|
69462
69891
|
if (selectedResizableWrapper) {
|
|
69463
69892
|
showResizeHandles(view2, selectedResizableWrapper);
|
|
69464
69893
|
} else {
|
|
@@ -82994,7 +83423,7 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
82994
83423
|
if (!argument) return;
|
|
82995
83424
|
item.onActivate({ zoom: argument });
|
|
82996
83425
|
this.emit("superdoc-command", { item, argument });
|
|
82997
|
-
const layers =
|
|
83426
|
+
const layers = this.superdoc.element?.querySelector(".layers");
|
|
82998
83427
|
if (!layers) return;
|
|
82999
83428
|
const isMobileDevice = typeof screen.orientation !== "undefined";
|
|
83000
83429
|
const isSmallScreen = window.matchMedia("(max-width: 834px)").matches;
|
|
@@ -83569,6 +83998,115 @@ runCommandWithArgumentOnly_fn = function({ item, argument, noArgumentCallback =
|
|
|
83569
83998
|
this.updateToolbarState();
|
|
83570
83999
|
}
|
|
83571
84000
|
};
|
|
84001
|
+
const onMarginClickCursorChange = (event, editor) => {
|
|
84002
|
+
const y2 = event.clientY;
|
|
84003
|
+
const x = event.clientX;
|
|
84004
|
+
const { view } = editor;
|
|
84005
|
+
const editorRect = view.dom.getBoundingClientRect();
|
|
84006
|
+
let coords = {
|
|
84007
|
+
left: 0,
|
|
84008
|
+
top: y2
|
|
84009
|
+
};
|
|
84010
|
+
let isRightMargin = false;
|
|
84011
|
+
if (x > editorRect.right) {
|
|
84012
|
+
coords.left = editorRect.left + editorRect.width - 1;
|
|
84013
|
+
isRightMargin = true;
|
|
84014
|
+
} else if (x < editorRect.left) {
|
|
84015
|
+
coords.left = editorRect.left;
|
|
84016
|
+
}
|
|
84017
|
+
const pos = view.posAtCoords(coords)?.pos;
|
|
84018
|
+
if (pos) {
|
|
84019
|
+
let cursorPos = pos;
|
|
84020
|
+
if (isRightMargin) {
|
|
84021
|
+
const $pos = view.state.doc.resolve(pos);
|
|
84022
|
+
const charOffset = $pos.textOffset;
|
|
84023
|
+
const node = view.state.doc.nodeAt(pos);
|
|
84024
|
+
const text = node?.text;
|
|
84025
|
+
const charAtPos = text?.charAt(charOffset);
|
|
84026
|
+
cursorPos = node?.isText && charAtPos !== " " ? pos - 1 : pos;
|
|
84027
|
+
}
|
|
84028
|
+
const transaction = view.state.tr.setSelection(TextSelection$1.create(view.state.doc, cursorPos));
|
|
84029
|
+
view.dispatch(transaction);
|
|
84030
|
+
view.focus();
|
|
84031
|
+
}
|
|
84032
|
+
};
|
|
84033
|
+
const checkNodeSpecificClicks = (editor, event, popoverControls) => {
|
|
84034
|
+
if (!editor) return;
|
|
84035
|
+
if (selectionHasNodeOrMark(editor.view.state, "link", { requireEnds: true })) {
|
|
84036
|
+
popoverControls.component = LinkInput;
|
|
84037
|
+
popoverControls.position = {
|
|
84038
|
+
left: `${event.clientX - editor.element.getBoundingClientRect().left}px`,
|
|
84039
|
+
top: `${event.clientY - editor.element.getBoundingClientRect().top + 15}px`
|
|
84040
|
+
};
|
|
84041
|
+
popoverControls.props = {
|
|
84042
|
+
showInput: true
|
|
84043
|
+
};
|
|
84044
|
+
popoverControls.visible = true;
|
|
84045
|
+
}
|
|
84046
|
+
};
|
|
84047
|
+
function selectionHasNodeOrMark(state2, name, options = {}) {
|
|
84048
|
+
const { requireEnds = false } = options;
|
|
84049
|
+
const $from = state2.selection.$from;
|
|
84050
|
+
const $to = state2.selection.$to;
|
|
84051
|
+
if (requireEnds) {
|
|
84052
|
+
for (let d2 = $from.depth; d2 > 0; d2--) {
|
|
84053
|
+
if ($from.node(d2).type.name === name) {
|
|
84054
|
+
return true;
|
|
84055
|
+
}
|
|
84056
|
+
}
|
|
84057
|
+
for (let d2 = $to.depth; d2 > 0; d2--) {
|
|
84058
|
+
if ($to.node(d2).type.name === name) {
|
|
84059
|
+
return true;
|
|
84060
|
+
}
|
|
84061
|
+
}
|
|
84062
|
+
} else {
|
|
84063
|
+
for (let d2 = $from.depth; d2 > 0; d2--) {
|
|
84064
|
+
if ($from.node(d2).type.name === name) {
|
|
84065
|
+
return true;
|
|
84066
|
+
}
|
|
84067
|
+
}
|
|
84068
|
+
}
|
|
84069
|
+
const markType = state2.schema.marks[name];
|
|
84070
|
+
if (markType) {
|
|
84071
|
+
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
84072
|
+
if (requireEnds) {
|
|
84073
|
+
const fromMarks = markType.isInSet($from.marks());
|
|
84074
|
+
const toMarks = markType.isInSet($to.marks());
|
|
84075
|
+
if (fromMarks || toMarks) {
|
|
84076
|
+
return true;
|
|
84077
|
+
}
|
|
84078
|
+
if (empty2 && markType.isInSet(state2.storedMarks || $from.marks())) {
|
|
84079
|
+
return true;
|
|
84080
|
+
}
|
|
84081
|
+
} else {
|
|
84082
|
+
if (empty2) {
|
|
84083
|
+
if (markType.isInSet(state2.storedMarks || $from.marks())) {
|
|
84084
|
+
return true;
|
|
84085
|
+
}
|
|
84086
|
+
} else {
|
|
84087
|
+
let hasMark = false;
|
|
84088
|
+
state2.doc.nodesBetween(from2, to, (node) => {
|
|
84089
|
+
if (markType.isInSet(node.marks)) {
|
|
84090
|
+
hasMark = true;
|
|
84091
|
+
return false;
|
|
84092
|
+
}
|
|
84093
|
+
});
|
|
84094
|
+
if (hasMark) return true;
|
|
84095
|
+
}
|
|
84096
|
+
}
|
|
84097
|
+
}
|
|
84098
|
+
return false;
|
|
84099
|
+
}
|
|
84100
|
+
function moveCursorToMouseEvent(event, editor) {
|
|
84101
|
+
const { view } = editor;
|
|
84102
|
+
const coords = { left: event.clientX, top: event.clientY };
|
|
84103
|
+
const pos = view.posAtCoords(coords)?.pos;
|
|
84104
|
+
if (typeof pos === "number") {
|
|
84105
|
+
const tr = view.state.tr.setSelection(TextSelection$1.create(view.state.doc, pos));
|
|
84106
|
+
view.dispatch(tr);
|
|
84107
|
+
view.focus();
|
|
84108
|
+
}
|
|
84109
|
+
}
|
|
83572
84110
|
const ICONS = {
|
|
83573
84111
|
addRowBefore: plusIconSvg,
|
|
83574
84112
|
addRowAfter: plusIconSvg,
|
|
@@ -83768,6 +84306,30 @@ const getPropsByItemId = (itemId, props) => {
|
|
|
83768
84306
|
return baseProps;
|
|
83769
84307
|
}
|
|
83770
84308
|
};
|
|
84309
|
+
function normalizeClipboardContent(rawClipboardContent) {
|
|
84310
|
+
if (!rawClipboardContent) {
|
|
84311
|
+
return {
|
|
84312
|
+
html: null,
|
|
84313
|
+
text: null,
|
|
84314
|
+
hasContent: false,
|
|
84315
|
+
raw: null
|
|
84316
|
+
};
|
|
84317
|
+
}
|
|
84318
|
+
const html = typeof rawClipboardContent.html === "string" ? rawClipboardContent.html : null;
|
|
84319
|
+
const text = typeof rawClipboardContent.text === "string" ? rawClipboardContent.text : null;
|
|
84320
|
+
const hasHtml = !!html && html.trim().length > 0;
|
|
84321
|
+
const hasText = !!text && text.length > 0;
|
|
84322
|
+
const isObject2 = typeof rawClipboardContent === "object" && rawClipboardContent !== null;
|
|
84323
|
+
const fragmentSize = typeof rawClipboardContent.size === "number" ? rawClipboardContent.size : null;
|
|
84324
|
+
const nestedSize = isObject2 && rawClipboardContent.content && typeof rawClipboardContent.content.size === "number" ? rawClipboardContent.content.size : null;
|
|
84325
|
+
const hasFragmentContent = (fragmentSize ?? nestedSize ?? 0) > 0;
|
|
84326
|
+
return {
|
|
84327
|
+
html,
|
|
84328
|
+
text,
|
|
84329
|
+
hasContent: hasHtml || hasText || hasFragmentContent,
|
|
84330
|
+
raw: rawClipboardContent
|
|
84331
|
+
};
|
|
84332
|
+
}
|
|
83771
84333
|
async function getEditorContext(editor, event) {
|
|
83772
84334
|
const { view } = editor;
|
|
83773
84335
|
const { state: state2 } = view;
|
|
@@ -83783,123 +84345,144 @@ async function getEditorContext(editor, event) {
|
|
|
83783
84345
|
pos = from2;
|
|
83784
84346
|
node = state2.doc.nodeAt(pos);
|
|
83785
84347
|
}
|
|
83786
|
-
const
|
|
84348
|
+
const rawClipboardContent = await readFromClipboard(state2);
|
|
84349
|
+
const clipboardContent = normalizeClipboardContent(rawClipboardContent);
|
|
84350
|
+
const structureFromResolvedPos = pos !== null ? getStructureFromResolvedPos(state2, pos) : null;
|
|
84351
|
+
const isInTable2 = structureFromResolvedPos?.isInTable ?? selectionHasNodeOrMark(state2, "table", { requireEnds: true });
|
|
84352
|
+
const isInList = structureFromResolvedPos?.isInList ?? (selectionHasNodeOrMark(state2, "bulletList", { requireEnds: false }) || selectionHasNodeOrMark(state2, "orderedList", { requireEnds: false }));
|
|
84353
|
+
const isInSectionNode = structureFromResolvedPos?.isInSectionNode ?? selectionHasNodeOrMark(state2, "documentSection", { requireEnds: true });
|
|
84354
|
+
const currentNodeType = node?.type?.name || null;
|
|
84355
|
+
const activeMarks = [];
|
|
84356
|
+
if (event && pos !== null) {
|
|
84357
|
+
const $pos = state2.doc.resolve(pos);
|
|
84358
|
+
if ($pos.marks && typeof $pos.marks === "function") {
|
|
84359
|
+
$pos.marks().forEach((mark) => activeMarks.push(mark.type.name));
|
|
84360
|
+
}
|
|
84361
|
+
if (node && node.marks) {
|
|
84362
|
+
node.marks.forEach((mark) => activeMarks.push(mark.type.name));
|
|
84363
|
+
}
|
|
84364
|
+
} else {
|
|
84365
|
+
state2.storedMarks?.forEach((mark) => activeMarks.push(mark.type.name));
|
|
84366
|
+
state2.selection.$head.marks().forEach((mark) => activeMarks.push(mark.type.name));
|
|
84367
|
+
}
|
|
84368
|
+
const isTrackedChange = activeMarks.includes("trackInsert") || activeMarks.includes("trackDelete");
|
|
84369
|
+
let trackedChangeId = null;
|
|
84370
|
+
if (isTrackedChange && event && pos !== null) {
|
|
84371
|
+
const $pos = state2.doc.resolve(pos);
|
|
84372
|
+
const marksAtPos = $pos.marks();
|
|
84373
|
+
const trackedMark = marksAtPos.find((mark) => mark.type.name === "trackInsert" || mark.type.name === "trackDelete");
|
|
84374
|
+
if (trackedMark) {
|
|
84375
|
+
trackedChangeId = trackedMark.attrs.id;
|
|
84376
|
+
}
|
|
84377
|
+
}
|
|
84378
|
+
const cursorCoords = pos ? view.coordsAtPos(pos) : null;
|
|
84379
|
+
const cursorPosition = cursorCoords ? {
|
|
84380
|
+
x: cursorCoords.left,
|
|
84381
|
+
y: cursorCoords.top
|
|
84382
|
+
} : null;
|
|
83787
84383
|
return {
|
|
83788
|
-
|
|
84384
|
+
// Selection info
|
|
83789
84385
|
selectedText,
|
|
84386
|
+
hasSelection: !empty2,
|
|
84387
|
+
selectionStart: from2,
|
|
84388
|
+
selectionEnd: to,
|
|
84389
|
+
// Document structure
|
|
84390
|
+
isInTable: isInTable2,
|
|
84391
|
+
isInList,
|
|
84392
|
+
isInSectionNode,
|
|
84393
|
+
currentNodeType,
|
|
84394
|
+
activeMarks,
|
|
84395
|
+
// Document state
|
|
84396
|
+
isTrackedChange,
|
|
84397
|
+
trackedChangeId,
|
|
84398
|
+
documentMode: editor.options?.documentMode || "editing",
|
|
84399
|
+
canUndo: computeCanUndo(editor, state2),
|
|
84400
|
+
canRedo: computeCanRedo(editor, state2),
|
|
84401
|
+
isEditable: editor.isEditable,
|
|
84402
|
+
// Clipboard
|
|
84403
|
+
clipboardContent,
|
|
84404
|
+
// Position and trigger info
|
|
84405
|
+
cursorPosition,
|
|
83790
84406
|
pos,
|
|
83791
84407
|
node,
|
|
83792
84408
|
event,
|
|
83793
|
-
|
|
84409
|
+
// Editor reference for advanced use cases
|
|
84410
|
+
editor
|
|
83794
84411
|
};
|
|
83795
84412
|
}
|
|
83796
|
-
|
|
83797
|
-
|
|
83798
|
-
|
|
83799
|
-
|
|
83800
|
-
|
|
83801
|
-
|
|
83802
|
-
|
|
83803
|
-
|
|
83804
|
-
|
|
83805
|
-
|
|
83806
|
-
if (x > editorRect.right) {
|
|
83807
|
-
coords.left = editorRect.left + editorRect.width - 1;
|
|
83808
|
-
isRightMargin = true;
|
|
83809
|
-
} else if (x < editorRect.left) {
|
|
83810
|
-
coords.left = editorRect.left;
|
|
84413
|
+
function computeCanUndo(editor, state2) {
|
|
84414
|
+
if (typeof editor?.can === "function") {
|
|
84415
|
+
try {
|
|
84416
|
+
const can = editor.can();
|
|
84417
|
+
if (can && typeof can.undo === "function") {
|
|
84418
|
+
return !!can.undo();
|
|
84419
|
+
}
|
|
84420
|
+
} catch (error) {
|
|
84421
|
+
console.warn("[SlashMenu] Unable to determine undo availability via editor.can():", error);
|
|
84422
|
+
}
|
|
83811
84423
|
}
|
|
83812
|
-
|
|
83813
|
-
|
|
83814
|
-
|
|
83815
|
-
|
|
83816
|
-
|
|
83817
|
-
|
|
83818
|
-
const node = view.state.doc.nodeAt(pos);
|
|
83819
|
-
const text = node?.text;
|
|
83820
|
-
const charAtPos = text?.charAt(charOffset);
|
|
83821
|
-
cursorPos = node?.isText && charAtPos !== " " ? pos - 1 : pos;
|
|
84424
|
+
if (isCollaborationEnabled(editor)) {
|
|
84425
|
+
try {
|
|
84426
|
+
const undoManager = yUndoPluginKey.getState(state2)?.undoManager;
|
|
84427
|
+
return !!undoManager && undoManager.undoStack.length > 0;
|
|
84428
|
+
} catch (error) {
|
|
84429
|
+
console.warn("[SlashMenu] Unable to determine undo availability via y-prosemirror:", error);
|
|
83822
84430
|
}
|
|
83823
|
-
const transaction = view.state.tr.setSelection(TextSelection$1.create(view.state.doc, cursorPos));
|
|
83824
|
-
view.dispatch(transaction);
|
|
83825
|
-
view.focus();
|
|
83826
84431
|
}
|
|
83827
|
-
|
|
83828
|
-
|
|
83829
|
-
|
|
83830
|
-
|
|
83831
|
-
|
|
83832
|
-
popoverControls.position = {
|
|
83833
|
-
left: `${event.clientX - editor.element.getBoundingClientRect().left}px`,
|
|
83834
|
-
top: `${event.clientY - editor.element.getBoundingClientRect().top + 15}px`
|
|
83835
|
-
};
|
|
83836
|
-
popoverControls.props = {
|
|
83837
|
-
showInput: true
|
|
83838
|
-
};
|
|
83839
|
-
popoverControls.visible = true;
|
|
84432
|
+
try {
|
|
84433
|
+
return undoDepth(state2) > 0;
|
|
84434
|
+
} catch (error) {
|
|
84435
|
+
console.warn("[SlashMenu] Unable to determine undo availability via history plugin:", error);
|
|
84436
|
+
return false;
|
|
83840
84437
|
}
|
|
83841
|
-
}
|
|
83842
|
-
function
|
|
83843
|
-
|
|
83844
|
-
|
|
83845
|
-
|
|
83846
|
-
|
|
83847
|
-
|
|
83848
|
-
if ($from.node(d2).type.name === name) {
|
|
83849
|
-
return true;
|
|
83850
|
-
}
|
|
83851
|
-
}
|
|
83852
|
-
for (let d2 = $to.depth; d2 > 0; d2--) {
|
|
83853
|
-
if ($to.node(d2).type.name === name) {
|
|
83854
|
-
return true;
|
|
83855
|
-
}
|
|
83856
|
-
}
|
|
83857
|
-
} else {
|
|
83858
|
-
for (let d2 = $from.depth; d2 > 0; d2--) {
|
|
83859
|
-
if ($from.node(d2).type.name === name) {
|
|
83860
|
-
return true;
|
|
84438
|
+
}
|
|
84439
|
+
function computeCanRedo(editor, state2) {
|
|
84440
|
+
if (typeof editor?.can === "function") {
|
|
84441
|
+
try {
|
|
84442
|
+
const can = editor.can();
|
|
84443
|
+
if (can && typeof can.redo === "function") {
|
|
84444
|
+
return !!can.redo();
|
|
83861
84445
|
}
|
|
84446
|
+
} catch (error) {
|
|
84447
|
+
console.warn("[SlashMenu] Unable to determine redo availability via editor.can():", error);
|
|
83862
84448
|
}
|
|
83863
84449
|
}
|
|
83864
|
-
|
|
83865
|
-
|
|
83866
|
-
|
|
83867
|
-
|
|
83868
|
-
|
|
83869
|
-
|
|
83870
|
-
if (fromMarks || toMarks) {
|
|
83871
|
-
return true;
|
|
83872
|
-
}
|
|
83873
|
-
if (empty2 && markType.isInSet(state2.storedMarks || $from.marks())) {
|
|
83874
|
-
return true;
|
|
83875
|
-
}
|
|
83876
|
-
} else {
|
|
83877
|
-
if (empty2) {
|
|
83878
|
-
if (markType.isInSet(state2.storedMarks || $from.marks())) {
|
|
83879
|
-
return true;
|
|
83880
|
-
}
|
|
83881
|
-
} else {
|
|
83882
|
-
let hasMark = false;
|
|
83883
|
-
state2.doc.nodesBetween(from2, to, (node) => {
|
|
83884
|
-
if (markType.isInSet(node.marks)) {
|
|
83885
|
-
hasMark = true;
|
|
83886
|
-
return false;
|
|
83887
|
-
}
|
|
83888
|
-
});
|
|
83889
|
-
if (hasMark) return true;
|
|
83890
|
-
}
|
|
84450
|
+
if (isCollaborationEnabled(editor)) {
|
|
84451
|
+
try {
|
|
84452
|
+
const undoManager = yUndoPluginKey.getState(state2)?.undoManager;
|
|
84453
|
+
return !!undoManager && undoManager.redoStack.length > 0;
|
|
84454
|
+
} catch (error) {
|
|
84455
|
+
console.warn("[SlashMenu] Unable to determine redo availability via y-prosemirror:", error);
|
|
83891
84456
|
}
|
|
83892
84457
|
}
|
|
83893
|
-
|
|
84458
|
+
try {
|
|
84459
|
+
return redoDepth(state2) > 0;
|
|
84460
|
+
} catch (error) {
|
|
84461
|
+
console.warn("[SlashMenu] Unable to determine redo availability via history plugin:", error);
|
|
84462
|
+
return false;
|
|
84463
|
+
}
|
|
83894
84464
|
}
|
|
83895
|
-
function
|
|
83896
|
-
|
|
83897
|
-
|
|
83898
|
-
|
|
83899
|
-
|
|
83900
|
-
const
|
|
83901
|
-
|
|
83902
|
-
|
|
84465
|
+
function isCollaborationEnabled(editor) {
|
|
84466
|
+
return Boolean(editor?.options?.collaborationProvider && editor?.options?.ydoc);
|
|
84467
|
+
}
|
|
84468
|
+
function getStructureFromResolvedPos(state2, pos) {
|
|
84469
|
+
try {
|
|
84470
|
+
const $pos = state2.doc.resolve(pos);
|
|
84471
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
84472
|
+
for (let depth = $pos.depth; depth > 0; depth--) {
|
|
84473
|
+
ancestors.add($pos.node(depth).type.name);
|
|
84474
|
+
}
|
|
84475
|
+
const isInList = ancestors.has("bulletList") || ancestors.has("orderedList");
|
|
84476
|
+
const isInTable2 = ancestors.has("table") || ancestors.has("tableRow") || ancestors.has("tableCell") || ancestors.has("tableHeader");
|
|
84477
|
+
const isInSectionNode = ancestors.has("documentSection");
|
|
84478
|
+
return {
|
|
84479
|
+
isInTable: isInTable2,
|
|
84480
|
+
isInList,
|
|
84481
|
+
isInSectionNode
|
|
84482
|
+
};
|
|
84483
|
+
} catch (error) {
|
|
84484
|
+
console.warn("[SlashMenu] Unable to resolve position for structural context:", error);
|
|
84485
|
+
return null;
|
|
83903
84486
|
}
|
|
83904
84487
|
}
|
|
83905
84488
|
const isModuleEnabled = (editorOptions, moduleName) => {
|
|
@@ -83913,8 +84496,52 @@ const isModuleEnabled = (editorOptions, moduleName) => {
|
|
|
83913
84496
|
return true;
|
|
83914
84497
|
}
|
|
83915
84498
|
};
|
|
84499
|
+
function applyCustomMenuConfiguration(defaultSections, context) {
|
|
84500
|
+
const { editor } = context;
|
|
84501
|
+
const slashMenuConfig = editor.options?.slashMenuConfig;
|
|
84502
|
+
if (!slashMenuConfig) {
|
|
84503
|
+
return defaultSections;
|
|
84504
|
+
}
|
|
84505
|
+
let sections = [];
|
|
84506
|
+
if (slashMenuConfig.includeDefaultItems !== false) {
|
|
84507
|
+
sections = [...defaultSections];
|
|
84508
|
+
}
|
|
84509
|
+
if (slashMenuConfig.customItems && Array.isArray(slashMenuConfig.customItems)) {
|
|
84510
|
+
sections = [...sections, ...slashMenuConfig.customItems];
|
|
84511
|
+
}
|
|
84512
|
+
if (typeof slashMenuConfig.menuProvider === "function") {
|
|
84513
|
+
try {
|
|
84514
|
+
sections = slashMenuConfig.menuProvider(context, sections) || sections;
|
|
84515
|
+
} catch (error) {
|
|
84516
|
+
console.warn("[SlashMenu] Error in custom menuProvider:", error);
|
|
84517
|
+
}
|
|
84518
|
+
}
|
|
84519
|
+
return sections;
|
|
84520
|
+
}
|
|
84521
|
+
function filterCustomItems(sections, context) {
|
|
84522
|
+
return sections.map((section) => {
|
|
84523
|
+
const filteredItems = section.items.filter((item) => {
|
|
84524
|
+
if (typeof item.showWhen === "function") {
|
|
84525
|
+
try {
|
|
84526
|
+
return item.showWhen(context);
|
|
84527
|
+
} catch (error) {
|
|
84528
|
+
console.warn(`[SlashMenu] Error in showWhen for item ${item.id}:`, error);
|
|
84529
|
+
return false;
|
|
84530
|
+
}
|
|
84531
|
+
}
|
|
84532
|
+
return true;
|
|
84533
|
+
});
|
|
84534
|
+
return {
|
|
84535
|
+
...section,
|
|
84536
|
+
items: filteredItems
|
|
84537
|
+
};
|
|
84538
|
+
}).filter((section) => section.items.length > 0);
|
|
84539
|
+
}
|
|
83916
84540
|
function getItems(context) {
|
|
83917
84541
|
const { editor, selectedText, trigger: trigger2, clipboardContent } = context;
|
|
84542
|
+
const clipboardHasContent = Boolean(
|
|
84543
|
+
clipboardContent?.hasContent || clipboardContent?.html || clipboardContent?.text || typeof clipboardContent?.size === "number" && clipboardContent.size > 0 || clipboardContent && typeof clipboardContent?.content?.size === "number" && clipboardContent.content.size > 0 || clipboardContent?.raw && typeof clipboardContent.raw.size === "number" && clipboardContent.raw.size > 0 || clipboardContent?.raw && typeof clipboardContent.raw?.content?.size === "number" && clipboardContent.raw.content.size > 0
|
|
84544
|
+
);
|
|
83918
84545
|
const isInTable2 = selectionHasNodeOrMark(editor.view.state, "table", { requireEnds: true });
|
|
83919
84546
|
const isInSectionNode = selectionHasNodeOrMark(editor.view.state, "documentSection", { requireEnds: true });
|
|
83920
84547
|
const sections = [
|
|
@@ -84051,12 +84678,13 @@ function getItems(context) {
|
|
|
84051
84678
|
]
|
|
84052
84679
|
}
|
|
84053
84680
|
];
|
|
84054
|
-
|
|
84681
|
+
let allSections = applyCustomMenuConfiguration(sections, context);
|
|
84682
|
+
const filteredSections = allSections.map((section) => {
|
|
84055
84683
|
const filteredItems = section.items.filter((item) => {
|
|
84056
84684
|
if (item.requiresModule && !isModuleEnabled(editor?.options, item.requiresModule)) return false;
|
|
84057
84685
|
if (item.requiresSelection && !selectedText) return false;
|
|
84058
84686
|
if (!item.allowedTriggers.includes(trigger2)) return false;
|
|
84059
|
-
if (item.requiresClipboard && !
|
|
84687
|
+
if (item.requiresClipboard && !clipboardHasContent) return false;
|
|
84060
84688
|
if (item.requiresTableParent && !isInTable2 || item.id === "insert-table" && isInTable2) return false;
|
|
84061
84689
|
if (item.requiresSectionParent && !isInSectionNode) return false;
|
|
84062
84690
|
return true;
|
|
@@ -84066,7 +84694,8 @@ function getItems(context) {
|
|
|
84066
84694
|
items: filteredItems
|
|
84067
84695
|
};
|
|
84068
84696
|
}).filter((section) => section.items.length > 0);
|
|
84069
|
-
|
|
84697
|
+
const finalSections = filterCustomItems(filteredSections, context);
|
|
84698
|
+
return finalSections;
|
|
84070
84699
|
}
|
|
84071
84700
|
const _hoisted_1$3 = { class: "slash-menu-items" };
|
|
84072
84701
|
const _hoisted_2$1 = {
|
|
@@ -84101,6 +84730,7 @@ const _sfc_main$4 = {
|
|
|
84101
84730
|
const menuRef = vue.ref(null);
|
|
84102
84731
|
const sections = vue.ref([]);
|
|
84103
84732
|
const selectedId = vue.ref(null);
|
|
84733
|
+
const currentContext = vue.ref(null);
|
|
84104
84734
|
const handleEditorUpdate = () => {
|
|
84105
84735
|
if (!props.editor?.isEditable && isOpen.value) {
|
|
84106
84736
|
closeMenu({ restoreCursor: false });
|
|
@@ -84146,6 +84776,44 @@ const _sfc_main$4 = {
|
|
|
84146
84776
|
selectedId.value = newItems[0].id;
|
|
84147
84777
|
}
|
|
84148
84778
|
});
|
|
84779
|
+
const customItemRefs = /* @__PURE__ */ new Map();
|
|
84780
|
+
const setCustomItemRef = (el, item) => {
|
|
84781
|
+
if (el && item.render) {
|
|
84782
|
+
customItemRefs.set(item.id, { element: el, item });
|
|
84783
|
+
vue.nextTick(() => {
|
|
84784
|
+
renderCustomItem(item.id);
|
|
84785
|
+
});
|
|
84786
|
+
}
|
|
84787
|
+
};
|
|
84788
|
+
const renderCustomItem = async (itemId) => {
|
|
84789
|
+
const refData = customItemRefs.get(itemId);
|
|
84790
|
+
if (!refData || refData.element.hasCustomContent) return;
|
|
84791
|
+
const { element, item } = refData;
|
|
84792
|
+
try {
|
|
84793
|
+
if (!currentContext.value) {
|
|
84794
|
+
currentContext.value = await getEditorContext(props.editor);
|
|
84795
|
+
}
|
|
84796
|
+
const context = currentContext.value;
|
|
84797
|
+
const customElement = item.render(context);
|
|
84798
|
+
if (customElement instanceof HTMLElement) {
|
|
84799
|
+
element.innerHTML = "";
|
|
84800
|
+
element.appendChild(customElement);
|
|
84801
|
+
element.hasCustomContent = true;
|
|
84802
|
+
}
|
|
84803
|
+
} catch (error) {
|
|
84804
|
+
console.warn(`[SlashMenu] Error rendering custom item ${itemId}:`, error);
|
|
84805
|
+
element.innerHTML = `<span>${item.label || "Custom Item"}</span>`;
|
|
84806
|
+
element.hasCustomContent = true;
|
|
84807
|
+
}
|
|
84808
|
+
};
|
|
84809
|
+
const cleanupCustomItems = () => {
|
|
84810
|
+
customItemRefs.forEach((refData) => {
|
|
84811
|
+
if (refData.element) {
|
|
84812
|
+
refData.element.hasCustomContent = false;
|
|
84813
|
+
}
|
|
84814
|
+
});
|
|
84815
|
+
customItemRefs.clear();
|
|
84816
|
+
};
|
|
84149
84817
|
const handleGlobalKeyDown = (event) => {
|
|
84150
84818
|
if (event.key === "Escape") {
|
|
84151
84819
|
event.preventDefault();
|
|
@@ -84191,27 +84859,27 @@ const _sfc_main$4 = {
|
|
|
84191
84859
|
};
|
|
84192
84860
|
const handleRightClick = async (event) => {
|
|
84193
84861
|
const readOnly = !props.editor?.isEditable;
|
|
84194
|
-
|
|
84195
|
-
if (readOnly || isHoldingCtrl) {
|
|
84862
|
+
if (readOnly || shouldBypassContextMenu(event)) {
|
|
84196
84863
|
return;
|
|
84197
84864
|
}
|
|
84198
84865
|
event.preventDefault();
|
|
84866
|
+
const context = await getEditorContext(props.editor, event);
|
|
84867
|
+
currentContext.value = context;
|
|
84868
|
+
sections.value = getItems({ ...context, trigger: "click" });
|
|
84869
|
+
selectedId.value = flattenedItems.value[0]?.id || null;
|
|
84870
|
+
searchQuery.value = "";
|
|
84199
84871
|
props.editor.view.dispatch(
|
|
84200
84872
|
props.editor.view.state.tr.setMeta(SlashMenuPluginKey, {
|
|
84201
84873
|
type: "open",
|
|
84202
|
-
pos: props.editor.view.state.selection.from,
|
|
84874
|
+
pos: context?.pos ?? props.editor.view.state.selection.from,
|
|
84203
84875
|
clientX: event.clientX,
|
|
84204
84876
|
clientY: event.clientY
|
|
84205
84877
|
})
|
|
84206
84878
|
);
|
|
84207
|
-
searchQuery.value = "";
|
|
84208
|
-
const context = await getEditorContext(props.editor, event);
|
|
84209
|
-
sections.value = getItems({ ...context, trigger: "click" });
|
|
84210
|
-
selectedId.value = flattenedItems.value[0]?.id || null;
|
|
84211
84879
|
};
|
|
84212
84880
|
const executeCommand = async (item) => {
|
|
84213
84881
|
if (props.editor) {
|
|
84214
|
-
item.action ? await item.action(props.editor) : null;
|
|
84882
|
+
item.action ? await item.action(props.editor, currentContext.value) : null;
|
|
84215
84883
|
if (item.component) {
|
|
84216
84884
|
menuRef.value;
|
|
84217
84885
|
const componentProps = getPropsByItemId(item.id, props);
|
|
@@ -84229,7 +84897,7 @@ const _sfc_main$4 = {
|
|
|
84229
84897
|
const closeMenu = (options = { restoreCursor: true }) => {
|
|
84230
84898
|
if (props.editor?.view) {
|
|
84231
84899
|
const pluginState = SlashMenuPluginKey.getState(props.editor.view.state);
|
|
84232
|
-
const
|
|
84900
|
+
const anchorPos = pluginState?.anchorPos;
|
|
84233
84901
|
props.editor.view.dispatch(
|
|
84234
84902
|
props.editor.view.state.tr.setMeta(SlashMenuPluginKey, {
|
|
84235
84903
|
type: "close"
|
|
@@ -84242,6 +84910,8 @@ const _sfc_main$4 = {
|
|
|
84242
84910
|
props.editor.view.dispatch(tr);
|
|
84243
84911
|
props.editor.view.focus();
|
|
84244
84912
|
}
|
|
84913
|
+
cleanupCustomItems();
|
|
84914
|
+
currentContext.value = null;
|
|
84245
84915
|
isOpen.value = false;
|
|
84246
84916
|
searchQuery.value = "";
|
|
84247
84917
|
sections.value = [];
|
|
@@ -84258,19 +84928,29 @@ const _sfc_main$4 = {
|
|
|
84258
84928
|
isOpen.value = true;
|
|
84259
84929
|
menuPosition.value = event.menuPosition;
|
|
84260
84930
|
searchQuery.value = "";
|
|
84261
|
-
|
|
84262
|
-
|
|
84263
|
-
|
|
84931
|
+
if (!currentContext.value) {
|
|
84932
|
+
const context = await getEditorContext(props.editor);
|
|
84933
|
+
currentContext.value = context;
|
|
84934
|
+
sections.value = getItems({ ...context, trigger: "slash" });
|
|
84935
|
+
selectedId.value = flattenedItems.value[0]?.id || null;
|
|
84936
|
+
} else if (sections.value.length === 0) {
|
|
84937
|
+
const trigger2 = currentContext.value.event?.type === "contextmenu" ? "click" : "slash";
|
|
84938
|
+
sections.value = getItems({ ...currentContext.value, trigger: trigger2 });
|
|
84939
|
+
selectedId.value = flattenedItems.value[0]?.id || null;
|
|
84940
|
+
}
|
|
84264
84941
|
});
|
|
84265
84942
|
props.editor.view.dom.addEventListener("contextmenu", handleRightClick);
|
|
84266
84943
|
props.editor.on("slashMenu:close", () => {
|
|
84944
|
+
cleanupCustomItems();
|
|
84267
84945
|
isOpen.value = false;
|
|
84268
84946
|
searchQuery.value = "";
|
|
84947
|
+
currentContext.value = null;
|
|
84269
84948
|
});
|
|
84270
84949
|
});
|
|
84271
84950
|
vue.onBeforeUnmount(() => {
|
|
84272
84951
|
document.removeEventListener("keydown", handleGlobalKeyDown);
|
|
84273
84952
|
document.removeEventListener("mousedown", handleGlobalOutsideClick);
|
|
84953
|
+
cleanupCustomItems();
|
|
84274
84954
|
if (props.editor) {
|
|
84275
84955
|
try {
|
|
84276
84956
|
props.editor.off("slashMenu:open");
|
|
@@ -84317,12 +84997,19 @@ const _sfc_main$4 = {
|
|
|
84317
84997
|
class: vue.normalizeClass(["slash-menu-item", { "is-selected": item.id === selectedId.value }]),
|
|
84318
84998
|
onClick: ($event) => executeCommand(item)
|
|
84319
84999
|
}, [
|
|
84320
|
-
item.
|
|
85000
|
+
item.render ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
84321
85001
|
key: 0,
|
|
84322
|
-
|
|
84323
|
-
|
|
84324
|
-
|
|
84325
|
-
|
|
85002
|
+
ref_for: true,
|
|
85003
|
+
ref: (el) => setCustomItemRef(el, item),
|
|
85004
|
+
class: "slash-menu-custom-item"
|
|
85005
|
+
}, null, 512)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
85006
|
+
item.icon ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
85007
|
+
key: 0,
|
|
85008
|
+
class: "slash-menu-item-icon",
|
|
85009
|
+
innerHTML: item.icon
|
|
85010
|
+
}, null, 8, _hoisted_4)) : vue.createCommentVNode("", true),
|
|
85011
|
+
vue.createBaseVNode("span", null, vue.toDisplayString(item.label), 1)
|
|
85012
|
+
], 64))
|
|
84326
85013
|
], 10, _hoisted_3$1);
|
|
84327
85014
|
}), 128))
|
|
84328
85015
|
], 64);
|
|
@@ -85017,34 +85704,76 @@ const _sfc_main = {
|
|
|
85017
85704
|
}
|
|
85018
85705
|
};
|
|
85019
85706
|
const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
|
|
85707
|
+
const additionalHandlers = Object.freeze({
|
|
85708
|
+
"mc:AlternateContent": translator,
|
|
85709
|
+
"w:b": translator$12,
|
|
85710
|
+
"w:bidiVisual": translator$F,
|
|
85711
|
+
"w:bookmarkEnd": translator$1,
|
|
85712
|
+
"w:bookmarkStart": translator$2,
|
|
85713
|
+
"w:bottom": translator$s,
|
|
85714
|
+
"w:br": translator$16,
|
|
85715
|
+
"w:cantSplit": translator$T,
|
|
85716
|
+
"w:cnfStyle": translator$S,
|
|
85717
|
+
"w:color": translator$_,
|
|
85718
|
+
"w:divId": translator$R,
|
|
85719
|
+
"w:drawing": translator$4,
|
|
85720
|
+
"w:end": translator$q,
|
|
85721
|
+
"w:gridAfter": translator$Q,
|
|
85722
|
+
"w:gridBefore": translator$P,
|
|
85723
|
+
"w:gridCol": translator$b,
|
|
85724
|
+
"w:hidden": translator$O,
|
|
85725
|
+
"w:highlight": translator$15,
|
|
85726
|
+
"w:hyperlink": translator$7,
|
|
85727
|
+
"w:i": translator$11,
|
|
85728
|
+
"w:insideH": translator$o,
|
|
85729
|
+
"w:insideV": translator$n,
|
|
85730
|
+
"w:jc": translator$N,
|
|
85731
|
+
"w:left": translator$m,
|
|
85732
|
+
"w:p": translator$13,
|
|
85733
|
+
"w:r": translator$U,
|
|
85734
|
+
"w:rFonts": translator$Z,
|
|
85735
|
+
"w:rPr": translator$V,
|
|
85736
|
+
"w:rStyle": translator$Y,
|
|
85737
|
+
"w:right": translator$k,
|
|
85738
|
+
"w:sdt": translator$3,
|
|
85739
|
+
"w:shd": translator$E,
|
|
85740
|
+
"w:start": translator$i,
|
|
85741
|
+
"w:strike": translator$$,
|
|
85742
|
+
"w:sz": translator$X,
|
|
85743
|
+
"w:szCs": translator$W,
|
|
85744
|
+
"w:tab": translator$14,
|
|
85745
|
+
"w:tbl": translator$9,
|
|
85746
|
+
"w:tblBorders": translator$e,
|
|
85747
|
+
"w:tblCaption": translator$D,
|
|
85748
|
+
"w:tblCellMar": translator$d,
|
|
85749
|
+
"w:tblCellSpacing": translator$M,
|
|
85750
|
+
"w:tblDescription": translator$C,
|
|
85751
|
+
"w:tblGrid": translator$a,
|
|
85752
|
+
"w:tblHeader": translator$L,
|
|
85753
|
+
"w:tblInd": translator$B,
|
|
85754
|
+
"w:tblLayout": translator$A,
|
|
85755
|
+
"w:tblLook": translator$z,
|
|
85756
|
+
"w:tblOverlap": translator$y,
|
|
85757
|
+
"w:tblPr": translator$c,
|
|
85758
|
+
"w:tblStyle": translator$x,
|
|
85759
|
+
"w:tblStyleColBandSize": translator$w,
|
|
85760
|
+
"w:tblStyleRowBandSize": translator$v,
|
|
85761
|
+
"w:tblW": translator$u,
|
|
85762
|
+
"w:tblpPr": translator$t,
|
|
85763
|
+
"w:tc": translator$8,
|
|
85764
|
+
"w:top": translator$g,
|
|
85765
|
+
"w:tr": translator$G,
|
|
85766
|
+
"w:trHeight": translator$K,
|
|
85767
|
+
"w:trPr": translator$H,
|
|
85768
|
+
"w:u": translator$10,
|
|
85769
|
+
"w:wAfter": translator$J,
|
|
85770
|
+
"w:wBefore": translator$I,
|
|
85771
|
+
"wp:anchor": translator$6,
|
|
85772
|
+
"wp:inline": translator$5
|
|
85773
|
+
});
|
|
85020
85774
|
const baseHandlers = {
|
|
85021
85775
|
...runPropertyTranslators,
|
|
85022
|
-
|
|
85023
|
-
"w:cantSplit": translator$S,
|
|
85024
|
-
"w:cnfStyle": translator$R,
|
|
85025
|
-
"w:divId": translator$Q,
|
|
85026
|
-
"w:gridAfter": translator$P,
|
|
85027
|
-
"w:gridBefore": translator$O,
|
|
85028
|
-
"w:hidden": translator$N,
|
|
85029
|
-
"w:hyperlink": translator$6,
|
|
85030
|
-
"w:jc": translator$M,
|
|
85031
|
-
"w:p": translator$12,
|
|
85032
|
-
"w:r": translator$T,
|
|
85033
|
-
"w:rPr": translator$U,
|
|
85034
|
-
"w:sdt": translator$2,
|
|
85035
|
-
"w:tab": translator$13,
|
|
85036
|
-
"w:tblCellSpacing": translator$L,
|
|
85037
|
-
"w:tblHeader": translator$K,
|
|
85038
|
-
"w:tc": translator$7,
|
|
85039
|
-
"w:tr": translator$F,
|
|
85040
|
-
"w:trHeight": translator$J,
|
|
85041
|
-
"w:trPr": translator$G,
|
|
85042
|
-
"w:wAfter": translator$I,
|
|
85043
|
-
"w:wBefore": translator$H,
|
|
85044
|
-
"wp:anchor": translator$5,
|
|
85045
|
-
"wp:inline": translator$4,
|
|
85046
|
-
"w:bookmarkStart": translator$1,
|
|
85047
|
-
"w:bookmarkEnd": translator
|
|
85776
|
+
...additionalHandlers
|
|
85048
85777
|
};
|
|
85049
85778
|
const registeredHandlers = Object.freeze(baseHandlers);
|
|
85050
85779
|
const Extensions = {
|