@harbour-enterprises/superdoc 0.20.1 → 0.21.0-RC1
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-BLwxuMWh.cjs → PdfViewer-BdrjIRpr.cjs} +1 -1
- package/dist/chunks/{PdfViewer-t_JS3Mbo.es.js → PdfViewer-DK1etjvu.es.js} +1 -1
- package/dist/chunks/{index-CBTSdULo.cjs → index-C_zTr1ZR.cjs} +14 -33
- package/dist/chunks/{index-Vp2WxlNm.es.js → index-ucP9WQ5I.es.js} +14 -33
- package/dist/chunks/{super-editor.es-DGV2_J23.es.js → super-editor.es-KKA9G1l1.es.js} +1846 -404
- package/dist/chunks/{super-editor.es-Cten5oWF.cjs → super-editor.es-XC168Mlw.cjs} +1846 -404
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/stores/comments-store.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-Dq0PLazx.js → converter-B61ZUb-V.js} +1401 -310
- package/dist/super-editor/chunks/{docx-zipper-jT0gaoep.js → docx-zipper-B8nhsVFW.js} +1 -1
- package/dist/super-editor/chunks/{editor-BEtv1kuN.js → editor-CQ0o4v54.js} +420 -65
- package/dist/super-editor/chunks/{toolbar-CJfSHfLU.js → toolbar-DWzoslZk.js} +11 -21
- 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/core/commands/index.d.ts +1 -0
- package/dist/super-editor/src/core/commands/toggleMarkCascade.d.ts +41 -0
- package/dist/super-editor/src/core/super-converter/SuperConverter.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/helpers.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +12 -0
- package/dist/super-editor/src/core/super-converter/v2/importer/runNodeImporter.d.ts +6 -6
- package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +20 -4
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts +3 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/b-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/b/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/color/color-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/highlight/highlight-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/i/i-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-del.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r-pr.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/helpers.d.ts +40 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts +9 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rFonts/rFonts-translator.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rStyle/rstyle-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/rpr-translator.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts +11 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/strike/strike-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/sz/sz-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/szcs/szcs-translator.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-color.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-color.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-shade.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-theme-tint.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/attributes/w-val.d.ts +4 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/u/u-translator.d.ts +7 -0
- package/dist/super-editor/src/extensions/index.d.ts +2 -2
- package/dist/super-editor/src/extensions/linked-styles/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/linked-styles/underline-css.d.ts +17 -0
- package/dist/super-editor/src/extensions/run/index.d.ts +1 -0
- package/dist/super-editor/src/extensions/run/run.d.ts +6 -0
- package/dist/super-editor/src/extensions/shared/cascade-toggle.d.ts +8 -0
- package/dist/super-editor/super-editor.es.js +49 -23
- 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 +1860 -437
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -14894,25 +14894,47 @@ const getContentTypesFromXml = (contentTypesXml) => {
|
|
|
14894
14894
|
const defaults = xmlDoc.querySelectorAll("Default");
|
|
14895
14895
|
return Array.from(defaults).map((item) => item.getAttribute("Extension"));
|
|
14896
14896
|
};
|
|
14897
|
+
const DOCX_HIGHLIGHT_KEYWORD_MAP = /* @__PURE__ */ new Map([
|
|
14898
|
+
["yellow", "FFFF00"],
|
|
14899
|
+
["green", "00FF00"],
|
|
14900
|
+
["blue", "0000FF"],
|
|
14901
|
+
["cyan", "00FFFF"],
|
|
14902
|
+
["magenta", "FF00FF"],
|
|
14903
|
+
["red", "FF0000"],
|
|
14904
|
+
["darkYellow", "808000"],
|
|
14905
|
+
["darkGreen", "008000"],
|
|
14906
|
+
["darkBlue", "000080"],
|
|
14907
|
+
["darkCyan", "008080"],
|
|
14908
|
+
["darkMagenta", "800080"],
|
|
14909
|
+
["darkGray", "808080"],
|
|
14910
|
+
["darkRed", "800000"],
|
|
14911
|
+
["lightGray", "C0C0C0"],
|
|
14912
|
+
["black", "000000"],
|
|
14913
|
+
["white", "FFFFFF"]
|
|
14914
|
+
]);
|
|
14915
|
+
const normalizeHexColor = (hex2) => {
|
|
14916
|
+
if (!hex2) return null;
|
|
14917
|
+
let value = hex2.replace("#", "").trim();
|
|
14918
|
+
if (!value) return null;
|
|
14919
|
+
value = value.toUpperCase();
|
|
14920
|
+
if (value.length === 3)
|
|
14921
|
+
value = value.split("").map((c2) => c2 + c2).join("");
|
|
14922
|
+
if (value.length === 8) value = value.slice(0, 6);
|
|
14923
|
+
return value;
|
|
14924
|
+
};
|
|
14897
14925
|
const getHexColorFromDocxSystem = (docxColor) => {
|
|
14898
|
-
const
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
["darkGray", "#808080FF"],
|
|
14911
|
-
["darkRed", "#800000FF"],
|
|
14912
|
-
["lightGray", "#C0C0C0FF"],
|
|
14913
|
-
["black", "#000"]
|
|
14914
|
-
]);
|
|
14915
|
-
return colorMap.get(docxColor) || null;
|
|
14926
|
+
const hex2 = DOCX_HIGHLIGHT_KEYWORD_MAP.get(docxColor);
|
|
14927
|
+
return hex2 ? `#${hex2}` : null;
|
|
14928
|
+
};
|
|
14929
|
+
const getDocxHighlightKeywordFromHex = (hexColor) => {
|
|
14930
|
+
if (!hexColor) return null;
|
|
14931
|
+
if (DOCX_HIGHLIGHT_KEYWORD_MAP.has(hexColor)) return hexColor;
|
|
14932
|
+
const normalized = normalizeHexColor(hexColor);
|
|
14933
|
+
if (!normalized) return null;
|
|
14934
|
+
for (const [keyword, hex2] of DOCX_HIGHLIGHT_KEYWORD_MAP.entries()) {
|
|
14935
|
+
if (hex2 === normalized) return keyword;
|
|
14936
|
+
}
|
|
14937
|
+
return null;
|
|
14916
14938
|
};
|
|
14917
14939
|
function isValidHexColor(color) {
|
|
14918
14940
|
if (!color || typeof color !== "string") return false;
|
|
@@ -24313,37 +24335,37 @@ const _NodeTranslator = class _NodeTranslator2 {
|
|
|
24313
24335
|
};
|
|
24314
24336
|
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
24315
24337
|
let NodeTranslator = _NodeTranslator;
|
|
24316
|
-
const encode$
|
|
24338
|
+
const encode$T = (attributes) => {
|
|
24317
24339
|
return attributes["w:type"];
|
|
24318
24340
|
};
|
|
24319
|
-
const decode$
|
|
24341
|
+
const decode$K = (attrs) => {
|
|
24320
24342
|
const { lineBreakType } = attrs;
|
|
24321
24343
|
return lineBreakType;
|
|
24322
24344
|
};
|
|
24323
|
-
const attrConfig$
|
|
24345
|
+
const attrConfig$z = Object.freeze({
|
|
24324
24346
|
xmlName: "w:type",
|
|
24325
24347
|
sdName: "lineBreakType",
|
|
24326
|
-
encode: encode$
|
|
24327
|
-
decode: decode$
|
|
24348
|
+
encode: encode$T,
|
|
24349
|
+
decode: decode$K
|
|
24328
24350
|
});
|
|
24329
|
-
const encode$
|
|
24351
|
+
const encode$S = (attributes) => {
|
|
24330
24352
|
const xmlAttrValue = attributes["w:clear"];
|
|
24331
24353
|
return xmlAttrValue;
|
|
24332
24354
|
};
|
|
24333
|
-
const decode$
|
|
24355
|
+
const decode$J = (attrs) => {
|
|
24334
24356
|
const { clear } = attrs;
|
|
24335
24357
|
return clear;
|
|
24336
24358
|
};
|
|
24337
|
-
const attrConfig$
|
|
24359
|
+
const attrConfig$y = Object.freeze({
|
|
24338
24360
|
xmlName: "w:clear",
|
|
24339
24361
|
sdName: "clear",
|
|
24340
|
-
encode: encode$
|
|
24341
|
-
decode: decode$
|
|
24362
|
+
encode: encode$S,
|
|
24363
|
+
decode: decode$J
|
|
24342
24364
|
});
|
|
24343
|
-
const validXmlAttributes$
|
|
24344
|
-
const XML_NODE_NAME$
|
|
24365
|
+
const validXmlAttributes$h = [attrConfig$z, attrConfig$y];
|
|
24366
|
+
const XML_NODE_NAME$j = "w:br";
|
|
24345
24367
|
const SD_NODE_NAME$6 = "lineBreak";
|
|
24346
|
-
const encode$
|
|
24368
|
+
const encode$R = (_2, encodedAttrs) => {
|
|
24347
24369
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
24348
24370
|
const translated = {
|
|
24349
24371
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -24353,7 +24375,7 @@ const encode$h = (_2, encodedAttrs) => {
|
|
|
24353
24375
|
}
|
|
24354
24376
|
return translated;
|
|
24355
24377
|
};
|
|
24356
|
-
const decode$
|
|
24378
|
+
const decode$I = (params2, decodedAttrs) => {
|
|
24357
24379
|
const { node } = params2;
|
|
24358
24380
|
if (!node) return;
|
|
24359
24381
|
const wBreak = { name: "w:br" };
|
|
@@ -24370,63 +24392,120 @@ const decode$h = (params2, decodedAttrs) => {
|
|
|
24370
24392
|
};
|
|
24371
24393
|
return translated;
|
|
24372
24394
|
};
|
|
24373
|
-
const config$
|
|
24374
|
-
xmlName: XML_NODE_NAME$
|
|
24395
|
+
const config$j = {
|
|
24396
|
+
xmlName: XML_NODE_NAME$j,
|
|
24375
24397
|
sdNodeOrKeyName: SD_NODE_NAME$6,
|
|
24376
24398
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24377
|
-
encode: encode$
|
|
24378
|
-
decode: decode$
|
|
24379
|
-
attributes: validXmlAttributes$
|
|
24399
|
+
encode: encode$R,
|
|
24400
|
+
decode: decode$I,
|
|
24401
|
+
attributes: validXmlAttributes$h
|
|
24402
|
+
};
|
|
24403
|
+
const translator$v = NodeTranslator.from(config$j);
|
|
24404
|
+
const encode$Q = (attributes) => attributes?.["w:val"];
|
|
24405
|
+
const decode$H = (attrs) => attrs?.highlight;
|
|
24406
|
+
const attrConfig$x = Object.freeze({
|
|
24407
|
+
xmlName: "w:val",
|
|
24408
|
+
sdName: "highlight",
|
|
24409
|
+
encode: encode$Q,
|
|
24410
|
+
decode: decode$H
|
|
24411
|
+
});
|
|
24412
|
+
const validXmlAttributes$g = [attrConfig$x];
|
|
24413
|
+
const XML_NODE_NAME$i = "w:highlight";
|
|
24414
|
+
const SD_ATTR_KEY$b = "highlight";
|
|
24415
|
+
const encode$P = (params2, encodedAttrs = {}) => {
|
|
24416
|
+
const { nodes } = params2;
|
|
24417
|
+
const node = nodes?.[0];
|
|
24418
|
+
const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
|
|
24419
|
+
return {
|
|
24420
|
+
type: "attr",
|
|
24421
|
+
xmlName: XML_NODE_NAME$i,
|
|
24422
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
24423
|
+
attributes: { "w:val": value ?? null }
|
|
24424
|
+
};
|
|
24425
|
+
};
|
|
24426
|
+
const decode$G = (params2) => {
|
|
24427
|
+
const attrs = params2?.node?.attrs || {};
|
|
24428
|
+
const highlightValue = attrs.highlight ?? attrs.color ?? null;
|
|
24429
|
+
if (!highlightValue) return void 0;
|
|
24430
|
+
const normalizedValue = String(highlightValue).trim().toLowerCase();
|
|
24431
|
+
if (!normalizedValue || normalizedValue === "transparent" || normalizedValue === "none") {
|
|
24432
|
+
return void 0;
|
|
24433
|
+
}
|
|
24434
|
+
const keyword = getDocxHighlightKeywordFromHex(highlightValue);
|
|
24435
|
+
if (keyword) {
|
|
24436
|
+
return {
|
|
24437
|
+
name: XML_NODE_NAME$i,
|
|
24438
|
+
attributes: { "w:val": keyword }
|
|
24439
|
+
};
|
|
24440
|
+
}
|
|
24441
|
+
const fill = normalizeHexColor(highlightValue);
|
|
24442
|
+
if (!fill) return void 0;
|
|
24443
|
+
return {
|
|
24444
|
+
name: "w:shd",
|
|
24445
|
+
attributes: {
|
|
24446
|
+
"w:color": "auto",
|
|
24447
|
+
"w:val": "clear",
|
|
24448
|
+
"w:fill": fill
|
|
24449
|
+
}
|
|
24450
|
+
};
|
|
24380
24451
|
};
|
|
24381
|
-
const
|
|
24382
|
-
|
|
24452
|
+
const config$i = {
|
|
24453
|
+
xmlName: XML_NODE_NAME$i,
|
|
24454
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
24455
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
24456
|
+
encode: encode$P,
|
|
24457
|
+
decode: decode$G,
|
|
24458
|
+
attributes: validXmlAttributes$g
|
|
24459
|
+
};
|
|
24460
|
+
const translator$u = NodeTranslator.from(config$i);
|
|
24461
|
+
const encode$O = (attributes) => {
|
|
24383
24462
|
return attributes["w:val"];
|
|
24384
24463
|
};
|
|
24385
|
-
const decode$
|
|
24464
|
+
const decode$F = (attrs) => {
|
|
24386
24465
|
const { tabSize } = attrs || {};
|
|
24387
24466
|
return tabSize;
|
|
24388
24467
|
};
|
|
24389
|
-
const attrConfig$
|
|
24468
|
+
const attrConfig$w = Object.freeze({
|
|
24390
24469
|
xmlName: "w:val",
|
|
24391
24470
|
sdName: "tabSize",
|
|
24392
|
-
encode: encode$
|
|
24393
|
-
decode: decode$
|
|
24471
|
+
encode: encode$O,
|
|
24472
|
+
decode: decode$F
|
|
24394
24473
|
});
|
|
24395
|
-
const encode$
|
|
24474
|
+
const encode$N = (attributes) => {
|
|
24396
24475
|
return attributes["w:leader"];
|
|
24397
24476
|
};
|
|
24398
|
-
const decode$
|
|
24477
|
+
const decode$E = (attrs) => {
|
|
24399
24478
|
const { leader } = attrs || {};
|
|
24400
24479
|
return leader;
|
|
24401
24480
|
};
|
|
24402
|
-
const attrConfig$
|
|
24481
|
+
const attrConfig$v = Object.freeze({
|
|
24403
24482
|
xmlName: "w:leader",
|
|
24404
24483
|
sdName: "leader",
|
|
24405
|
-
encode: encode$
|
|
24406
|
-
decode: decode$
|
|
24484
|
+
encode: encode$N,
|
|
24485
|
+
decode: decode$E
|
|
24407
24486
|
});
|
|
24408
|
-
const encode$
|
|
24487
|
+
const encode$M = (attributes) => {
|
|
24409
24488
|
return attributes["w:pos"];
|
|
24410
24489
|
};
|
|
24411
|
-
const decode$
|
|
24490
|
+
const decode$D = (attrs) => {
|
|
24412
24491
|
const { pos } = attrs || {};
|
|
24413
24492
|
return pos;
|
|
24414
24493
|
};
|
|
24415
|
-
const attrConfig$
|
|
24494
|
+
const attrConfig$u = Object.freeze({
|
|
24416
24495
|
xmlName: "w:pos",
|
|
24417
24496
|
sdName: "pos",
|
|
24418
|
-
encode: encode$
|
|
24419
|
-
decode: decode$
|
|
24497
|
+
encode: encode$M,
|
|
24498
|
+
decode: decode$D
|
|
24420
24499
|
});
|
|
24421
|
-
const validXmlAttributes$
|
|
24422
|
-
const XML_NODE_NAME$
|
|
24500
|
+
const validXmlAttributes$f = [attrConfig$w, attrConfig$u, attrConfig$v];
|
|
24501
|
+
const XML_NODE_NAME$h = "w:tab";
|
|
24423
24502
|
const SD_NODE_NAME$5 = "tab";
|
|
24424
|
-
const encode$
|
|
24503
|
+
const encode$L = (_2, encodedAttrs = {}) => {
|
|
24425
24504
|
const translated = { type: "tab" };
|
|
24426
24505
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
24427
24506
|
return translated;
|
|
24428
24507
|
};
|
|
24429
|
-
const decode$
|
|
24508
|
+
const decode$C = (params2, decodedAttrs = {}) => {
|
|
24430
24509
|
const { node } = params2 || {};
|
|
24431
24510
|
if (!node) return;
|
|
24432
24511
|
const wTab = { name: "w:tab" };
|
|
@@ -24442,15 +24521,15 @@ const decode$d = (params2, decodedAttrs = {}) => {
|
|
|
24442
24521
|
}
|
|
24443
24522
|
return translated;
|
|
24444
24523
|
};
|
|
24445
|
-
const config$
|
|
24446
|
-
xmlName: XML_NODE_NAME$
|
|
24524
|
+
const config$h = {
|
|
24525
|
+
xmlName: XML_NODE_NAME$h,
|
|
24447
24526
|
sdNodeOrKeyName: SD_NODE_NAME$5,
|
|
24448
24527
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24449
|
-
encode: encode$
|
|
24450
|
-
decode: decode$
|
|
24451
|
-
attributes: validXmlAttributes$
|
|
24528
|
+
encode: encode$L,
|
|
24529
|
+
decode: decode$C,
|
|
24530
|
+
attributes: validXmlAttributes$f
|
|
24452
24531
|
};
|
|
24453
|
-
const translator$
|
|
24532
|
+
const translator$t = NodeTranslator.from(config$h);
|
|
24454
24533
|
const mergeTextNodes = (nodes) => {
|
|
24455
24534
|
if (!nodes || !Array.isArray(nodes)) {
|
|
24456
24535
|
return nodes;
|
|
@@ -24625,17 +24704,21 @@ function getMarkValue(markType, attributes, docx) {
|
|
|
24625
24704
|
function getFontFamilyValue(attributes, docx) {
|
|
24626
24705
|
const ascii = attributes["w:ascii"];
|
|
24627
24706
|
const themeAscii = attributes["w:asciiTheme"];
|
|
24628
|
-
|
|
24629
|
-
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
|
|
24638
|
-
|
|
24707
|
+
let resolved = ascii;
|
|
24708
|
+
if (docx && themeAscii) {
|
|
24709
|
+
const theme = docx["word/theme/theme1.xml"];
|
|
24710
|
+
if (theme?.elements?.length) {
|
|
24711
|
+
const { elements: topElements } = theme;
|
|
24712
|
+
const { elements } = topElements[0] || {};
|
|
24713
|
+
const themeElements = elements?.find((el) => el.name === "a:themeElements");
|
|
24714
|
+
const fontScheme = themeElements?.elements?.find((el) => el.name === "a:fontScheme");
|
|
24715
|
+
const majorFont = fontScheme?.elements?.find((el) => el.name === "a:majorFont");
|
|
24716
|
+
const latin = majorFont?.elements?.find((el) => el.name === "a:latin");
|
|
24717
|
+
resolved = latin?.attributes?.typeface || resolved;
|
|
24718
|
+
}
|
|
24719
|
+
}
|
|
24720
|
+
if (!resolved) return null;
|
|
24721
|
+
return SuperConverter.toCssFontFamily(resolved, docx);
|
|
24639
24722
|
}
|
|
24640
24723
|
function getIndentValue(attributes) {
|
|
24641
24724
|
let value = attributes["w:left"];
|
|
@@ -24656,7 +24739,11 @@ function getHighLightValue(attributes) {
|
|
|
24656
24739
|
return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
|
|
24657
24740
|
}
|
|
24658
24741
|
function getStrikeValue(attributes) {
|
|
24659
|
-
|
|
24742
|
+
const raw = attributes?.["w:val"];
|
|
24743
|
+
if (raw === void 0 || raw === null) return "1";
|
|
24744
|
+
const value = String(raw).trim().toLowerCase();
|
|
24745
|
+
if (value === "1" || value === "true" || value === "on") return "1";
|
|
24746
|
+
return null;
|
|
24660
24747
|
}
|
|
24661
24748
|
const parseParagraphBorders = (pBdr) => {
|
|
24662
24749
|
if (!pBdr || !pBdr.elements) return {};
|
|
@@ -25020,102 +25107,102 @@ const handleParagraphNode$1 = (params2) => {
|
|
|
25020
25107
|
}
|
|
25021
25108
|
return schemaNode;
|
|
25022
25109
|
};
|
|
25023
|
-
const encode$
|
|
25110
|
+
const encode$K = (attributes) => {
|
|
25024
25111
|
return attributes["w:rsidDel"];
|
|
25025
25112
|
};
|
|
25026
|
-
const decode$
|
|
25113
|
+
const decode$B = (attrs) => {
|
|
25027
25114
|
return attrs.rsidDel;
|
|
25028
25115
|
};
|
|
25029
|
-
const attrConfig$
|
|
25116
|
+
const attrConfig$t = Object.freeze({
|
|
25030
25117
|
xmlName: "w:rsidDel",
|
|
25031
25118
|
sdName: "rsidDel",
|
|
25032
|
-
encode: encode$
|
|
25033
|
-
decode: decode$
|
|
25119
|
+
encode: encode$K,
|
|
25120
|
+
decode: decode$B
|
|
25034
25121
|
});
|
|
25035
|
-
const encode$
|
|
25122
|
+
const encode$J = (attributes) => {
|
|
25036
25123
|
return attributes["w:rsidP"];
|
|
25037
25124
|
};
|
|
25038
|
-
const decode$
|
|
25125
|
+
const decode$A = (attrs) => {
|
|
25039
25126
|
return attrs.rsidP;
|
|
25040
25127
|
};
|
|
25041
|
-
const attrConfig$
|
|
25128
|
+
const attrConfig$s = Object.freeze({
|
|
25042
25129
|
xmlName: "w:rsidP",
|
|
25043
25130
|
sdName: "rsidP",
|
|
25044
|
-
encode: encode$
|
|
25045
|
-
decode: decode$
|
|
25131
|
+
encode: encode$J,
|
|
25132
|
+
decode: decode$A
|
|
25046
25133
|
});
|
|
25047
|
-
const encode$
|
|
25134
|
+
const encode$I = (attributes) => {
|
|
25048
25135
|
return attributes["w:rsidR"];
|
|
25049
25136
|
};
|
|
25050
|
-
const decode$
|
|
25137
|
+
const decode$z = (attrs) => {
|
|
25051
25138
|
return attrs.rsidR;
|
|
25052
25139
|
};
|
|
25053
|
-
const attrConfig$
|
|
25140
|
+
const attrConfig$r = Object.freeze({
|
|
25054
25141
|
xmlName: "w:rsidR",
|
|
25055
25142
|
sdName: "rsidR",
|
|
25056
|
-
encode: encode$
|
|
25057
|
-
decode: decode$
|
|
25143
|
+
encode: encode$I,
|
|
25144
|
+
decode: decode$z
|
|
25058
25145
|
});
|
|
25059
|
-
const encode$
|
|
25146
|
+
const encode$H = (attributes) => {
|
|
25060
25147
|
return attributes["w:rsidRPr"];
|
|
25061
25148
|
};
|
|
25062
|
-
const decode$
|
|
25149
|
+
const decode$y = (attrs) => {
|
|
25063
25150
|
return attrs.rsidRPr;
|
|
25064
25151
|
};
|
|
25065
|
-
const attrConfig$
|
|
25152
|
+
const attrConfig$q = Object.freeze({
|
|
25066
25153
|
xmlName: "w:rsidRPr",
|
|
25067
25154
|
sdName: "rsidRPr",
|
|
25068
|
-
encode: encode$
|
|
25069
|
-
decode: decode$
|
|
25155
|
+
encode: encode$H,
|
|
25156
|
+
decode: decode$y
|
|
25070
25157
|
});
|
|
25071
|
-
const encode$
|
|
25158
|
+
const encode$G = (attributes) => {
|
|
25072
25159
|
return attributes["w:rsidRDefault"];
|
|
25073
25160
|
};
|
|
25074
|
-
const decode$
|
|
25161
|
+
const decode$x = (attrs) => {
|
|
25075
25162
|
return attrs.rsidRDefault;
|
|
25076
25163
|
};
|
|
25077
|
-
const attrConfig$
|
|
25164
|
+
const attrConfig$p = Object.freeze({
|
|
25078
25165
|
xmlName: "w:rsidRDefault",
|
|
25079
25166
|
sdName: "rsidRDefault",
|
|
25080
|
-
encode: encode$
|
|
25081
|
-
decode: decode$
|
|
25167
|
+
encode: encode$G,
|
|
25168
|
+
decode: decode$x
|
|
25082
25169
|
});
|
|
25083
|
-
const encode$
|
|
25170
|
+
const encode$F = (attributes) => {
|
|
25084
25171
|
return attributes["w14:paraId"];
|
|
25085
25172
|
};
|
|
25086
|
-
const decode$
|
|
25173
|
+
const decode$w = (attrs) => {
|
|
25087
25174
|
return attrs.paraId;
|
|
25088
25175
|
};
|
|
25089
|
-
const attrConfig$
|
|
25176
|
+
const attrConfig$o = Object.freeze({
|
|
25090
25177
|
xmlName: "w14:paraId",
|
|
25091
25178
|
sdName: "paraId",
|
|
25092
|
-
encode: encode$
|
|
25093
|
-
decode: decode$
|
|
25179
|
+
encode: encode$F,
|
|
25180
|
+
decode: decode$w
|
|
25094
25181
|
});
|
|
25095
|
-
const encode$
|
|
25182
|
+
const encode$E = (attributes) => {
|
|
25096
25183
|
return attributes["w14:textId"];
|
|
25097
25184
|
};
|
|
25098
|
-
const decode$
|
|
25185
|
+
const decode$v = (attrs) => {
|
|
25099
25186
|
return attrs.textId;
|
|
25100
25187
|
};
|
|
25101
|
-
const attrConfig = Object.freeze({
|
|
25188
|
+
const attrConfig$n = Object.freeze({
|
|
25102
25189
|
xmlName: "w14:textId",
|
|
25103
25190
|
sdName: "textId",
|
|
25104
|
-
encode: encode$
|
|
25105
|
-
decode: decode$
|
|
25191
|
+
encode: encode$E,
|
|
25192
|
+
decode: decode$v
|
|
25106
25193
|
});
|
|
25107
|
-
const validXmlAttributes$
|
|
25108
|
-
attrConfig$
|
|
25109
|
-
attrConfig,
|
|
25110
|
-
attrConfig$
|
|
25111
|
-
attrConfig$
|
|
25112
|
-
attrConfig$
|
|
25113
|
-
attrConfig$
|
|
25114
|
-
attrConfig$
|
|
25194
|
+
const validXmlAttributes$e = [
|
|
25195
|
+
attrConfig$o,
|
|
25196
|
+
attrConfig$n,
|
|
25197
|
+
attrConfig$r,
|
|
25198
|
+
attrConfig$p,
|
|
25199
|
+
attrConfig$s,
|
|
25200
|
+
attrConfig$q,
|
|
25201
|
+
attrConfig$t
|
|
25115
25202
|
];
|
|
25116
|
-
const XML_NODE_NAME$
|
|
25203
|
+
const XML_NODE_NAME$g = "w:p";
|
|
25117
25204
|
const SD_NODE_NAME$4 = "paragraph";
|
|
25118
|
-
const encode$
|
|
25205
|
+
const encode$D = (params2, encodedAttrs = {}) => {
|
|
25119
25206
|
const node = handleParagraphNode$1(params2);
|
|
25120
25207
|
if (!node) return void 0;
|
|
25121
25208
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -25123,7 +25210,7 @@ const encode$5 = (params2, encodedAttrs = {}) => {
|
|
|
25123
25210
|
}
|
|
25124
25211
|
return node;
|
|
25125
25212
|
};
|
|
25126
|
-
const decode$
|
|
25213
|
+
const decode$u = (params2, decodedAttrs = {}) => {
|
|
25127
25214
|
const translated = translateParagraphNode(params2);
|
|
25128
25215
|
if (!translated) return void 0;
|
|
25129
25216
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -25131,15 +25218,15 @@ const decode$5 = (params2, decodedAttrs = {}) => {
|
|
|
25131
25218
|
}
|
|
25132
25219
|
return translated;
|
|
25133
25220
|
};
|
|
25134
|
-
const config$
|
|
25135
|
-
xmlName: XML_NODE_NAME$
|
|
25221
|
+
const config$g = {
|
|
25222
|
+
xmlName: XML_NODE_NAME$g,
|
|
25136
25223
|
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
25137
25224
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25138
|
-
encode: encode$
|
|
25139
|
-
decode: decode$
|
|
25140
|
-
attributes: validXmlAttributes$
|
|
25225
|
+
encode: encode$D,
|
|
25226
|
+
decode: decode$u,
|
|
25227
|
+
attributes: validXmlAttributes$e
|
|
25141
25228
|
};
|
|
25142
|
-
const translator$
|
|
25229
|
+
const translator$s = NodeTranslator.from(config$g);
|
|
25143
25230
|
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
25144
25231
|
handlerName,
|
|
25145
25232
|
handler: (params2) => {
|
|
@@ -25246,13 +25333,13 @@ const integerToString = (value) => {
|
|
|
25246
25333
|
const intValue = parseInteger(value);
|
|
25247
25334
|
return intValue != void 0 ? String(intValue) : void 0;
|
|
25248
25335
|
};
|
|
25249
|
-
const translator$
|
|
25336
|
+
const translator$r = NodeTranslator.from({
|
|
25250
25337
|
xmlName: "w:cantSplit",
|
|
25251
25338
|
sdNodeOrKeyName: "cantSplit",
|
|
25252
25339
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25253
25340
|
decode: ({ node }) => node.attrs?.cantSplit ? {} : void 0
|
|
25254
25341
|
});
|
|
25255
|
-
const translator$
|
|
25342
|
+
const translator$q = NodeTranslator.from({
|
|
25256
25343
|
xmlName: "w:cnfStyle",
|
|
25257
25344
|
sdNodeOrKeyName: "cnfStyle",
|
|
25258
25345
|
attributes: [
|
|
@@ -25285,8 +25372,8 @@ const translator$f = NodeTranslator.from({
|
|
|
25285
25372
|
return Object.keys(cnfStyleAttrs).length > 0 ? cnfStyleAttrs : void 0;
|
|
25286
25373
|
}
|
|
25287
25374
|
});
|
|
25288
|
-
const translator$
|
|
25289
|
-
const translator$
|
|
25375
|
+
const translator$p = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
25376
|
+
const translator$o = NodeTranslator.from(
|
|
25290
25377
|
createSingleAttrPropertyHandler(
|
|
25291
25378
|
"w:gridAfter",
|
|
25292
25379
|
null,
|
|
@@ -25295,7 +25382,7 @@ const translator$d = NodeTranslator.from(
|
|
|
25295
25382
|
(v2) => integerToString(v2)
|
|
25296
25383
|
)
|
|
25297
25384
|
);
|
|
25298
|
-
const translator$
|
|
25385
|
+
const translator$n = NodeTranslator.from(
|
|
25299
25386
|
createSingleAttrPropertyHandler(
|
|
25300
25387
|
"w:gridBefore",
|
|
25301
25388
|
null,
|
|
@@ -25304,21 +25391,21 @@ const translator$c = NodeTranslator.from(
|
|
|
25304
25391
|
(v2) => integerToString(v2)
|
|
25305
25392
|
)
|
|
25306
25393
|
);
|
|
25307
|
-
const translator$
|
|
25394
|
+
const translator$m = NodeTranslator.from({
|
|
25308
25395
|
xmlName: "w:hidden",
|
|
25309
25396
|
sdNodeOrKeyName: "hidden",
|
|
25310
25397
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25311
25398
|
decode: ({ node }) => node.attrs.hidden ? {} : void 0
|
|
25312
25399
|
});
|
|
25313
|
-
const translator$
|
|
25314
|
-
const translator$
|
|
25315
|
-
const translator$
|
|
25400
|
+
const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc"));
|
|
25401
|
+
const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "cellSpacing"));
|
|
25402
|
+
const translator$j = NodeTranslator.from({
|
|
25316
25403
|
xmlName: "w:tblHeader",
|
|
25317
25404
|
sdNodeOrKeyName: "repeatHeader",
|
|
25318
25405
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25319
25406
|
decode: ({ node }) => node.attrs.repeatHeader ? {} : void 0
|
|
25320
25407
|
});
|
|
25321
|
-
const translator$
|
|
25408
|
+
const translator$i = NodeTranslator.from({
|
|
25322
25409
|
xmlName: "w:trHeight",
|
|
25323
25410
|
sdNodeOrKeyName: "rowHeight",
|
|
25324
25411
|
encode: ({ nodes }) => {
|
|
@@ -25345,11 +25432,11 @@ const translator$7 = NodeTranslator.from({
|
|
|
25345
25432
|
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
25346
25433
|
}
|
|
25347
25434
|
});
|
|
25348
|
-
const translator$
|
|
25349
|
-
const translator$
|
|
25350
|
-
const XML_NODE_NAME$
|
|
25351
|
-
const SD_ATTR_KEY = "tableRowProperties";
|
|
25352
|
-
const encode$
|
|
25435
|
+
const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
25436
|
+
const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
25437
|
+
const XML_NODE_NAME$f = "w:trPr";
|
|
25438
|
+
const SD_ATTR_KEY$a = "tableRowProperties";
|
|
25439
|
+
const encode$C = (params2) => {
|
|
25353
25440
|
const { nodes } = params2;
|
|
25354
25441
|
const node = nodes[0];
|
|
25355
25442
|
let attributes = {
|
|
@@ -25363,12 +25450,12 @@ const encode$4 = (params2) => {
|
|
|
25363
25450
|
};
|
|
25364
25451
|
return {
|
|
25365
25452
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25366
|
-
xmlName: XML_NODE_NAME$
|
|
25367
|
-
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
25453
|
+
xmlName: XML_NODE_NAME$f,
|
|
25454
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25368
25455
|
attributes
|
|
25369
25456
|
};
|
|
25370
25457
|
};
|
|
25371
|
-
const decode$
|
|
25458
|
+
const decode$t = (params2) => {
|
|
25372
25459
|
const { tableRowProperties = {} } = params2.node.attrs || {};
|
|
25373
25460
|
const elements = decodeProperties(propertyTranslatorsBySdName, tableRowProperties);
|
|
25374
25461
|
const newNode = {
|
|
@@ -25380,18 +25467,18 @@ const decode$4 = (params2) => {
|
|
|
25380
25467
|
return newNode;
|
|
25381
25468
|
};
|
|
25382
25469
|
const propertyTranslators = [
|
|
25383
|
-
translator$
|
|
25384
|
-
translator$
|
|
25385
|
-
translator$
|
|
25386
|
-
translator$
|
|
25387
|
-
translator$
|
|
25388
|
-
translator$
|
|
25389
|
-
translator$
|
|
25390
|
-
translator$
|
|
25391
|
-
translator$
|
|
25392
|
-
translator$
|
|
25393
|
-
translator$
|
|
25394
|
-
translator$
|
|
25470
|
+
translator$r,
|
|
25471
|
+
translator$q,
|
|
25472
|
+
translator$p,
|
|
25473
|
+
translator$o,
|
|
25474
|
+
translator$n,
|
|
25475
|
+
translator$m,
|
|
25476
|
+
translator$l,
|
|
25477
|
+
translator$k,
|
|
25478
|
+
translator$j,
|
|
25479
|
+
translator$i,
|
|
25480
|
+
translator$h,
|
|
25481
|
+
translator$g
|
|
25395
25482
|
];
|
|
25396
25483
|
const propertyTranslatorsByXmlName = {};
|
|
25397
25484
|
propertyTranslators.forEach((translator2) => {
|
|
@@ -25401,25 +25488,25 @@ const propertyTranslatorsBySdName = {};
|
|
|
25401
25488
|
propertyTranslators.forEach((translator2) => {
|
|
25402
25489
|
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
25403
25490
|
});
|
|
25404
|
-
const config$
|
|
25405
|
-
xmlName: XML_NODE_NAME$
|
|
25406
|
-
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
25491
|
+
const config$f = {
|
|
25492
|
+
xmlName: XML_NODE_NAME$f,
|
|
25493
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
25407
25494
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25408
|
-
encode: encode$
|
|
25409
|
-
decode: decode$
|
|
25495
|
+
encode: encode$C,
|
|
25496
|
+
decode: decode$t
|
|
25410
25497
|
};
|
|
25411
|
-
const translator$
|
|
25412
|
-
const XML_NODE_NAME$
|
|
25498
|
+
const translator$f = NodeTranslator.from(config$f);
|
|
25499
|
+
const XML_NODE_NAME$e = "w:tr";
|
|
25413
25500
|
const SD_NODE_NAME$3 = "tableRow";
|
|
25414
|
-
const validXmlAttributes$
|
|
25501
|
+
const validXmlAttributes$d = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
25415
25502
|
(xmlName) => createAttributeHandler(xmlName)
|
|
25416
25503
|
);
|
|
25417
|
-
const encode$
|
|
25504
|
+
const encode$B = (params2, encodedAttrs) => {
|
|
25418
25505
|
const { row, table } = params2.extraParams;
|
|
25419
25506
|
let tableRowProperties = {};
|
|
25420
25507
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
25421
25508
|
if (tPr) {
|
|
25422
|
-
({ attributes: tableRowProperties } = translator$
|
|
25509
|
+
({ attributes: tableRowProperties } = translator$f.encode({
|
|
25423
25510
|
...params2,
|
|
25424
25511
|
nodes: [tPr]
|
|
25425
25512
|
}));
|
|
@@ -25432,7 +25519,7 @@ const encode$3 = (params2, encodedAttrs) => {
|
|
|
25432
25519
|
let currentColumnIndex = 0;
|
|
25433
25520
|
const content = cellNodes?.map((n) => {
|
|
25434
25521
|
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
25435
|
-
const result = translator$
|
|
25522
|
+
const result = translator$d.encode({
|
|
25436
25523
|
...params2,
|
|
25437
25524
|
extraParams: {
|
|
25438
25525
|
...params2.extraParams,
|
|
@@ -25463,7 +25550,7 @@ const _getGridColumnWidths = (tableNode) => {
|
|
|
25463
25550
|
}) || [];
|
|
25464
25551
|
return columnWidths;
|
|
25465
25552
|
};
|
|
25466
|
-
const decode$
|
|
25553
|
+
const decode$s = (params2, decodedAttrs) => {
|
|
25467
25554
|
const { node } = params2;
|
|
25468
25555
|
const elements = translateChildNodes(params2);
|
|
25469
25556
|
if (node.attrs?.tableRowProperties) {
|
|
@@ -25475,7 +25562,7 @@ const decode$3 = (params2, decodedAttrs) => {
|
|
|
25475
25562
|
}
|
|
25476
25563
|
}
|
|
25477
25564
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
25478
|
-
const trPr = translator$
|
|
25565
|
+
const trPr = translator$f.decode({
|
|
25479
25566
|
...params2,
|
|
25480
25567
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
25481
25568
|
});
|
|
@@ -25487,15 +25574,15 @@ const decode$3 = (params2, decodedAttrs) => {
|
|
|
25487
25574
|
elements
|
|
25488
25575
|
};
|
|
25489
25576
|
};
|
|
25490
|
-
const config$
|
|
25491
|
-
xmlName: XML_NODE_NAME$
|
|
25577
|
+
const config$e = {
|
|
25578
|
+
xmlName: XML_NODE_NAME$e,
|
|
25492
25579
|
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
25493
25580
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25494
|
-
encode: encode$
|
|
25495
|
-
decode: decode$
|
|
25496
|
-
attributes: validXmlAttributes$
|
|
25581
|
+
encode: encode$B,
|
|
25582
|
+
decode: decode$s,
|
|
25583
|
+
attributes: validXmlAttributes$d
|
|
25497
25584
|
};
|
|
25498
|
-
const translator$
|
|
25585
|
+
const translator$e = NodeTranslator.from(config$e);
|
|
25499
25586
|
const handleAllTableNodes = (params2) => {
|
|
25500
25587
|
const { nodes } = params2;
|
|
25501
25588
|
if (nodes.length === 0) {
|
|
@@ -25559,7 +25646,7 @@ function handleTableNode(node, params2) {
|
|
|
25559
25646
|
attrs["borders"] = borderData;
|
|
25560
25647
|
const content = [];
|
|
25561
25648
|
rows.forEach((row) => {
|
|
25562
|
-
const result = translator$
|
|
25649
|
+
const result = translator$e.encode({
|
|
25563
25650
|
...params2,
|
|
25564
25651
|
nodes: [row],
|
|
25565
25652
|
extraParams: {
|
|
@@ -25940,10 +26027,10 @@ function generateCellMargins(cellMargins) {
|
|
|
25940
26027
|
if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
|
|
25941
26028
|
return elements;
|
|
25942
26029
|
}
|
|
25943
|
-
const XML_NODE_NAME$
|
|
26030
|
+
const XML_NODE_NAME$d = "w:tc";
|
|
25944
26031
|
const SD_NODE_NAME$2 = "tableCell";
|
|
25945
|
-
const validXmlAttributes$
|
|
25946
|
-
function encode$
|
|
26032
|
+
const validXmlAttributes$c = [];
|
|
26033
|
+
function encode$A(params2, encodedAttrs) {
|
|
25947
26034
|
const { node, table, row, rowBorders, styleTag, columnIndex, columnWidth } = params2.extraParams;
|
|
25948
26035
|
const schemaNode = handleTableCellNode({
|
|
25949
26036
|
params: params2,
|
|
@@ -25960,23 +26047,23 @@ function encode$2(params2, encodedAttrs) {
|
|
|
25960
26047
|
}
|
|
25961
26048
|
return schemaNode;
|
|
25962
26049
|
}
|
|
25963
|
-
function decode$
|
|
26050
|
+
function decode$r(params2, decodedAttrs) {
|
|
25964
26051
|
const translated = translateTableCell(params2);
|
|
25965
26052
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
25966
26053
|
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
25967
26054
|
}
|
|
25968
26055
|
return translated;
|
|
25969
26056
|
}
|
|
25970
|
-
const config$
|
|
25971
|
-
xmlName: XML_NODE_NAME$
|
|
26057
|
+
const config$d = {
|
|
26058
|
+
xmlName: XML_NODE_NAME$d,
|
|
25972
26059
|
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
25973
26060
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25974
|
-
encode: encode$
|
|
25975
|
-
decode: decode$
|
|
25976
|
-
attributes: validXmlAttributes$
|
|
26061
|
+
encode: encode$A,
|
|
26062
|
+
decode: decode$r,
|
|
26063
|
+
attributes: validXmlAttributes$c
|
|
25977
26064
|
};
|
|
25978
|
-
const translator$
|
|
25979
|
-
const XML_NODE_NAME$
|
|
26065
|
+
const translator$d = NodeTranslator.from(config$d);
|
|
26066
|
+
const XML_NODE_NAME$c = "w:hyperlink";
|
|
25980
26067
|
const SD_NODE_NAME$1 = "link";
|
|
25981
26068
|
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
25982
26069
|
xmlName,
|
|
@@ -25984,7 +26071,7 @@ const _createAttributeHandler = (xmlName, sdName) => ({
|
|
|
25984
26071
|
encode: (attributes) => attributes[xmlName],
|
|
25985
26072
|
decode: (attributes) => attributes[sdName]
|
|
25986
26073
|
});
|
|
25987
|
-
const validXmlAttributes$
|
|
26074
|
+
const validXmlAttributes$b = [
|
|
25988
26075
|
_createAttributeHandler("w:anchor", "anchor"),
|
|
25989
26076
|
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
25990
26077
|
{
|
|
@@ -25997,7 +26084,7 @@ const validXmlAttributes$1 = [
|
|
|
25997
26084
|
_createAttributeHandler("r:id", "rId"),
|
|
25998
26085
|
_createAttributeHandler("w:tgtFrame", "target")
|
|
25999
26086
|
];
|
|
26000
|
-
const encode$
|
|
26087
|
+
const encode$z = (params2, encodedAttrs) => {
|
|
26001
26088
|
const { nodes, docx, nodeListHandler } = params2;
|
|
26002
26089
|
const node = nodes[0];
|
|
26003
26090
|
let href = _resolveHref(docx, encodedAttrs);
|
|
@@ -26011,7 +26098,16 @@ const encode$1 = (params2, encodedAttrs) => {
|
|
|
26011
26098
|
nodes: runNodes,
|
|
26012
26099
|
path: [...params2.path || [], node]
|
|
26013
26100
|
});
|
|
26014
|
-
|
|
26101
|
+
const ensureLinkMark = (child) => {
|
|
26102
|
+
if (!child || typeof child !== "object") return child;
|
|
26103
|
+
const existingMarks = Array.isArray(child.marks) ? child.marks : [];
|
|
26104
|
+
const hasLink = existingMarks.some((mark) => mark?.type === "link");
|
|
26105
|
+
if (hasLink) return child;
|
|
26106
|
+
const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
|
|
26107
|
+
return { ...child, marks: [...existingMarks, linkClone] };
|
|
26108
|
+
};
|
|
26109
|
+
if (!Array.isArray(updatedNode)) return updatedNode;
|
|
26110
|
+
return updatedNode.map((child) => ensureLinkMark(child));
|
|
26015
26111
|
};
|
|
26016
26112
|
const _resolveHref = (docx, encodedAttrs) => {
|
|
26017
26113
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
@@ -26028,7 +26124,7 @@ const _resolveHref = (docx, encodedAttrs) => {
|
|
|
26028
26124
|
}
|
|
26029
26125
|
return href;
|
|
26030
26126
|
};
|
|
26031
|
-
function decode$
|
|
26127
|
+
function decode$q(params2) {
|
|
26032
26128
|
const { node } = params2;
|
|
26033
26129
|
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
26034
26130
|
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
@@ -26072,15 +26168,15 @@ function _addNewLinkRelationship(params2, link, rId) {
|
|
|
26072
26168
|
});
|
|
26073
26169
|
return rId;
|
|
26074
26170
|
}
|
|
26075
|
-
const config$
|
|
26076
|
-
xmlName: XML_NODE_NAME$
|
|
26171
|
+
const config$c = {
|
|
26172
|
+
xmlName: XML_NODE_NAME$c,
|
|
26077
26173
|
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
26078
26174
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26079
|
-
encode: encode$
|
|
26080
|
-
decode: decode$
|
|
26081
|
-
attributes: validXmlAttributes$
|
|
26175
|
+
encode: encode$z,
|
|
26176
|
+
decode: decode$q,
|
|
26177
|
+
attributes: validXmlAttributes$b
|
|
26082
26178
|
};
|
|
26083
|
-
const translator$
|
|
26179
|
+
const translator$c = NodeTranslator.from(config$c);
|
|
26084
26180
|
function parseTagValueJSON(json) {
|
|
26085
26181
|
if (typeof json !== "string") {
|
|
26086
26182
|
return {};
|
|
@@ -26091,7 +26187,7 @@ function parseTagValueJSON(json) {
|
|
|
26091
26187
|
}
|
|
26092
26188
|
try {
|
|
26093
26189
|
return JSON.parse(trimmed);
|
|
26094
|
-
} catch
|
|
26190
|
+
} catch {
|
|
26095
26191
|
return {};
|
|
26096
26192
|
}
|
|
26097
26193
|
}
|
|
@@ -27893,10 +27989,10 @@ function translateStructuredContent(params2) {
|
|
|
27893
27989
|
};
|
|
27894
27990
|
return result;
|
|
27895
27991
|
}
|
|
27896
|
-
const XML_NODE_NAME = "w:sdt";
|
|
27992
|
+
const XML_NODE_NAME$b = "w:sdt";
|
|
27897
27993
|
const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
27898
|
-
const validXmlAttributes = [];
|
|
27899
|
-
function encode$
|
|
27994
|
+
const validXmlAttributes$a = [];
|
|
27995
|
+
function encode$y(params2) {
|
|
27900
27996
|
const nodes = params2.nodes;
|
|
27901
27997
|
const node = nodes[0];
|
|
27902
27998
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -27906,7 +28002,7 @@ function encode$k(params2, encodedAttrs) {
|
|
|
27906
28002
|
const result = handler2(params2);
|
|
27907
28003
|
return result;
|
|
27908
28004
|
}
|
|
27909
|
-
function decode(params2
|
|
28005
|
+
function decode$p(params2) {
|
|
27910
28006
|
const { node } = params2;
|
|
27911
28007
|
if (!node || !node.type) {
|
|
27912
28008
|
return null;
|
|
@@ -27922,43 +28018,138 @@ function decode(params2, decodedAttrs) {
|
|
|
27922
28018
|
const result = decoder();
|
|
27923
28019
|
return result;
|
|
27924
28020
|
}
|
|
27925
|
-
const config = {
|
|
27926
|
-
xmlName: XML_NODE_NAME,
|
|
28021
|
+
const config$b = {
|
|
28022
|
+
xmlName: XML_NODE_NAME$b,
|
|
27927
28023
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
27928
28024
|
type: NodeTranslator.translatorTypes.NODE,
|
|
27929
|
-
encode: encode$
|
|
27930
|
-
decode,
|
|
27931
|
-
attributes: validXmlAttributes
|
|
28025
|
+
encode: encode$y,
|
|
28026
|
+
decode: decode$p,
|
|
28027
|
+
attributes: validXmlAttributes$a
|
|
28028
|
+
};
|
|
28029
|
+
const translator$b = NodeTranslator.from(config$b);
|
|
28030
|
+
const encode$x = (attributes) => attributes?.["w:val"];
|
|
28031
|
+
const decode$o = (attrs) => attrs?.underline;
|
|
28032
|
+
const attrConfig$m = Object.freeze({
|
|
28033
|
+
xmlName: "w:val",
|
|
28034
|
+
sdName: "underline",
|
|
28035
|
+
encode: encode$x,
|
|
28036
|
+
decode: decode$o
|
|
28037
|
+
});
|
|
28038
|
+
const encode$w = (attributes) => attributes?.["w:color"];
|
|
28039
|
+
const decode$n = (attrs) => attrs?.color;
|
|
28040
|
+
const attrConfig$l = Object.freeze({
|
|
28041
|
+
xmlName: "w:color",
|
|
28042
|
+
sdName: "color",
|
|
28043
|
+
encode: encode$w,
|
|
28044
|
+
decode: decode$n
|
|
28045
|
+
});
|
|
28046
|
+
const encode$v = (attributes) => attributes?.["w:themeColor"];
|
|
28047
|
+
const decode$m = (attrs) => attrs?.themeColor;
|
|
28048
|
+
const attrConfig$k = Object.freeze({
|
|
28049
|
+
xmlName: "w:themeColor",
|
|
28050
|
+
sdName: "themeColor",
|
|
28051
|
+
encode: encode$v,
|
|
28052
|
+
decode: decode$m
|
|
28053
|
+
});
|
|
28054
|
+
const encode$u = (attributes) => attributes?.["w:themeTint"];
|
|
28055
|
+
const decode$l = (attrs) => attrs?.themeTint;
|
|
28056
|
+
const attrConfig$j = Object.freeze({
|
|
28057
|
+
xmlName: "w:themeTint",
|
|
28058
|
+
sdName: "themeTint",
|
|
28059
|
+
encode: encode$u,
|
|
28060
|
+
decode: decode$l
|
|
28061
|
+
});
|
|
28062
|
+
const encode$t = (attributes) => attributes?.["w:themeShade"];
|
|
28063
|
+
const decode$k = (attrs) => attrs?.themeShade;
|
|
28064
|
+
const attrConfig$i = Object.freeze({
|
|
28065
|
+
xmlName: "w:themeShade",
|
|
28066
|
+
sdName: "themeShade",
|
|
28067
|
+
encode: encode$t,
|
|
28068
|
+
decode: decode$k
|
|
28069
|
+
});
|
|
28070
|
+
const validXmlAttributes$9 = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
28071
|
+
const XML_NODE_NAME$a = "w:u";
|
|
28072
|
+
const SD_ATTR_KEY$9 = "underline";
|
|
28073
|
+
const encode$s = (params2, encodedAttrs = {}) => {
|
|
28074
|
+
const { nodes } = params2;
|
|
28075
|
+
const node = nodes?.[0];
|
|
28076
|
+
const sourceAttrs = node?.attributes || {};
|
|
28077
|
+
const underlineType = encodedAttrs.underline ?? sourceAttrs["w:val"];
|
|
28078
|
+
const color = encodedAttrs.color ?? sourceAttrs["w:color"];
|
|
28079
|
+
const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
|
|
28080
|
+
const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
|
|
28081
|
+
const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
|
|
28082
|
+
const attributes = { "w:val": underlineType ?? null };
|
|
28083
|
+
if (color !== void 0 && color !== null) attributes["w:color"] = color;
|
|
28084
|
+
if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
|
|
28085
|
+
if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
|
|
28086
|
+
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
28087
|
+
return {
|
|
28088
|
+
type: "attr",
|
|
28089
|
+
xmlName: XML_NODE_NAME$a,
|
|
28090
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
28091
|
+
attributes
|
|
28092
|
+
};
|
|
27932
28093
|
};
|
|
27933
|
-
const
|
|
28094
|
+
const decode$j = (params2) => {
|
|
28095
|
+
const attrs = params2?.node?.attrs || {};
|
|
28096
|
+
const underlineType = attrs.underlineType ?? attrs.underline ?? null;
|
|
28097
|
+
const color = attrs.underlineColor ?? attrs.color ?? null;
|
|
28098
|
+
const themeColor = attrs.underlineThemeColor ?? attrs.themeColor ?? null;
|
|
28099
|
+
const themeTint = attrs.underlineThemeTint ?? attrs.themeTint ?? null;
|
|
28100
|
+
const themeShade = attrs.underlineThemeShade ?? attrs.themeShade ?? null;
|
|
28101
|
+
if (!underlineType && !color && !themeColor && !themeTint && !themeShade) return void 0;
|
|
28102
|
+
const attributes = {};
|
|
28103
|
+
if (underlineType) attributes["w:val"] = underlineType;
|
|
28104
|
+
if (color) {
|
|
28105
|
+
const normalized = normalizeHexColor(color);
|
|
28106
|
+
if (normalized) attributes["w:color"] = normalized;
|
|
28107
|
+
}
|
|
28108
|
+
if (themeColor) attributes["w:themeColor"] = themeColor;
|
|
28109
|
+
if (themeTint) attributes["w:themeTint"] = themeTint;
|
|
28110
|
+
if (themeShade) attributes["w:themeShade"] = themeShade;
|
|
28111
|
+
return {
|
|
28112
|
+
name: XML_NODE_NAME$a,
|
|
28113
|
+
attributes
|
|
28114
|
+
};
|
|
28115
|
+
};
|
|
28116
|
+
const config$a = {
|
|
28117
|
+
xmlName: XML_NODE_NAME$a,
|
|
28118
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
28119
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
28120
|
+
encode: encode$s,
|
|
28121
|
+
decode: decode$j,
|
|
28122
|
+
attributes: validXmlAttributes$9
|
|
28123
|
+
};
|
|
28124
|
+
const translator$a = NodeTranslator.from(config$a);
|
|
27934
28125
|
function exportSchemaToJson(params2) {
|
|
27935
28126
|
const { type: type2 } = params2.node || {};
|
|
27936
28127
|
const router = {
|
|
27937
28128
|
doc: translateDocumentNode,
|
|
27938
28129
|
body: translateBodyNode,
|
|
27939
28130
|
heading: translateHeadingNode,
|
|
27940
|
-
paragraph: translator$
|
|
28131
|
+
paragraph: translator$s,
|
|
27941
28132
|
text: translateTextNode,
|
|
27942
28133
|
bulletList: translateList,
|
|
27943
28134
|
orderedList: translateList,
|
|
27944
|
-
lineBreak: translator$
|
|
28135
|
+
lineBreak: translator$v,
|
|
27945
28136
|
table: translateTable,
|
|
27946
|
-
tableRow: translator$
|
|
27947
|
-
tableCell: translator$
|
|
28137
|
+
tableRow: translator$e,
|
|
28138
|
+
tableCell: translator$d,
|
|
27948
28139
|
bookmarkStart: translateBookmarkStart,
|
|
27949
|
-
fieldAnnotation: translator,
|
|
27950
|
-
tab: translator$
|
|
28140
|
+
fieldAnnotation: translator$b,
|
|
28141
|
+
tab: translator$t,
|
|
27951
28142
|
image: translateImageNode,
|
|
27952
|
-
hardBreak: translator$
|
|
28143
|
+
hardBreak: translator$v,
|
|
27953
28144
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
27954
28145
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
27955
28146
|
commentReference: () => null,
|
|
27956
28147
|
shapeContainer: translateShapeContainer,
|
|
27957
28148
|
shapeTextbox: translateShapeTextbox,
|
|
27958
28149
|
contentBlock: translateContentBlock,
|
|
27959
|
-
structuredContent: translator,
|
|
27960
|
-
structuredContentBlock: translator,
|
|
27961
|
-
documentSection: translator,
|
|
28150
|
+
structuredContent: translator$b,
|
|
28151
|
+
structuredContentBlock: translator$b,
|
|
28152
|
+
documentSection: translator$b,
|
|
27962
28153
|
"page-number": translatePageNumberNode,
|
|
27963
28154
|
"total-page-number": translateTotalPageNumberNode
|
|
27964
28155
|
};
|
|
@@ -28281,7 +28472,7 @@ function translateTextNode(params2) {
|
|
|
28281
28472
|
const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
|
|
28282
28473
|
if (isTrackedNode) return translateTrackedNode(params2);
|
|
28283
28474
|
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
28284
|
-
if (isLinkNode) return translator$
|
|
28475
|
+
if (isLinkNode) return translator$c.decode(params2);
|
|
28285
28476
|
const { text, marks = [] } = node;
|
|
28286
28477
|
return getTextNodeForExport(text, marks, params2);
|
|
28287
28478
|
}
|
|
@@ -28766,10 +28957,20 @@ function translateMark(mark) {
|
|
|
28766
28957
|
delete markElement.attributes;
|
|
28767
28958
|
markElement.type = "element";
|
|
28768
28959
|
break;
|
|
28769
|
-
case "underline":
|
|
28770
|
-
|
|
28771
|
-
|
|
28772
|
-
|
|
28960
|
+
case "underline": {
|
|
28961
|
+
const translated = translator$a.decode({
|
|
28962
|
+
node: {
|
|
28963
|
+
attrs: {
|
|
28964
|
+
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
28965
|
+
underlineColor: attrs.underlineColor ?? attrs.color ?? null,
|
|
28966
|
+
underlineThemeColor: attrs.underlineThemeColor ?? attrs.themeColor ?? null,
|
|
28967
|
+
underlineThemeTint: attrs.underlineThemeTint ?? attrs.themeTint ?? null,
|
|
28968
|
+
underlineThemeShade: attrs.underlineThemeShade ?? attrs.themeShade ?? null
|
|
28969
|
+
}
|
|
28970
|
+
}
|
|
28971
|
+
});
|
|
28972
|
+
return translated || {};
|
|
28973
|
+
}
|
|
28773
28974
|
// Text style cases
|
|
28774
28975
|
case "fontSize":
|
|
28775
28976
|
value = attrs.fontSize;
|
|
@@ -28811,12 +29012,11 @@ function translateMark(mark) {
|
|
|
28811
29012
|
case "lineHeight":
|
|
28812
29013
|
markElement.attributes["w:line"] = linesToTwips(attrs.lineHeight);
|
|
28813
29014
|
break;
|
|
28814
|
-
case "highlight":
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
break;
|
|
29015
|
+
case "highlight": {
|
|
29016
|
+
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
29017
|
+
const translated = translator$u.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
29018
|
+
return translated || {};
|
|
29019
|
+
}
|
|
28820
29020
|
}
|
|
28821
29021
|
return markElement;
|
|
28822
29022
|
}
|
|
@@ -29684,82 +29884,912 @@ const trackChangeNodeHandlerEntity = {
|
|
|
29684
29884
|
handlerName: "trackChangeNodeHandler",
|
|
29685
29885
|
handler: handleTrackChangeNode
|
|
29686
29886
|
};
|
|
29687
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
29688
|
-
const
|
|
29689
|
-
const
|
|
29690
|
-
if (
|
|
29691
|
-
|
|
29692
|
-
|
|
29887
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$c);
|
|
29888
|
+
const encode$r = (attributes) => {
|
|
29889
|
+
const raw = attributes?.["w:val"];
|
|
29890
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
29891
|
+
if (typeof raw === "boolean") return raw;
|
|
29892
|
+
if (typeof raw === "number") return raw !== 0;
|
|
29893
|
+
const val = String(raw).trim().toLowerCase();
|
|
29894
|
+
if (val === "0" || val === "false" || val === "off") return false;
|
|
29895
|
+
if (val === "1" || val === "true" || val === "on") return true;
|
|
29896
|
+
return void 0;
|
|
29897
|
+
};
|
|
29898
|
+
const decode$i = (runProps) => {
|
|
29899
|
+
if (runProps?.bold === false) return "0";
|
|
29900
|
+
return void 0;
|
|
29901
|
+
};
|
|
29902
|
+
const attrConfig$h = Object.freeze({
|
|
29903
|
+
xmlName: "w:val",
|
|
29904
|
+
sdName: "bold",
|
|
29905
|
+
encode: encode$r,
|
|
29906
|
+
decode: decode$i
|
|
29907
|
+
});
|
|
29908
|
+
const validXmlAttributes$8 = [attrConfig$h];
|
|
29909
|
+
const XML_NODE_NAME$9 = "w:b";
|
|
29910
|
+
const SD_ATTR_KEY$8 = "bold";
|
|
29911
|
+
const encode$q = (params2, encodedAttrs = {}) => {
|
|
29912
|
+
const { nodes } = params2;
|
|
29693
29913
|
const node = nodes[0];
|
|
29694
|
-
|
|
29695
|
-
|
|
29696
|
-
|
|
29697
|
-
|
|
29698
|
-
if (
|
|
29699
|
-
|
|
29700
|
-
|
|
29701
|
-
|
|
29702
|
-
|
|
29703
|
-
|
|
29704
|
-
|
|
29705
|
-
|
|
29706
|
-
|
|
29707
|
-
|
|
29708
|
-
|
|
29709
|
-
|
|
29710
|
-
|
|
29711
|
-
|
|
29712
|
-
|
|
29713
|
-
|
|
29714
|
-
|
|
29715
|
-
|
|
29716
|
-
|
|
29717
|
-
|
|
29718
|
-
|
|
29719
|
-
|
|
29720
|
-
|
|
29721
|
-
|
|
29722
|
-
|
|
29723
|
-
|
|
29724
|
-
|
|
29725
|
-
|
|
29914
|
+
if (!node) return void 0;
|
|
29915
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$8];
|
|
29916
|
+
let attributes;
|
|
29917
|
+
if (val === false) attributes = { "w:val": "0" };
|
|
29918
|
+
else if (val === true)
|
|
29919
|
+
attributes = {};
|
|
29920
|
+
else attributes = node.attributes || {};
|
|
29921
|
+
return {
|
|
29922
|
+
type: "attr",
|
|
29923
|
+
xmlName: XML_NODE_NAME$9,
|
|
29924
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
29925
|
+
attributes
|
|
29926
|
+
};
|
|
29927
|
+
};
|
|
29928
|
+
const config$9 = {
|
|
29929
|
+
xmlName: XML_NODE_NAME$9,
|
|
29930
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
29931
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
29932
|
+
encode: encode$q,
|
|
29933
|
+
attributes: validXmlAttributes$8
|
|
29934
|
+
};
|
|
29935
|
+
const translator$9 = NodeTranslator.from(config$9);
|
|
29936
|
+
const encode$p = (attributes) => {
|
|
29937
|
+
const raw = attributes?.["w:val"];
|
|
29938
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
29939
|
+
if (typeof raw === "boolean") return raw;
|
|
29940
|
+
if (typeof raw === "number") return raw !== 0;
|
|
29941
|
+
const val = String(raw).trim().toLowerCase();
|
|
29942
|
+
if (val === "0" || val === "false" || val === "off") return false;
|
|
29943
|
+
if (val === "1" || val === "true" || val === "on") return true;
|
|
29944
|
+
return void 0;
|
|
29945
|
+
};
|
|
29946
|
+
const decode$h = (attrs) => {
|
|
29947
|
+
if (attrs?.italic === false) return "0";
|
|
29948
|
+
return void 0;
|
|
29949
|
+
};
|
|
29950
|
+
const attrConfig$g = Object.freeze({
|
|
29951
|
+
xmlName: "w:val",
|
|
29952
|
+
sdName: "italic",
|
|
29953
|
+
encode: encode$p,
|
|
29954
|
+
decode: decode$h
|
|
29955
|
+
});
|
|
29956
|
+
const validXmlAttributes$7 = [attrConfig$g];
|
|
29957
|
+
const XML_NODE_NAME$8 = "w:i";
|
|
29958
|
+
const SD_ATTR_KEY$7 = "italic";
|
|
29959
|
+
const encode$o = (params2, encodedAttrs = {}) => {
|
|
29960
|
+
const { nodes } = params2;
|
|
29961
|
+
const node = nodes?.[0];
|
|
29962
|
+
if (!node) return void 0;
|
|
29963
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$7];
|
|
29964
|
+
let attributes;
|
|
29965
|
+
if (val === false) attributes = { "w:val": "0" };
|
|
29966
|
+
else if (val === true) attributes = {};
|
|
29967
|
+
else attributes = { ...node.attributes || {} };
|
|
29968
|
+
if (attributes["w:val"] === void 0 && val !== true) attributes["w:val"] = null;
|
|
29969
|
+
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
29970
|
+
return {
|
|
29971
|
+
type: "attr",
|
|
29972
|
+
xmlName: XML_NODE_NAME$8,
|
|
29973
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
29974
|
+
attributes
|
|
29975
|
+
};
|
|
29976
|
+
};
|
|
29977
|
+
const config$8 = {
|
|
29978
|
+
xmlName: XML_NODE_NAME$8,
|
|
29979
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
29980
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
29981
|
+
encode: encode$o,
|
|
29982
|
+
attributes: validXmlAttributes$7
|
|
29983
|
+
};
|
|
29984
|
+
const translator$8 = NodeTranslator.from(config$8);
|
|
29985
|
+
const encode$n = (attributes) => {
|
|
29986
|
+
const raw = attributes?.["w:val"];
|
|
29987
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
29988
|
+
if (typeof raw === "boolean") return raw;
|
|
29989
|
+
if (typeof raw === "number") return raw !== 0;
|
|
29990
|
+
const val = String(raw).trim().toLowerCase();
|
|
29991
|
+
if (val === "0" || val === "false" || val === "off") return false;
|
|
29992
|
+
if (val === "1" || val === "true" || val === "on") return true;
|
|
29993
|
+
return void 0;
|
|
29994
|
+
};
|
|
29995
|
+
const decode$g = (attrs) => {
|
|
29996
|
+
if (attrs?.strike === false) return "0";
|
|
29997
|
+
return void 0;
|
|
29998
|
+
};
|
|
29999
|
+
const attrConfig$f = Object.freeze({
|
|
30000
|
+
xmlName: "w:val",
|
|
30001
|
+
sdName: "strike",
|
|
30002
|
+
encode: encode$n,
|
|
30003
|
+
decode: decode$g
|
|
30004
|
+
});
|
|
30005
|
+
const validXmlAttributes$6 = [attrConfig$f];
|
|
30006
|
+
const XML_NODE_NAME$7 = "w:strike";
|
|
30007
|
+
const SD_ATTR_KEY$6 = "strike";
|
|
30008
|
+
const encode$m = (params2, encodedAttrs = {}) => {
|
|
30009
|
+
const { nodes } = params2;
|
|
30010
|
+
const node = nodes?.[0];
|
|
30011
|
+
if (!node) return void 0;
|
|
30012
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$6];
|
|
30013
|
+
let attributes;
|
|
30014
|
+
if (val === false) attributes = { "w:val": "0" };
|
|
30015
|
+
else if (val === true) attributes = {};
|
|
30016
|
+
else attributes = { ...node.attributes || {} };
|
|
30017
|
+
if (attributes["w:val"] === void 0 && val !== true) attributes["w:val"] = null;
|
|
30018
|
+
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
30019
|
+
return {
|
|
30020
|
+
type: "attr",
|
|
30021
|
+
xmlName: XML_NODE_NAME$7,
|
|
30022
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
30023
|
+
attributes
|
|
30024
|
+
};
|
|
30025
|
+
};
|
|
30026
|
+
const config$7 = {
|
|
30027
|
+
xmlName: XML_NODE_NAME$7,
|
|
30028
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
30029
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
30030
|
+
encode: encode$m,
|
|
30031
|
+
attributes: validXmlAttributes$6
|
|
30032
|
+
};
|
|
30033
|
+
const translator$7 = NodeTranslator.from(config$7);
|
|
30034
|
+
const encode$l = (attributes) => attributes?.["w:val"];
|
|
30035
|
+
const decode$f = (attrs) => attrs?.color;
|
|
30036
|
+
const attrConfig$e = Object.freeze({
|
|
30037
|
+
xmlName: "w:val",
|
|
30038
|
+
sdName: "color",
|
|
30039
|
+
encode: encode$l,
|
|
30040
|
+
decode: decode$f
|
|
30041
|
+
});
|
|
30042
|
+
const encode$k = (attributes) => attributes?.["w:themeColor"];
|
|
30043
|
+
const decode$e = (attrs) => attrs?.themeColor;
|
|
30044
|
+
const attrConfig$d = Object.freeze({
|
|
30045
|
+
xmlName: "w:themeColor",
|
|
30046
|
+
sdName: "themeColor",
|
|
30047
|
+
encode: encode$k,
|
|
30048
|
+
decode: decode$e
|
|
30049
|
+
});
|
|
30050
|
+
const encode$j = (attributes) => attributes?.["w:themeTint"];
|
|
30051
|
+
const decode$d = (attrs) => attrs?.themeTint;
|
|
30052
|
+
const attrConfig$c = Object.freeze({
|
|
30053
|
+
xmlName: "w:themeTint",
|
|
30054
|
+
sdName: "themeTint",
|
|
30055
|
+
encode: encode$j,
|
|
30056
|
+
decode: decode$d
|
|
30057
|
+
});
|
|
30058
|
+
const encode$i = (attributes) => attributes?.["w:themeShade"];
|
|
30059
|
+
const decode$c = (attrs) => attrs?.themeShade;
|
|
30060
|
+
const attrConfig$b = Object.freeze({
|
|
30061
|
+
xmlName: "w:themeShade",
|
|
30062
|
+
sdName: "themeShade",
|
|
30063
|
+
encode: encode$i,
|
|
30064
|
+
decode: decode$c
|
|
30065
|
+
});
|
|
30066
|
+
const validXmlAttributes$5 = [attrConfig$e, attrConfig$d, attrConfig$c, attrConfig$b];
|
|
30067
|
+
const XML_NODE_NAME$6 = "w:color";
|
|
30068
|
+
const SD_ATTR_KEY$5 = "color";
|
|
30069
|
+
const encode$h = (params2, encodedAttrs = {}) => {
|
|
30070
|
+
const { nodes } = params2;
|
|
30071
|
+
const node = nodes?.[0];
|
|
30072
|
+
const sourceAttrs = node?.attributes || {};
|
|
30073
|
+
const value = encodedAttrs.color ?? sourceAttrs["w:val"];
|
|
30074
|
+
const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
|
|
30075
|
+
const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
|
|
30076
|
+
const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
|
|
30077
|
+
const attributes = {};
|
|
30078
|
+
attributes["w:val"] = value ?? null;
|
|
30079
|
+
if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
|
|
30080
|
+
if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
|
|
30081
|
+
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
30082
|
+
return {
|
|
30083
|
+
type: "attr",
|
|
30084
|
+
xmlName: XML_NODE_NAME$6,
|
|
30085
|
+
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
30086
|
+
attributes
|
|
30087
|
+
};
|
|
30088
|
+
};
|
|
30089
|
+
const config$6 = {
|
|
30090
|
+
xmlName: XML_NODE_NAME$6,
|
|
30091
|
+
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
30092
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
30093
|
+
encode: encode$h,
|
|
30094
|
+
attributes: validXmlAttributes$5
|
|
30095
|
+
};
|
|
30096
|
+
const translator$6 = NodeTranslator.from(config$6);
|
|
30097
|
+
const encode$g = (attributes) => attributes?.["w:eastAsia"];
|
|
30098
|
+
const decode$b = (attrs) => attrs?.eastAsia;
|
|
30099
|
+
const attrConfig$a = Object.freeze({
|
|
30100
|
+
xmlName: "w:eastAsia",
|
|
30101
|
+
sdName: "eastAsia",
|
|
30102
|
+
encode: encode$g,
|
|
30103
|
+
decode: decode$b
|
|
30104
|
+
});
|
|
30105
|
+
const encode$f = (attributes) => attributes?.["w:ascii"];
|
|
30106
|
+
const decode$a = (attrs) => attrs?.ascii;
|
|
30107
|
+
const attrConfig$9 = Object.freeze({
|
|
30108
|
+
xmlName: "w:ascii",
|
|
30109
|
+
sdName: "ascii",
|
|
30110
|
+
encode: encode$f,
|
|
30111
|
+
decode: decode$a
|
|
30112
|
+
});
|
|
30113
|
+
const encode$e = (attributes) => attributes?.["w:hAnsi"];
|
|
30114
|
+
const decode$9 = (attrs) => attrs?.hAnsi;
|
|
30115
|
+
const attrConfig$8 = Object.freeze({
|
|
30116
|
+
xmlName: "w:hAnsi",
|
|
30117
|
+
sdName: "hAnsi",
|
|
30118
|
+
encode: encode$e,
|
|
30119
|
+
decode: decode$9
|
|
30120
|
+
});
|
|
30121
|
+
const encode$d = (attributes) => attributes?.["w:cs"];
|
|
30122
|
+
const decode$8 = (attrs) => attrs?.cs;
|
|
30123
|
+
const attrConfig$7 = Object.freeze({
|
|
30124
|
+
xmlName: "w:cs",
|
|
30125
|
+
sdName: "cs",
|
|
30126
|
+
encode: encode$d,
|
|
30127
|
+
decode: decode$8
|
|
30128
|
+
});
|
|
30129
|
+
const encode$c = (attributes) => attributes?.["w:val"];
|
|
30130
|
+
const decode$7 = (attrs) => attrs?.value;
|
|
30131
|
+
const attrConfig$6 = Object.freeze({
|
|
30132
|
+
xmlName: "w:val",
|
|
30133
|
+
sdName: "value",
|
|
30134
|
+
encode: encode$c,
|
|
30135
|
+
decode: decode$7
|
|
30136
|
+
});
|
|
30137
|
+
const validXmlAttributes$4 = [attrConfig$a, attrConfig$9, attrConfig$8, attrConfig$7, attrConfig$6];
|
|
30138
|
+
const XML_NODE_NAME$5 = "w:rFonts";
|
|
30139
|
+
const SD_ATTR_KEY$4 = "fontFamily";
|
|
30140
|
+
const encode$b = (params2, encodedAttrs = {}) => {
|
|
30141
|
+
const { nodes } = params2;
|
|
30142
|
+
const node = nodes?.[0];
|
|
30143
|
+
const sourceAttrs = node?.attributes || {};
|
|
30144
|
+
const attributes = {};
|
|
30145
|
+
const setAttr = (xmlName, sdName) => {
|
|
30146
|
+
if (encodedAttrs[sdName] !== void 0 && encodedAttrs[sdName] !== null) {
|
|
30147
|
+
attributes[xmlName] = encodedAttrs[sdName];
|
|
30148
|
+
} else if (sourceAttrs[xmlName] !== void 0) {
|
|
30149
|
+
attributes[xmlName] = sourceAttrs[xmlName];
|
|
30150
|
+
}
|
|
30151
|
+
};
|
|
30152
|
+
setAttr("w:eastAsia", "eastAsia");
|
|
30153
|
+
setAttr("w:ascii", "ascii");
|
|
30154
|
+
setAttr("w:hAnsi", "hAnsi");
|
|
30155
|
+
setAttr("w:cs", "cs");
|
|
30156
|
+
setAttr("w:val", "value");
|
|
30157
|
+
Object.keys(sourceAttrs).forEach((key) => {
|
|
30158
|
+
if (attributes[key] === void 0) attributes[key] = sourceAttrs[key];
|
|
30159
|
+
});
|
|
30160
|
+
if (attributes["w:val"] === void 0 && attributes["w:eastAsia"]) {
|
|
30161
|
+
attributes["w:val"] = attributes["w:eastAsia"];
|
|
30162
|
+
}
|
|
30163
|
+
if (attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
30164
|
+
return {
|
|
30165
|
+
type: "attr",
|
|
30166
|
+
xmlName: XML_NODE_NAME$5,
|
|
30167
|
+
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
30168
|
+
attributes
|
|
30169
|
+
};
|
|
30170
|
+
};
|
|
30171
|
+
const config$5 = {
|
|
30172
|
+
xmlName: XML_NODE_NAME$5,
|
|
30173
|
+
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
30174
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
30175
|
+
encode: encode$b,
|
|
30176
|
+
attributes: validXmlAttributes$4
|
|
30177
|
+
};
|
|
30178
|
+
const translator$5 = NodeTranslator.from(config$5);
|
|
30179
|
+
const encode$a = (attributes) => attributes?.["w:val"];
|
|
30180
|
+
const decode$6 = (attrs) => attrs?.styleId;
|
|
30181
|
+
const attrConfig$5 = Object.freeze({
|
|
30182
|
+
xmlName: "w:val",
|
|
30183
|
+
sdName: "styleId",
|
|
30184
|
+
encode: encode$a,
|
|
30185
|
+
decode: decode$6
|
|
30186
|
+
});
|
|
30187
|
+
const validXmlAttributes$3 = [attrConfig$5];
|
|
30188
|
+
const XML_NODE_NAME$4 = "w:rStyle";
|
|
30189
|
+
const SD_ATTR_KEY$3 = "styleId";
|
|
30190
|
+
const encode$9 = (params2, encodedAttrs = {}) => {
|
|
30191
|
+
const { nodes } = params2;
|
|
30192
|
+
const node = nodes?.[0];
|
|
30193
|
+
const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
|
|
30194
|
+
return {
|
|
30195
|
+
type: "attr",
|
|
30196
|
+
xmlName: XML_NODE_NAME$4,
|
|
30197
|
+
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
30198
|
+
attributes: { "w:val": value ?? null }
|
|
30199
|
+
};
|
|
30200
|
+
};
|
|
30201
|
+
const config$4 = {
|
|
30202
|
+
xmlName: XML_NODE_NAME$4,
|
|
30203
|
+
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
30204
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
30205
|
+
encode: encode$9,
|
|
30206
|
+
attributes: validXmlAttributes$3
|
|
30207
|
+
};
|
|
30208
|
+
const translator$4 = NodeTranslator.from(config$4);
|
|
30209
|
+
const encode$8 = (attributes) => attributes?.["w:val"];
|
|
30210
|
+
const decode$5 = (attrs) => attrs?.fontSize;
|
|
30211
|
+
const attrConfig$4 = Object.freeze({
|
|
30212
|
+
xmlName: "w:val",
|
|
30213
|
+
sdName: "fontSize",
|
|
30214
|
+
encode: encode$8,
|
|
30215
|
+
decode: decode$5
|
|
30216
|
+
});
|
|
30217
|
+
const validXmlAttributes$2 = [attrConfig$4];
|
|
30218
|
+
const XML_NODE_NAME$3 = "w:sz";
|
|
30219
|
+
const SD_ATTR_KEY$2 = "fontSize";
|
|
30220
|
+
const encode$7 = (params2, encodedAttrs = {}) => {
|
|
30221
|
+
const { nodes } = params2;
|
|
30222
|
+
const node = nodes?.[0];
|
|
30223
|
+
const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
|
|
30224
|
+
return {
|
|
30225
|
+
type: "attr",
|
|
30226
|
+
xmlName: XML_NODE_NAME$3,
|
|
30227
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
30228
|
+
attributes: { "w:val": value ?? null }
|
|
30229
|
+
};
|
|
30230
|
+
};
|
|
30231
|
+
const config$3 = {
|
|
30232
|
+
xmlName: XML_NODE_NAME$3,
|
|
30233
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
30234
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
30235
|
+
encode: encode$7,
|
|
30236
|
+
attributes: validXmlAttributes$2
|
|
30237
|
+
};
|
|
30238
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
30239
|
+
const encode$6 = (attributes) => attributes?.["w:val"];
|
|
30240
|
+
const decode$4 = (attrs) => attrs?.fontSizeCs;
|
|
30241
|
+
const attrConfig$3 = Object.freeze({
|
|
30242
|
+
xmlName: "w:val",
|
|
30243
|
+
sdName: "fontSizeCs",
|
|
30244
|
+
encode: encode$6,
|
|
30245
|
+
decode: decode$4
|
|
30246
|
+
});
|
|
30247
|
+
const validXmlAttributes$1 = [attrConfig$3];
|
|
30248
|
+
const XML_NODE_NAME$2 = "w:szCs";
|
|
30249
|
+
const SD_ATTR_KEY$1 = "fontSizeCs";
|
|
30250
|
+
const encode$5 = (params2, encodedAttrs = {}) => {
|
|
30251
|
+
const { nodes } = params2;
|
|
30252
|
+
const node = nodes?.[0];
|
|
30253
|
+
const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
|
|
30254
|
+
return {
|
|
30255
|
+
type: "attr",
|
|
30256
|
+
xmlName: XML_NODE_NAME$2,
|
|
30257
|
+
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
30258
|
+
attributes: { "w:val": value ?? null }
|
|
30259
|
+
};
|
|
30260
|
+
};
|
|
30261
|
+
const config$2 = {
|
|
30262
|
+
xmlName: XML_NODE_NAME$2,
|
|
30263
|
+
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
30264
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
30265
|
+
encode: encode$5,
|
|
30266
|
+
attributes: validXmlAttributes$1
|
|
30267
|
+
};
|
|
30268
|
+
const translator$2 = NodeTranslator.from(config$2);
|
|
30269
|
+
const runPropertyTranslators = Object.freeze({
|
|
30270
|
+
"w:b": translator$9,
|
|
30271
|
+
"w:i": translator$8,
|
|
30272
|
+
"w:u": translator$a,
|
|
30273
|
+
"w:strike": translator$7,
|
|
30274
|
+
"w:color": translator$6,
|
|
30275
|
+
"w:highlight": translator$u,
|
|
30276
|
+
"w:rFonts": translator$5,
|
|
30277
|
+
"w:rStyle": translator$4,
|
|
30278
|
+
"w:sz": translator$3,
|
|
30279
|
+
"w:szCs": translator$2
|
|
30280
|
+
});
|
|
30281
|
+
const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
|
|
30282
|
+
const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
|
|
30283
|
+
const KNOWN_CHILD_XML_NAMES = /* @__PURE__ */ new Set([...Object.keys(runPropertyTranslators), ...RAW_CHILD_NAME_SET]);
|
|
30284
|
+
const toRunPropertyEntry = (candidate) => {
|
|
30285
|
+
if (!candidate || candidate.type !== "attr") return null;
|
|
30286
|
+
const xmlName = candidate.xmlName || candidate.name;
|
|
30287
|
+
if (!xmlName) return null;
|
|
30288
|
+
return {
|
|
30289
|
+
xmlName,
|
|
30290
|
+
attributes: { ...candidate.attributes || {} }
|
|
30291
|
+
};
|
|
30292
|
+
};
|
|
30293
|
+
const XML_NODE_NAME$1 = "w:rPr";
|
|
30294
|
+
const SD_ATTR_KEY = "runProperties";
|
|
30295
|
+
const encode$4 = (params2) => {
|
|
30296
|
+
const { nodes } = params2;
|
|
30297
|
+
const node = nodes?.[0] || {};
|
|
30298
|
+
const contents = Array.isArray(node.elements) ? node.elements : [];
|
|
30299
|
+
const runPropsArray = contents.reduce(
|
|
30300
|
+
(acc, child) => {
|
|
30301
|
+
if (!child || typeof child !== "object") return acc;
|
|
30302
|
+
const xmlName = child.name;
|
|
30303
|
+
if (!KNOWN_CHILD_XML_NAMES.has(xmlName)) return acc;
|
|
30304
|
+
const translator2 = runPropertyTranslators[xmlName];
|
|
30305
|
+
let entry = null;
|
|
30306
|
+
if (translator2) {
|
|
30307
|
+
const encoded = translator2.encode({ ...params2, nodes: [child] }) || null;
|
|
30308
|
+
entry = toRunPropertyEntry(encoded);
|
|
30309
|
+
} else if (RAW_CHILD_NAME_SET.has(xmlName)) {
|
|
30310
|
+
entry = toRunPropertyEntry({
|
|
30311
|
+
type: "attr",
|
|
30312
|
+
xmlName,
|
|
30313
|
+
attributes: { ...child.attributes || {} }
|
|
30314
|
+
});
|
|
29726
30315
|
}
|
|
30316
|
+
if (entry) acc.push(entry);
|
|
30317
|
+
return acc;
|
|
30318
|
+
},
|
|
30319
|
+
/** @type {{ xmlName: string, attributes: Record<string, any> }[]} */
|
|
30320
|
+
[]
|
|
30321
|
+
);
|
|
30322
|
+
return {
|
|
30323
|
+
type: "attr",
|
|
30324
|
+
xmlName: "w:rPr",
|
|
30325
|
+
sdNodeOrKeyName: "runProperties",
|
|
30326
|
+
attributes: runPropsArray
|
|
30327
|
+
};
|
|
30328
|
+
};
|
|
30329
|
+
const config$1 = {
|
|
30330
|
+
xmlName: XML_NODE_NAME$1,
|
|
30331
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
30332
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
30333
|
+
encode: encode$4
|
|
30334
|
+
};
|
|
30335
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
30336
|
+
const collectRunProperties = (params2, rPrNode, translator2 = translator$1) => {
|
|
30337
|
+
if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
|
|
30338
|
+
const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
|
|
30339
|
+
let entries = [];
|
|
30340
|
+
if (Array.isArray(result.attributes) && result.attributes.length) {
|
|
30341
|
+
entries = result.attributes.map((attr) => ({
|
|
30342
|
+
xmlName: attr?.xmlName,
|
|
30343
|
+
attributes: { ...attr?.attributes || {} }
|
|
30344
|
+
}));
|
|
30345
|
+
} else if (Array.isArray(rPrNode.elements) && rPrNode.elements.length) {
|
|
30346
|
+
entries = rPrNode.elements.filter((el) => el && typeof el === "object").map((el) => ({
|
|
30347
|
+
xmlName: el.name,
|
|
30348
|
+
attributes: { ...el.attributes || {} }
|
|
30349
|
+
}));
|
|
30350
|
+
}
|
|
30351
|
+
const legacyMarks = parseMarks(rPrNode, [], params2?.docx) || [];
|
|
30352
|
+
const styleChangeMarks = handleStyleChangeMarks(rPrNode, legacyMarks) || [];
|
|
30353
|
+
return { entries, hadRPr: true, styleChangeMarks };
|
|
30354
|
+
};
|
|
30355
|
+
const buildRunAttrs = (encodedAttrs = {}, hadRPr, runProps) => {
|
|
30356
|
+
const base2 = { ...encodedAttrs || {} };
|
|
30357
|
+
if (hadRPr) {
|
|
30358
|
+
base2.runProperties = runProps.length ? runProps : null;
|
|
30359
|
+
}
|
|
30360
|
+
return base2;
|
|
30361
|
+
};
|
|
30362
|
+
const ensureRunMark = (marks, runAttrs) => {
|
|
30363
|
+
if (!runAttrs) return;
|
|
30364
|
+
const runMark = createRunMark(runAttrs);
|
|
30365
|
+
const runMarkIndex = marks.findIndex((mark) => mark?.type === "run");
|
|
30366
|
+
if (runMarkIndex >= 0) {
|
|
30367
|
+
const existing = marks[runMarkIndex];
|
|
30368
|
+
if (runMark.attrs) {
|
|
30369
|
+
marks[runMarkIndex] = { ...existing, attrs: mergeRunAttrs(existing?.attrs, runMark.attrs) };
|
|
30370
|
+
}
|
|
30371
|
+
return;
|
|
30372
|
+
}
|
|
30373
|
+
marks.push(runMark);
|
|
30374
|
+
};
|
|
30375
|
+
const ensureInlineMarks = (marks, inlineMarks = []) => {
|
|
30376
|
+
inlineMarks.forEach(({ type: type2, attrs }) => {
|
|
30377
|
+
if (!type2) return;
|
|
30378
|
+
if (marks.some((mark) => mark?.type === type2)) return;
|
|
30379
|
+
marks.push(attrs ? { type: type2, attrs: { ...attrs } } : { type: type2 });
|
|
30380
|
+
});
|
|
30381
|
+
};
|
|
30382
|
+
const ensureTextStyleMark = (marks, textStyleAttrs) => {
|
|
30383
|
+
if (!textStyleAttrs) return;
|
|
30384
|
+
const existingTextStyle = marks.find((mark) => mark?.type === "textStyle");
|
|
30385
|
+
if (existingTextStyle) {
|
|
30386
|
+
existingTextStyle.attrs = { ...existingTextStyle.attrs || {}, ...textStyleAttrs };
|
|
30387
|
+
return;
|
|
30388
|
+
}
|
|
30389
|
+
marks.push({ type: "textStyle", attrs: { ...textStyleAttrs } });
|
|
30390
|
+
};
|
|
30391
|
+
const applyRunMarks = (node, runAttrs, inlineMarks, textStyleAttrs) => {
|
|
30392
|
+
if (!node || typeof node !== "object") return node;
|
|
30393
|
+
const baseMarks = Array.isArray(node.marks) ? node.marks : [];
|
|
30394
|
+
const marks = baseMarks.map((mark) => cloneMark(mark));
|
|
30395
|
+
ensureRunMark(marks, runAttrs);
|
|
30396
|
+
ensureInlineMarks(marks, inlineMarks);
|
|
30397
|
+
if (node.type === "text") {
|
|
30398
|
+
ensureTextStyleMark(marks, textStyleAttrs);
|
|
30399
|
+
}
|
|
30400
|
+
return { ...node, marks };
|
|
30401
|
+
};
|
|
30402
|
+
const createRunMark = (attrs = {}) => {
|
|
30403
|
+
const hasAttrs = attrs && Object.keys(attrs).length > 0;
|
|
30404
|
+
return hasAttrs ? { type: "run", attrs: cloneRunAttrs(attrs) } : { type: "run" };
|
|
30405
|
+
};
|
|
30406
|
+
const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
|
|
30407
|
+
const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
|
|
30408
|
+
const runStyleMarks = collectStyleMarks(runStyleId, docx);
|
|
30409
|
+
const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
|
|
30410
|
+
const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
|
|
30411
|
+
return { inlineMarks, textStyleAttrs };
|
|
30412
|
+
};
|
|
30413
|
+
const collectStyleMarks = (styleId, docx, seen = /* @__PURE__ */ new Set()) => {
|
|
30414
|
+
if (!styleId || !docx || seen.has(styleId)) return { inlineMarks: [], textStyleAttrs: null };
|
|
30415
|
+
seen.add(styleId);
|
|
30416
|
+
const chain = collectStyleChain(styleId, docx, seen);
|
|
30417
|
+
if (!chain.length) return { inlineMarks: [], textStyleAttrs: null };
|
|
30418
|
+
const inlineMap = /* @__PURE__ */ new Map();
|
|
30419
|
+
let textStyleAttrs = {};
|
|
30420
|
+
chain.forEach((styleTag) => {
|
|
30421
|
+
const marks = extractMarksFromStyle(styleTag, docx);
|
|
30422
|
+
marks.inlineMarks.forEach((mark) => {
|
|
30423
|
+
inlineMap.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
|
|
29727
30424
|
});
|
|
30425
|
+
if (marks.textStyleAttrs) textStyleAttrs = { ...textStyleAttrs, ...marks.textStyleAttrs };
|
|
30426
|
+
});
|
|
30427
|
+
return {
|
|
30428
|
+
inlineMarks: Array.from(inlineMap.values()),
|
|
30429
|
+
textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
|
|
30430
|
+
};
|
|
30431
|
+
};
|
|
30432
|
+
const collectStyleChain = (styleId, docx, seen) => {
|
|
30433
|
+
if (!styleId || !docx) return [];
|
|
30434
|
+
const styleTag = findStyleTag(docx, styleId);
|
|
30435
|
+
if (!styleTag || !styleTag.elements) return [];
|
|
30436
|
+
const basedOn = styleTag.elements?.find((el) => el.name === "w:basedOn")?.attributes?.["w:val"];
|
|
30437
|
+
let chain = [];
|
|
30438
|
+
if (basedOn && !seen.has(basedOn)) {
|
|
30439
|
+
seen.add(basedOn);
|
|
30440
|
+
chain = collectStyleChain(basedOn, docx, seen);
|
|
30441
|
+
}
|
|
30442
|
+
chain.push(styleTag);
|
|
30443
|
+
return chain;
|
|
30444
|
+
};
|
|
30445
|
+
const findStyleTag = (docx, styleId) => {
|
|
30446
|
+
const stylesFile = docx?.["word/styles.xml"];
|
|
30447
|
+
if (!stylesFile?.elements?.length) return null;
|
|
30448
|
+
const candidates = [];
|
|
30449
|
+
stylesFile.elements.forEach((el) => {
|
|
30450
|
+
if (!el) return;
|
|
30451
|
+
if (el.name === "w:styles" && Array.isArray(el.elements)) {
|
|
30452
|
+
el.elements.forEach((child) => {
|
|
30453
|
+
if (child?.name === "w:style") candidates.push(child);
|
|
30454
|
+
});
|
|
30455
|
+
return;
|
|
30456
|
+
}
|
|
30457
|
+
if (el.name === "w:style") {
|
|
30458
|
+
candidates.push(el);
|
|
30459
|
+
return;
|
|
30460
|
+
}
|
|
30461
|
+
if (Array.isArray(el.elements)) {
|
|
30462
|
+
el.elements.forEach((child) => {
|
|
30463
|
+
if (child?.name === "w:style") candidates.push(child);
|
|
30464
|
+
});
|
|
30465
|
+
}
|
|
30466
|
+
});
|
|
30467
|
+
return candidates.find((tag) => tag?.attributes?.["w:styleId"] === styleId) || null;
|
|
30468
|
+
};
|
|
30469
|
+
const extractMarksFromStyle = (styleTag, docx) => {
|
|
30470
|
+
const rPr = styleTag?.elements?.find((el) => el.name === "w:rPr");
|
|
30471
|
+
if (!rPr) return { inlineMarks: [], textStyleAttrs: null };
|
|
30472
|
+
const marks = parseMarks(rPr, [], docx) || [];
|
|
30473
|
+
const inlineMarks = [];
|
|
30474
|
+
let textStyleAttrs = {};
|
|
30475
|
+
marks.forEach((mark) => {
|
|
30476
|
+
if (!mark) return;
|
|
30477
|
+
if (mark.type === "textStyle") {
|
|
30478
|
+
const attrs = mark.attrs || {};
|
|
30479
|
+
if (Object.keys(attrs).length) textStyleAttrs = { ...textStyleAttrs, ...attrs };
|
|
30480
|
+
return;
|
|
30481
|
+
}
|
|
30482
|
+
if (mark.type) inlineMarks.push(mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
|
|
30483
|
+
});
|
|
30484
|
+
return {
|
|
30485
|
+
inlineMarks,
|
|
30486
|
+
textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
|
|
30487
|
+
};
|
|
30488
|
+
};
|
|
30489
|
+
const mergeInlineMarkSets = (...markSets) => {
|
|
30490
|
+
const map3 = /* @__PURE__ */ new Map();
|
|
30491
|
+
markSets.filter(Boolean).forEach((marks) => {
|
|
29728
30492
|
marks.forEach((mark) => {
|
|
29729
|
-
|
|
29730
|
-
|
|
29731
|
-
);
|
|
29732
|
-
if (!exists2) {
|
|
29733
|
-
combinedMarks.push(mark);
|
|
29734
|
-
}
|
|
30493
|
+
if (!mark || !mark.type) return;
|
|
30494
|
+
map3.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
|
|
29735
30495
|
});
|
|
29736
|
-
|
|
29737
|
-
|
|
29738
|
-
|
|
29739
|
-
|
|
29740
|
-
|
|
29741
|
-
|
|
29742
|
-
|
|
29743
|
-
|
|
29744
|
-
|
|
30496
|
+
});
|
|
30497
|
+
return Array.from(map3.values());
|
|
30498
|
+
};
|
|
30499
|
+
const mergeTextStyleAttrs = (...attrsList) => {
|
|
30500
|
+
const merged = attrsList.filter((attrs) => attrs && Object.keys(attrs).length).reduce((acc, attrs) => ({ ...acc, ...attrs }), {});
|
|
30501
|
+
return Object.keys(merged).length ? merged : null;
|
|
30502
|
+
};
|
|
30503
|
+
const cloneRunAttrs = (attrs) => {
|
|
30504
|
+
const clone = { ...attrs };
|
|
30505
|
+
if (Array.isArray(attrs?.runProperties)) {
|
|
30506
|
+
clone.runProperties = attrs.runProperties.map((entry) => ({
|
|
30507
|
+
xmlName: entry?.xmlName,
|
|
30508
|
+
attributes: { ...entry?.attributes || {} }
|
|
30509
|
+
}));
|
|
30510
|
+
}
|
|
30511
|
+
return clone;
|
|
30512
|
+
};
|
|
30513
|
+
const cloneMark = (mark) => {
|
|
30514
|
+
if (!mark || typeof mark !== "object") return mark;
|
|
30515
|
+
const cloned = { ...mark };
|
|
30516
|
+
if (mark.attrs && typeof mark.attrs === "object") {
|
|
30517
|
+
cloned.attrs = { ...mark.attrs };
|
|
30518
|
+
if (Array.isArray(mark.attrs.runProperties)) {
|
|
30519
|
+
cloned.attrs.runProperties = mark.attrs.runProperties.map((entry) => ({
|
|
30520
|
+
xmlName: entry?.xmlName,
|
|
30521
|
+
attributes: { ...entry?.attributes || {} }
|
|
30522
|
+
}));
|
|
30523
|
+
}
|
|
30524
|
+
}
|
|
30525
|
+
return cloned;
|
|
30526
|
+
};
|
|
30527
|
+
const mergeRunAttrs = (existing = {}, incoming = {}) => {
|
|
30528
|
+
const merged = { ...existing, ...cloneRunAttrs(incoming) };
|
|
30529
|
+
if (Array.isArray(existing?.runProperties) && Array.isArray(incoming?.runProperties)) {
|
|
30530
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30531
|
+
const combined = [...existing.runProperties, ...incoming.runProperties];
|
|
30532
|
+
merged.runProperties = combined.filter((entry) => {
|
|
30533
|
+
const key = entry?.xmlName;
|
|
30534
|
+
if (!key || seen.has(key)) return false;
|
|
30535
|
+
seen.add(key);
|
|
30536
|
+
return true;
|
|
29745
30537
|
});
|
|
29746
30538
|
}
|
|
29747
|
-
return
|
|
30539
|
+
return merged;
|
|
29748
30540
|
};
|
|
29749
|
-
const
|
|
29750
|
-
|
|
29751
|
-
if (
|
|
29752
|
-
|
|
30541
|
+
const normalizeBool = (value) => {
|
|
30542
|
+
if (value === void 0 || value === null) return true;
|
|
30543
|
+
if (typeof value === "boolean") return value;
|
|
30544
|
+
if (typeof value === "number") return value !== 0;
|
|
30545
|
+
const normalized = String(value).trim().toLowerCase();
|
|
30546
|
+
if (normalized === "0" || normalized === "false" || normalized === "off") return false;
|
|
30547
|
+
if (normalized === "1" || normalized === "true" || normalized === "on") return true;
|
|
30548
|
+
return true;
|
|
30549
|
+
};
|
|
30550
|
+
const resolveRunElement = (node) => {
|
|
30551
|
+
if (!node) return null;
|
|
30552
|
+
if (node.name === "w:r") return node;
|
|
30553
|
+
return (node.elements || []).find((el) => el.name === "w:r") || null;
|
|
30554
|
+
};
|
|
30555
|
+
const ensureRunPropertiesContainer = (runElement) => {
|
|
30556
|
+
if (!Array.isArray(runElement.elements)) runElement.elements = [];
|
|
30557
|
+
let rPr = runElement.elements.find((el) => el.name === "w:rPr");
|
|
30558
|
+
if (!rPr) {
|
|
30559
|
+
rPr = { name: "w:rPr", elements: [] };
|
|
30560
|
+
runElement.elements.unshift(rPr);
|
|
30561
|
+
}
|
|
30562
|
+
if (!Array.isArray(rPr.elements)) rPr.elements = [];
|
|
30563
|
+
return rPr;
|
|
30564
|
+
};
|
|
30565
|
+
const splitRunProperties = (entries = [], docx = null) => {
|
|
30566
|
+
const remainingProps = [];
|
|
30567
|
+
const inlineMarks = [];
|
|
30568
|
+
const textStyleAttrs = {};
|
|
30569
|
+
let hasTextStyle = false;
|
|
30570
|
+
let highlightColor = null;
|
|
30571
|
+
let runStyleId = null;
|
|
30572
|
+
entries.forEach((entry) => {
|
|
30573
|
+
if (!entry || !entry.xmlName) return;
|
|
30574
|
+
const attributes = entry.attributes || {};
|
|
30575
|
+
switch (entry.xmlName) {
|
|
30576
|
+
case "w:b": {
|
|
30577
|
+
const val = normalizeBool(attributes["w:val"]);
|
|
30578
|
+
inlineMarks.push(val ? { type: "bold" } : { type: "bold", attrs: { value: "0" } });
|
|
30579
|
+
break;
|
|
30580
|
+
}
|
|
30581
|
+
case "w:i": {
|
|
30582
|
+
const val = normalizeBool(attributes["w:val"]);
|
|
30583
|
+
inlineMarks.push(val ? { type: "italic" } : { type: "italic", attrs: { value: "0" } });
|
|
30584
|
+
break;
|
|
30585
|
+
}
|
|
30586
|
+
case "w:u": {
|
|
30587
|
+
const rawVal = attributes["w:val"];
|
|
30588
|
+
const underlineType = rawVal == null || rawVal === "" ? "single" : String(rawVal);
|
|
30589
|
+
const attrs = {};
|
|
30590
|
+
if (underlineType.toLowerCase() === "none" || underlineType === "0") {
|
|
30591
|
+
attrs.underlineType = "none";
|
|
30592
|
+
} else {
|
|
30593
|
+
attrs.underlineType = underlineType;
|
|
30594
|
+
const colorRaw = attributes["w:color"];
|
|
30595
|
+
if (typeof colorRaw === "string" && colorRaw.toLowerCase() !== "auto") {
|
|
30596
|
+
const normalizedColor = normalizeHexColor(colorRaw);
|
|
30597
|
+
if (normalizedColor) attrs.underlineColor = `#${normalizedColor}`;
|
|
30598
|
+
}
|
|
30599
|
+
}
|
|
30600
|
+
if (attributes["w:themeColor"]) attrs.underlineThemeColor = attributes["w:themeColor"];
|
|
30601
|
+
if (attributes["w:themeTint"]) attrs.underlineThemeTint = attributes["w:themeTint"];
|
|
30602
|
+
if (attributes["w:themeShade"]) attrs.underlineThemeShade = attributes["w:themeShade"];
|
|
30603
|
+
inlineMarks.push({ type: "underline", attrs });
|
|
30604
|
+
break;
|
|
30605
|
+
}
|
|
30606
|
+
case "w:color": {
|
|
30607
|
+
const raw = attributes["w:val"];
|
|
30608
|
+
if (typeof raw === "string" && raw) {
|
|
30609
|
+
hasTextStyle = true;
|
|
30610
|
+
textStyleAttrs.color = `#${raw.replace("#", "").toUpperCase()}`;
|
|
30611
|
+
}
|
|
30612
|
+
break;
|
|
30613
|
+
}
|
|
30614
|
+
case "w:rFonts": {
|
|
30615
|
+
const family = attributes["w:ascii"] || attributes["w:eastAsia"] || attributes["w:hAnsi"] || attributes["w:val"];
|
|
30616
|
+
if (family) {
|
|
30617
|
+
hasTextStyle = true;
|
|
30618
|
+
textStyleAttrs.fontFamily = SuperConverter.toCssFontFamily(family, docx);
|
|
30619
|
+
}
|
|
30620
|
+
break;
|
|
30621
|
+
}
|
|
30622
|
+
case "w:sz":
|
|
30623
|
+
case "w:szCs": {
|
|
30624
|
+
const rawSize = Number(attributes["w:val"]);
|
|
30625
|
+
if (Number.isFinite(rawSize) && rawSize > 0) {
|
|
30626
|
+
hasTextStyle = true;
|
|
30627
|
+
textStyleAttrs.fontSize = `${rawSize / 2}pt`;
|
|
30628
|
+
}
|
|
30629
|
+
break;
|
|
30630
|
+
}
|
|
30631
|
+
case "w:strike": {
|
|
30632
|
+
const val = normalizeBool(attributes["w:val"]);
|
|
30633
|
+
inlineMarks.push(val ? { type: "strike" } : { type: "strike", attrs: { value: "0" } });
|
|
30634
|
+
break;
|
|
30635
|
+
}
|
|
30636
|
+
case "w:highlight": {
|
|
30637
|
+
const color = attributes["w:val"];
|
|
30638
|
+
if (typeof color === "string" && color) {
|
|
30639
|
+
highlightColor = color.toLowerCase() === "none" ? "transparent" : color;
|
|
30640
|
+
}
|
|
30641
|
+
break;
|
|
30642
|
+
}
|
|
30643
|
+
case "w:shd": {
|
|
30644
|
+
const fill = attributes["w:fill"];
|
|
30645
|
+
const shdVal = attributes["w:val"];
|
|
30646
|
+
if (fill && String(fill).toLowerCase() !== "auto") {
|
|
30647
|
+
highlightColor = `#${String(fill).replace("#", "")}`;
|
|
30648
|
+
} else if (typeof shdVal === "string") {
|
|
30649
|
+
const normalized = shdVal.toLowerCase();
|
|
30650
|
+
if (normalized === "clear" || normalized === "nil" || normalized === "none") {
|
|
30651
|
+
highlightColor = "transparent";
|
|
30652
|
+
}
|
|
30653
|
+
}
|
|
30654
|
+
break;
|
|
30655
|
+
}
|
|
30656
|
+
case "w:rStyle": {
|
|
30657
|
+
if (typeof attributes["w:val"] === "string") runStyleId = attributes["w:val"];
|
|
30658
|
+
remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
|
|
30659
|
+
break;
|
|
30660
|
+
}
|
|
30661
|
+
default: {
|
|
30662
|
+
remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
|
|
30663
|
+
}
|
|
30664
|
+
}
|
|
30665
|
+
});
|
|
30666
|
+
if (highlightColor) inlineMarks.push({ type: "highlight", attrs: { color: highlightColor } });
|
|
30667
|
+
return {
|
|
30668
|
+
remainingProps,
|
|
30669
|
+
inlineMarks,
|
|
30670
|
+
textStyleAttrs: hasTextStyle ? textStyleAttrs : null,
|
|
30671
|
+
runStyleId
|
|
30672
|
+
};
|
|
30673
|
+
};
|
|
30674
|
+
const encode$3 = (attributes) => {
|
|
30675
|
+
return attributes["w:rsidR"];
|
|
30676
|
+
};
|
|
30677
|
+
const decode$3 = (attrs) => {
|
|
30678
|
+
return attrs.rsidR;
|
|
30679
|
+
};
|
|
30680
|
+
const attrConfig$2 = Object.freeze({
|
|
30681
|
+
xmlName: "w:rsidR",
|
|
30682
|
+
sdName: "rsidR",
|
|
30683
|
+
encode: encode$3,
|
|
30684
|
+
decode: decode$3
|
|
30685
|
+
});
|
|
30686
|
+
const encode$2 = (attributes) => {
|
|
30687
|
+
return attributes["w:rsidRPr"];
|
|
30688
|
+
};
|
|
30689
|
+
const decode$2 = (attrs) => {
|
|
30690
|
+
return attrs.rsidRPr;
|
|
30691
|
+
};
|
|
30692
|
+
const attrConfig$1 = Object.freeze({
|
|
30693
|
+
xmlName: "w:rsidRPr",
|
|
30694
|
+
sdName: "rsidRPr",
|
|
30695
|
+
encode: encode$2,
|
|
30696
|
+
decode: decode$2
|
|
30697
|
+
});
|
|
30698
|
+
const encode$1 = (attributes) => {
|
|
30699
|
+
return attributes["w:rsidDel"];
|
|
30700
|
+
};
|
|
30701
|
+
const decode$1 = (attrs) => {
|
|
30702
|
+
return attrs.rsidDel;
|
|
30703
|
+
};
|
|
30704
|
+
const attrConfig = Object.freeze({
|
|
30705
|
+
xmlName: "w:rsidDel",
|
|
30706
|
+
sdName: "rsidDel",
|
|
30707
|
+
encode: encode$1,
|
|
30708
|
+
decode: decode$1
|
|
30709
|
+
});
|
|
30710
|
+
const validXmlAttributes = [attrConfig$2, attrConfig$1, attrConfig];
|
|
30711
|
+
const XML_NODE_NAME = "w:r";
|
|
30712
|
+
const SD_KEY_NAME = "run";
|
|
30713
|
+
const encode$U = (params2, encodedAttrs = {}) => {
|
|
30714
|
+
const { nodes = [], nodeListHandler } = params2 || {};
|
|
30715
|
+
const runNode = nodes[0];
|
|
30716
|
+
if (!runNode) return void 0;
|
|
30717
|
+
const elements = Array.isArray(runNode.elements) ? runNode.elements : [];
|
|
30718
|
+
const rPrNode = elements.find((child) => child?.name === "w:rPr");
|
|
30719
|
+
const contentElements = rPrNode ? elements.filter((el) => el !== rPrNode) : elements;
|
|
30720
|
+
const { entries: runPropEntries, hadRPr, styleChangeMarks } = collectRunProperties(params2, rPrNode);
|
|
30721
|
+
const { remainingProps, inlineMarks, textStyleAttrs, runStyleId } = splitRunProperties(runPropEntries, params2?.docx);
|
|
30722
|
+
const styleMarks = deriveStyleMarks({
|
|
30723
|
+
docx: params2?.docx,
|
|
30724
|
+
paragraphStyleId: params2?.parentStyleId,
|
|
30725
|
+
runStyleId
|
|
30726
|
+
});
|
|
30727
|
+
const mergedInlineMarks = mergeInlineMarkSets(styleMarks.inlineMarks, inlineMarks);
|
|
30728
|
+
let mergedTextStyleAttrs = mergeTextStyleAttrs(styleMarks.textStyleAttrs, textStyleAttrs);
|
|
30729
|
+
if (runStyleId) {
|
|
30730
|
+
mergedTextStyleAttrs = mergedTextStyleAttrs ? { ...mergedTextStyleAttrs, styleId: runStyleId } : { styleId: runStyleId };
|
|
30731
|
+
}
|
|
30732
|
+
const runAttrs = buildRunAttrs(encodedAttrs, hadRPr, remainingProps);
|
|
30733
|
+
let runLevelMarks = Array.isArray(runNode.marks) ? runNode.marks.map((mark) => cloneMark(mark)) : [];
|
|
30734
|
+
if (styleChangeMarks?.length) {
|
|
30735
|
+
runLevelMarks = [...runLevelMarks, ...styleChangeMarks.map((mark) => cloneMark(mark))];
|
|
30736
|
+
}
|
|
30737
|
+
const childParams = { ...params2, nodes: contentElements };
|
|
30738
|
+
const content = nodeListHandler?.handler(childParams) || [];
|
|
30739
|
+
const contentWithRunMarks = content.map((child) => {
|
|
30740
|
+
if (!child || typeof child !== "object") return child;
|
|
30741
|
+
const baseMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark(mark)) : [];
|
|
30742
|
+
if (!runLevelMarks.length) return child;
|
|
30743
|
+
return { ...child, marks: [...baseMarks, ...runLevelMarks.map((mark) => cloneMark(mark))] };
|
|
30744
|
+
});
|
|
30745
|
+
const marked = contentWithRunMarks.map(
|
|
30746
|
+
(child) => applyRunMarks(child, runAttrs, mergedInlineMarks, mergedTextStyleAttrs)
|
|
30747
|
+
);
|
|
30748
|
+
const filtered = marked.filter(Boolean);
|
|
30749
|
+
if (!filtered.length) return [];
|
|
30750
|
+
if (filtered.length === 1) return filtered[0];
|
|
30751
|
+
return filtered;
|
|
30752
|
+
};
|
|
30753
|
+
const decode = (params2, decodedAttrs = {}) => {
|
|
30754
|
+
const { node } = params2 || {};
|
|
30755
|
+
if (!node) return void 0;
|
|
30756
|
+
const marks = Array.isArray(node.marks) ? node.marks : [];
|
|
30757
|
+
const runMarkIndex = marks.findIndex((mark) => mark?.type === SD_KEY_NAME);
|
|
30758
|
+
const runMark = runMarkIndex >= 0 ? marks[runMarkIndex] : void 0;
|
|
30759
|
+
const strippedMarks = marks.filter((_2, idx) => idx !== runMarkIndex);
|
|
30760
|
+
const exportNode = { ...node, marks: strippedMarks };
|
|
30761
|
+
const exportParams = { ...params2, node: exportNode };
|
|
30762
|
+
if (!exportParams.editor) {
|
|
30763
|
+
exportParams.editor = { extensionService: { extensions: [] } };
|
|
30764
|
+
}
|
|
30765
|
+
const translated = exportSchemaToJson(exportParams);
|
|
30766
|
+
if (!translated) return void 0;
|
|
30767
|
+
const runElement = resolveRunElement(translated);
|
|
30768
|
+
if (!runElement) return translated;
|
|
30769
|
+
runElement.attributes = { ...runElement.attributes || {}, ...decodedAttrs };
|
|
30770
|
+
const runProperties = Array.isArray(runMark?.attrs?.runProperties) ? runMark.attrs.runProperties : null;
|
|
30771
|
+
if (runProperties && runProperties.length) {
|
|
30772
|
+
const rPr = ensureRunPropertiesContainer(runElement);
|
|
30773
|
+
const existingNames = new Set((rPr.elements || []).map((el) => el.name));
|
|
30774
|
+
runProperties.forEach((entry) => {
|
|
30775
|
+
if (!entry || !entry.xmlName || entry.xmlName === "w:b") return;
|
|
30776
|
+
if (existingNames.has(entry.xmlName)) return;
|
|
30777
|
+
rPr.elements.push({ name: entry.xmlName, attributes: { ...entry.attributes || {} } });
|
|
30778
|
+
existingNames.add(entry.xmlName);
|
|
30779
|
+
});
|
|
29753
30780
|
}
|
|
29754
|
-
|
|
29755
|
-
const style2 = styleTags.find((tag) => tag.attributes["w:styleId"] === styleId) || {};
|
|
29756
|
-
if (!style2) return {};
|
|
29757
|
-
return parseProperties(style2);
|
|
30781
|
+
return translated;
|
|
29758
30782
|
};
|
|
29759
|
-
const
|
|
29760
|
-
|
|
29761
|
-
|
|
30783
|
+
const config = {
|
|
30784
|
+
xmlName: XML_NODE_NAME,
|
|
30785
|
+
sdNodeOrKeyName: SD_KEY_NAME,
|
|
30786
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
30787
|
+
encode: encode$U,
|
|
30788
|
+
decode,
|
|
30789
|
+
attributes: validXmlAttributes
|
|
29762
30790
|
};
|
|
30791
|
+
const translator = NodeTranslator.from(config);
|
|
30792
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator);
|
|
29763
30793
|
const handleTextNode = (params2) => {
|
|
29764
30794
|
const { nodes, insideTrackChange } = params2;
|
|
29765
30795
|
if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
|
|
@@ -29796,7 +30826,7 @@ const handleParagraphNode = (params2) => {
|
|
|
29796
30826
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
29797
30827
|
return { nodes: [], consumed: 0 };
|
|
29798
30828
|
}
|
|
29799
|
-
const schemaNode = translator$
|
|
30829
|
+
const schemaNode = translator$s.encode(params2);
|
|
29800
30830
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
29801
30831
|
return { nodes: newNodes, consumed: 1 };
|
|
29802
30832
|
};
|
|
@@ -29809,7 +30839,7 @@ const handleSdtNode = (params2) => {
|
|
|
29809
30839
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
29810
30840
|
return { nodes: [], consumed: 0 };
|
|
29811
30841
|
}
|
|
29812
|
-
const result = translator.encode(params2);
|
|
30842
|
+
const result = translator$b.encode(params2);
|
|
29813
30843
|
if (!result) {
|
|
29814
30844
|
return { nodes: [], consumed: 0 };
|
|
29815
30845
|
}
|
|
@@ -29899,7 +30929,7 @@ const handler = (params2) => {
|
|
|
29899
30929
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
29900
30930
|
return { nodes: [], consumed: 0 };
|
|
29901
30931
|
}
|
|
29902
|
-
const result = translator$
|
|
30932
|
+
const result = translator$v.encode(params2);
|
|
29903
30933
|
if (!result) return { nodes: [], consumed: 0 };
|
|
29904
30934
|
return {
|
|
29905
30935
|
nodes: [result],
|
|
@@ -30595,7 +31625,7 @@ const handleTabNode = (params2) => {
|
|
|
30595
31625
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
30596
31626
|
return { nodes: [], consumed: 0 };
|
|
30597
31627
|
}
|
|
30598
|
-
const node = translator$
|
|
31628
|
+
const node = translator$t.encode(params2);
|
|
30599
31629
|
return { nodes: [node], consumed: 1 };
|
|
30600
31630
|
};
|
|
30601
31631
|
const tabNodeEntityHandler = {
|
|
@@ -31042,6 +32072,16 @@ const isAlternatingHeadersOddEven = (docx) => {
|
|
|
31042
32072
|
};
|
|
31043
32073
|
const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
|
31044
32074
|
const HEADER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
32075
|
+
const FONT_FAMILY_FALLBACKS = Object.freeze({
|
|
32076
|
+
swiss: "Arial, sans-serif",
|
|
32077
|
+
roman: "Times New Roman, serif",
|
|
32078
|
+
modern: "Courier New, monospace",
|
|
32079
|
+
script: "cursive",
|
|
32080
|
+
decorative: "fantasy",
|
|
32081
|
+
system: "system-ui",
|
|
32082
|
+
auto: "sans-serif"
|
|
32083
|
+
});
|
|
32084
|
+
const DEFAULT_GENERIC_FALLBACK = "sans-serif";
|
|
31045
32085
|
const _SuperConverter = class _SuperConverter2 {
|
|
31046
32086
|
constructor(params2 = null) {
|
|
31047
32087
|
__privateAdd$2(this, _SuperConverter_instances);
|
|
@@ -31077,6 +32117,31 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
31077
32117
|
this.documentId = params2?.documentId || null;
|
|
31078
32118
|
if (this.docx.length || this.xml) this.parseFromXml();
|
|
31079
32119
|
}
|
|
32120
|
+
static getFontTableEntry(docx, fontName) {
|
|
32121
|
+
if (!docx || !fontName) return null;
|
|
32122
|
+
const fontTable = docx["word/fontTable.xml"];
|
|
32123
|
+
if (!fontTable?.elements?.length) return null;
|
|
32124
|
+
const fontsNode = fontTable.elements.find((el) => el.name === "w:fonts");
|
|
32125
|
+
if (!fontsNode?.elements?.length) return null;
|
|
32126
|
+
return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
|
|
32127
|
+
}
|
|
32128
|
+
static getFallbackFromFontTable(docx, fontName) {
|
|
32129
|
+
const fontEntry = _SuperConverter2.getFontTableEntry(docx, fontName);
|
|
32130
|
+
const family = fontEntry?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
32131
|
+
if (!family) return null;
|
|
32132
|
+
const mapped = FONT_FAMILY_FALLBACKS[family.toLowerCase()];
|
|
32133
|
+
return mapped || DEFAULT_GENERIC_FALLBACK;
|
|
32134
|
+
}
|
|
32135
|
+
static toCssFontFamily(fontName, docx) {
|
|
32136
|
+
if (!fontName) return fontName;
|
|
32137
|
+
if (fontName.includes(",")) return fontName;
|
|
32138
|
+
const fallback = _SuperConverter2.getFallbackFromFontTable(docx, fontName) || DEFAULT_GENERIC_FALLBACK;
|
|
32139
|
+
const normalizedFallbackParts = fallback.split(",").map((part) => part.trim().toLowerCase()).filter(Boolean);
|
|
32140
|
+
if (normalizedFallbackParts.includes(fontName.trim().toLowerCase())) {
|
|
32141
|
+
return fallback;
|
|
32142
|
+
}
|
|
32143
|
+
return `${fontName}, ${fallback}`;
|
|
32144
|
+
}
|
|
31080
32145
|
/**
|
|
31081
32146
|
* Get the DocxHelpers object that contains utility functions for working with docx files.
|
|
31082
32147
|
* @returns {import('./docx-helpers/docx-helpers.js').DocxHelpers} The DocxHelpers object.
|
|
@@ -31122,7 +32187,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
31122
32187
|
return;
|
|
31123
32188
|
}
|
|
31124
32189
|
}
|
|
31125
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.
|
|
32190
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.21.0-RC1") {
|
|
31126
32191
|
const customLocation = "docProps/custom.xml";
|
|
31127
32192
|
if (!docx[customLocation]) {
|
|
31128
32193
|
docx[customLocation] = generateCustomXml();
|
|
@@ -31173,13 +32238,19 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
31173
32238
|
if (rPrDefaults) {
|
|
31174
32239
|
const rPr = rPrDefaults.elements?.find((el) => el.name === "w:rPr");
|
|
31175
32240
|
const fonts = rPr?.elements?.find((el) => el.name === "w:rFonts");
|
|
31176
|
-
|
|
31177
|
-
|
|
31178
|
-
|
|
32241
|
+
if (fonts?.attributes?.["w:ascii"]) {
|
|
32242
|
+
typeface = fonts.attributes["w:ascii"];
|
|
32243
|
+
}
|
|
32244
|
+
const fontSizeRaw = rPr?.elements?.find((el) => el.name === "w:sz")?.attributes?.["w:val"];
|
|
32245
|
+
if (!fontSizeNormal && fontSizeRaw) {
|
|
32246
|
+
fontSizeNormal = Number(fontSizeRaw) / 2;
|
|
32247
|
+
}
|
|
31179
32248
|
}
|
|
31180
|
-
const
|
|
32249
|
+
const fallbackSz = Number(rElements.find((el) => el.name === "w:sz")?.attributes?.["w:val"]);
|
|
32250
|
+
const fontSizePt = fontSizeNormal ?? (Number.isFinite(fallbackSz) ? fallbackSz / 2 : void 0) ?? 10;
|
|
31181
32251
|
const kern = rElements.find((el) => el.name === "w:kern")?.attributes["w:val"];
|
|
31182
|
-
|
|
32252
|
+
const fontFamilyCss = _SuperConverter2.toCssFontFamily(typeface, this.convertedXml);
|
|
32253
|
+
return { fontSizePt, kern, typeface, panose, fontFamilyCss };
|
|
31183
32254
|
}
|
|
31184
32255
|
}
|
|
31185
32256
|
getDocumentFonts() {
|
|
@@ -31609,7 +32680,7 @@ function storeSuperdocVersion(docx) {
|
|
|
31609
32680
|
function generateCustomXml() {
|
|
31610
32681
|
return DEFAULT_CUSTOM_XML;
|
|
31611
32682
|
}
|
|
31612
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.
|
|
32683
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.21.0-RC1") {
|
|
31613
32684
|
return {
|
|
31614
32685
|
type: "element",
|
|
31615
32686
|
name: "property",
|
|
@@ -43023,6 +44094,95 @@ const toggleMark = (typeOrName, attrs = {}, options = {}) => ({ state: state2, c
|
|
|
43023
44094
|
if (isActive2) return commands2.unsetMark(type2, { extendEmptyMarkRange });
|
|
43024
44095
|
return commands2.setMark(type2, attrs);
|
|
43025
44096
|
};
|
|
44097
|
+
const toggleMarkCascade = (markName, options = {}) => ({ state: state2, chain, editor }) => {
|
|
44098
|
+
const {
|
|
44099
|
+
negationAttrs = { value: "0" },
|
|
44100
|
+
isNegation = (attrs) => attrs?.value === "0",
|
|
44101
|
+
styleDetector = defaultStyleDetector,
|
|
44102
|
+
extendEmptyMarkRange = true
|
|
44103
|
+
} = options;
|
|
44104
|
+
const selectionMarks = getMarksFromSelection(state2) || [];
|
|
44105
|
+
const inlineMarks = selectionMarks.filter((m2) => m2.type?.name === markName);
|
|
44106
|
+
const hasNegation = inlineMarks.some((m2) => isNegation(m2.attrs || {}));
|
|
44107
|
+
const hasInline = inlineMarks.some((m2) => !isNegation(m2.attrs || {}));
|
|
44108
|
+
const styleOn = styleDetector({ state: state2, selectionMarks, markName, editor });
|
|
44109
|
+
const cmdChain = chain();
|
|
44110
|
+
if (hasNegation) return cmdChain.unsetMark(markName, { extendEmptyMarkRange }).run();
|
|
44111
|
+
if (hasInline && styleOn) {
|
|
44112
|
+
return cmdChain.unsetMark(markName, { extendEmptyMarkRange }).setMark(markName, negationAttrs, { extendEmptyMarkRange }).run();
|
|
44113
|
+
}
|
|
44114
|
+
if (hasInline) return cmdChain.unsetMark(markName, { extendEmptyMarkRange }).run();
|
|
44115
|
+
if (styleOn) return cmdChain.setMark(markName, negationAttrs, { extendEmptyMarkRange }).run();
|
|
44116
|
+
return cmdChain.setMark(markName, {}, { extendEmptyMarkRange }).run();
|
|
44117
|
+
};
|
|
44118
|
+
function defaultStyleDetector({ state: state2, selectionMarks, markName, editor }) {
|
|
44119
|
+
try {
|
|
44120
|
+
const styleId = getEffectiveStyleId(state2, selectionMarks);
|
|
44121
|
+
if (!styleId || !editor?.converter?.linkedStyles) return false;
|
|
44122
|
+
const styles = editor.converter.linkedStyles;
|
|
44123
|
+
const seen = /* @__PURE__ */ new Set();
|
|
44124
|
+
let current = styleId;
|
|
44125
|
+
const key = mapMarkToStyleKey(markName);
|
|
44126
|
+
while (current && !seen.has(current)) {
|
|
44127
|
+
seen.add(current);
|
|
44128
|
+
const style2 = styles.find((s) => s.id === current);
|
|
44129
|
+
const def = style2?.definition?.styles || {};
|
|
44130
|
+
if (key in def) {
|
|
44131
|
+
const raw = def[key];
|
|
44132
|
+
if (raw === void 0) return true;
|
|
44133
|
+
const val = raw?.value ?? raw;
|
|
44134
|
+
if (val === "0" || val === false) return false;
|
|
44135
|
+
return !!val;
|
|
44136
|
+
}
|
|
44137
|
+
current = style2?.definition?.attrs?.basedOn || null;
|
|
44138
|
+
}
|
|
44139
|
+
return false;
|
|
44140
|
+
} catch {
|
|
44141
|
+
return false;
|
|
44142
|
+
}
|
|
44143
|
+
}
|
|
44144
|
+
function getEffectiveStyleId(state2, selectionMarks) {
|
|
44145
|
+
const sidFromMarks = getStyleIdFromMarks(selectionMarks);
|
|
44146
|
+
if (sidFromMarks) return sidFromMarks;
|
|
44147
|
+
const $from = state2.selection.$from;
|
|
44148
|
+
const before = $from.nodeBefore;
|
|
44149
|
+
const after = $from.nodeAfter;
|
|
44150
|
+
if (before && before.marks) {
|
|
44151
|
+
const sid = getStyleIdFromMarks(before.marks);
|
|
44152
|
+
if (sid) return sid;
|
|
44153
|
+
}
|
|
44154
|
+
if (after && after.marks) {
|
|
44155
|
+
const sid = getStyleIdFromMarks(after.marks);
|
|
44156
|
+
if (sid) return sid;
|
|
44157
|
+
}
|
|
44158
|
+
const ts = selectionMarks.find((m2) => m2.type?.name === "textStyle" && m2.attrs?.styleId);
|
|
44159
|
+
if (ts) return ts.attrs.styleId;
|
|
44160
|
+
const pos = state2.selection.$from.pos;
|
|
44161
|
+
const $pos = state2.doc.resolve(pos);
|
|
44162
|
+
for (let d2 = $pos.depth; d2 >= 0; d2--) {
|
|
44163
|
+
const n = $pos.node(d2);
|
|
44164
|
+
if (n?.type?.name === "paragraph") return n.attrs?.styleId || null;
|
|
44165
|
+
}
|
|
44166
|
+
return null;
|
|
44167
|
+
}
|
|
44168
|
+
function getStyleIdFromMarks(marks) {
|
|
44169
|
+
const run2 = marks.find((m2) => m2.type?.name === "run");
|
|
44170
|
+
const runProperties = run2?.attrs?.runProperties;
|
|
44171
|
+
if (!runProperties) return null;
|
|
44172
|
+
if (runProperties && typeof runProperties === "object" && !Array.isArray(runProperties) && runProperties.styleId) {
|
|
44173
|
+
return runProperties.styleId;
|
|
44174
|
+
}
|
|
44175
|
+
if (Array.isArray(runProperties)) {
|
|
44176
|
+
const rStyleEntry = runProperties.find((e) => e?.xmlName === "w:rStyle");
|
|
44177
|
+
const sid = rStyleEntry?.attributes?.["w:val"];
|
|
44178
|
+
if (sid) return sid;
|
|
44179
|
+
}
|
|
44180
|
+
return null;
|
|
44181
|
+
}
|
|
44182
|
+
function mapMarkToStyleKey(markName) {
|
|
44183
|
+
if (markName === "textStyle" || markName === "color") return "color";
|
|
44184
|
+
return markName;
|
|
44185
|
+
}
|
|
43026
44186
|
const clearNodes = () => ({ state: state2, tr, dispatch }) => {
|
|
43027
44187
|
const { selection } = tr;
|
|
43028
44188
|
const { ranges } = selection;
|
|
@@ -44368,11 +45528,14 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
44368
45528
|
command,
|
|
44369
45529
|
createParagraphNear,
|
|
44370
45530
|
decreaseListIndent,
|
|
45531
|
+
defaultStyleDetector,
|
|
44371
45532
|
deleteListItem,
|
|
44372
45533
|
deleteSelection,
|
|
44373
45534
|
exitCode,
|
|
44374
45535
|
first,
|
|
45536
|
+
getEffectiveStyleId,
|
|
44375
45537
|
getParaCtx,
|
|
45538
|
+
getStyleIdFromMarks,
|
|
44376
45539
|
handleBackspaceNextToList,
|
|
44377
45540
|
handleDeleteNextToList,
|
|
44378
45541
|
increaseListIndent,
|
|
@@ -44387,6 +45550,7 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
44387
45550
|
joinUp,
|
|
44388
45551
|
liftEmptyBlock,
|
|
44389
45552
|
liftListItem,
|
|
45553
|
+
mapMarkToStyleKey,
|
|
44390
45554
|
nearestListAt,
|
|
44391
45555
|
newlineInCode,
|
|
44392
45556
|
rebuildListNodeWithNewNum,
|
|
@@ -44406,6 +45570,7 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
44406
45570
|
splitListItem,
|
|
44407
45571
|
toggleList,
|
|
44408
45572
|
toggleMark,
|
|
45573
|
+
toggleMarkCascade,
|
|
44409
45574
|
toggleNode,
|
|
44410
45575
|
undoInputRule,
|
|
44411
45576
|
unsetAllMarks,
|
|
@@ -45609,7 +46774,7 @@ const createHeaderFooterEditor = ({
|
|
|
45609
46774
|
currentPageNumber
|
|
45610
46775
|
}) => {
|
|
45611
46776
|
const parentStyles = editor.converter.getDocumentDefaultStyles();
|
|
45612
|
-
const { fontSizePt, typeface } = parentStyles;
|
|
46777
|
+
const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
|
|
45613
46778
|
const fontSizeInPixles = fontSizePt * 1.3333;
|
|
45614
46779
|
const lineHeight2 = fontSizeInPixles * 1.2;
|
|
45615
46780
|
Object.assign(editorContainer.style, {
|
|
@@ -45622,7 +46787,7 @@ const createHeaderFooterEditor = ({
|
|
|
45622
46787
|
left: "0",
|
|
45623
46788
|
width: "auto",
|
|
45624
46789
|
maxWidth: "none",
|
|
45625
|
-
fontFamily: typeface,
|
|
46790
|
+
fontFamily: fontFamilyCss || typeface,
|
|
45626
46791
|
fontSize: `${fontSizeInPixles}px`,
|
|
45627
46792
|
lineHeight: `${lineHeight2}px`
|
|
45628
46793
|
});
|
|
@@ -46452,7 +47617,6 @@ const trackedTransaction = ({ tr, state: state2, user }) => {
|
|
|
46452
47617
|
originalStep,
|
|
46453
47618
|
originalStepIndex
|
|
46454
47619
|
});
|
|
46455
|
-
console.debug("[track-changes]: replaceStep");
|
|
46456
47620
|
} else if (step instanceof AddMarkStep) {
|
|
46457
47621
|
addMarkStep({
|
|
46458
47622
|
state: state2,
|
|
@@ -46462,7 +47626,6 @@ const trackedTransaction = ({ tr, state: state2, user }) => {
|
|
|
46462
47626
|
user,
|
|
46463
47627
|
date
|
|
46464
47628
|
});
|
|
46465
|
-
console.debug("[track-changes]: addMarkStep");
|
|
46466
47629
|
} else if (step instanceof RemoveMarkStep) {
|
|
46467
47630
|
removeMarkStep({
|
|
46468
47631
|
state: state2,
|
|
@@ -46472,10 +47635,8 @@ const trackedTransaction = ({ tr, state: state2, user }) => {
|
|
|
46472
47635
|
user,
|
|
46473
47636
|
date
|
|
46474
47637
|
});
|
|
46475
|
-
console.debug("[track-changes]: removeMarkStep");
|
|
46476
47638
|
} else {
|
|
46477
47639
|
newTr.step(step);
|
|
46478
|
-
console.log("[track-changes]: otherStep");
|
|
46479
47640
|
}
|
|
46480
47641
|
});
|
|
46481
47642
|
if (tr.getMeta("inputType")) {
|
|
@@ -48545,9 +49706,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
48545
49706
|
element.style.isolation = "isolate";
|
|
48546
49707
|
proseMirror.style.outline = "none";
|
|
48547
49708
|
proseMirror.style.border = "none";
|
|
48548
|
-
const { typeface, fontSizePt } = this.converter.getDocumentDefaultStyles() ?? {};
|
|
48549
|
-
|
|
48550
|
-
|
|
49709
|
+
const { typeface, fontSizePt, fontFamilyCss } = this.converter.getDocumentDefaultStyles() ?? {};
|
|
49710
|
+
const resolvedFontFamily = fontFamilyCss || typeface;
|
|
49711
|
+
if (resolvedFontFamily) {
|
|
49712
|
+
element.style.fontFamily = resolvedFontFamily;
|
|
48551
49713
|
}
|
|
48552
49714
|
if (fontSizePt) {
|
|
48553
49715
|
element.style.fontSize = `${fontSizePt}pt`;
|
|
@@ -48861,7 +50023,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
48861
50023
|
* @returns {Object | void} Migration results
|
|
48862
50024
|
*/
|
|
48863
50025
|
processCollaborationMigrations() {
|
|
48864
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
50026
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.21.0-RC1");
|
|
48865
50027
|
if (!this.options.ydoc) return;
|
|
48866
50028
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
48867
50029
|
let docVersion = metaMap.get("version");
|
|
@@ -49970,6 +51132,7 @@ const FormatCommands = Extension.create({
|
|
|
49970
51132
|
},
|
|
49971
51133
|
addCommands() {
|
|
49972
51134
|
return {
|
|
51135
|
+
toggleMarkCascade,
|
|
49973
51136
|
/**
|
|
49974
51137
|
* Clear all formatting (nodes and marks)
|
|
49975
51138
|
* @category Command
|
|
@@ -50954,24 +52117,32 @@ const Text = Node$1.create({
|
|
|
50954
52117
|
group: "inline",
|
|
50955
52118
|
inline: true
|
|
50956
52119
|
});
|
|
50957
|
-
const
|
|
52120
|
+
const Run = Mark2.create({
|
|
50958
52121
|
name: "run",
|
|
50959
|
-
|
|
50960
|
-
|
|
50961
|
-
|
|
50962
|
-
|
|
50963
|
-
|
|
50964
|
-
},
|
|
50965
|
-
renderDOM() {
|
|
50966
|
-
return ["run", 0];
|
|
52122
|
+
inclusive: false,
|
|
52123
|
+
addOptions() {
|
|
52124
|
+
return {
|
|
52125
|
+
htmlAttributes: {}
|
|
52126
|
+
};
|
|
50967
52127
|
},
|
|
50968
52128
|
addAttributes() {
|
|
50969
52129
|
return {
|
|
50970
|
-
|
|
50971
|
-
|
|
50972
|
-
|
|
52130
|
+
runProperties: {
|
|
52131
|
+
default: null,
|
|
52132
|
+
rendered: false
|
|
50973
52133
|
}
|
|
50974
52134
|
};
|
|
52135
|
+
},
|
|
52136
|
+
parseDOM() {
|
|
52137
|
+
return [
|
|
52138
|
+
{
|
|
52139
|
+
tag: "span[data-run]"
|
|
52140
|
+
}
|
|
52141
|
+
];
|
|
52142
|
+
},
|
|
52143
|
+
renderDOM({ htmlAttributes }) {
|
|
52144
|
+
const base2 = Attribute2.mergeAttributes({ "data-run": "1" }, this.options.htmlAttributes, htmlAttributes);
|
|
52145
|
+
return ["span", base2, 0];
|
|
50975
52146
|
}
|
|
50976
52147
|
});
|
|
50977
52148
|
const inputRegex$1 = /^\s*([-+*])\s$/;
|
|
@@ -51535,6 +52706,7 @@ const getMarksStyle = (attrs) => {
|
|
|
51535
52706
|
case "textStyle":
|
|
51536
52707
|
const { fontFamily: fontFamily2, fontSize: fontSize2 } = attr.attrs;
|
|
51537
52708
|
styles += `${fontFamily2 ? `font-family: ${fontFamily2};` : ""} ${fontSize2 ? `font-size: ${fontSize2};` : ""}`;
|
|
52709
|
+
break;
|
|
51538
52710
|
}
|
|
51539
52711
|
}
|
|
51540
52712
|
return styles.trim();
|
|
@@ -51553,12 +52725,22 @@ const generateLinkedStyleString = (linkedStyle, basedOnStyle, node, parent, incl
|
|
|
51553
52725
|
const linkedDefinitionStyles = { ...linkedStyle.definition.styles };
|
|
51554
52726
|
const basedOnDefinitionStyles = { ...basedOnStyle?.definition?.styles };
|
|
51555
52727
|
const resultStyles = { ...linkedDefinitionStyles };
|
|
51556
|
-
|
|
51557
|
-
|
|
51558
|
-
|
|
51559
|
-
|
|
51560
|
-
|
|
51561
|
-
|
|
52728
|
+
const inheritKeys = [
|
|
52729
|
+
"font-size",
|
|
52730
|
+
"font-family",
|
|
52731
|
+
"text-transform",
|
|
52732
|
+
"bold",
|
|
52733
|
+
"italic",
|
|
52734
|
+
"underline",
|
|
52735
|
+
"strike",
|
|
52736
|
+
"color",
|
|
52737
|
+
"highlight"
|
|
52738
|
+
];
|
|
52739
|
+
inheritKeys.forEach((k) => {
|
|
52740
|
+
if (!linkedDefinitionStyles[k] && basedOnDefinitionStyles[k]) {
|
|
52741
|
+
resultStyles[k] = basedOnDefinitionStyles[k];
|
|
52742
|
+
}
|
|
52743
|
+
});
|
|
51562
52744
|
Object.entries(resultStyles).forEach(([k, value]) => {
|
|
51563
52745
|
const key = kebabCase$1(k);
|
|
51564
52746
|
const flattenedMarks = [];
|
|
@@ -51573,6 +52755,10 @@ const generateLinkedStyleString = (linkedStyle, basedOnStyle, node, parent, incl
|
|
|
51573
52755
|
}
|
|
51574
52756
|
flattenedMarks.push({ key: n.type.name, value: n.attrs[key] });
|
|
51575
52757
|
});
|
|
52758
|
+
const underlineNone = node?.marks?.some((m2) => m2.type?.name === "underline" && m2.attrs?.underlineType === "none");
|
|
52759
|
+
if (underlineNone) {
|
|
52760
|
+
markValue["text-decoration"] = "none";
|
|
52761
|
+
}
|
|
51576
52762
|
const mark = flattenedMarks.find((n) => n.key === key);
|
|
51577
52763
|
const hasParentIndent = Object.keys(parent?.attrs?.indent || {});
|
|
51578
52764
|
const hasParentSpacing = Object.keys(parent?.attrs?.spacing || {});
|
|
@@ -51589,10 +52775,28 @@ const generateLinkedStyleString = (linkedStyle, basedOnStyle, node, parent, incl
|
|
|
51589
52775
|
if (rightIndent) markValue["margin-right"] = rightIndent + "px";
|
|
51590
52776
|
if (firstLine) markValue["text-indent"] = firstLine + "px";
|
|
51591
52777
|
} else if (key === "bold" && node) {
|
|
51592
|
-
const
|
|
51593
|
-
|
|
52778
|
+
const boldValue = typeof value === "object" && value !== null ? value.value : value;
|
|
52779
|
+
const hasInlineBoldOff = node.marks?.some((m2) => m2.type?.name === "bold" && m2.attrs?.value === "0");
|
|
52780
|
+
const hasInlineBoldOn = node.marks?.some((m2) => m2.type?.name === "bold" && m2.attrs?.value !== "0");
|
|
52781
|
+
if (!listTypes.includes(node.type.name) && !hasInlineBoldOff && !hasInlineBoldOn && boldValue !== "0" && boldValue !== false) {
|
|
51594
52782
|
markValue["font-weight"] = "bold";
|
|
51595
52783
|
}
|
|
52784
|
+
} else if (key === "italic" && node) {
|
|
52785
|
+
const italicValue = typeof value === "object" && value !== null ? value.value : value;
|
|
52786
|
+
const hasInlineItalicOff = node.marks?.some((m2) => m2.type?.name === "italic" && m2.attrs?.value === "0");
|
|
52787
|
+
const hasInlineItalicOn = node.marks?.some((m2) => m2.type?.name === "italic" && m2.attrs?.value !== "0");
|
|
52788
|
+
if (!listTypes.includes(node.type.name) && !hasInlineItalicOff && !hasInlineItalicOn && italicValue !== "0" && italicValue !== false) {
|
|
52789
|
+
markValue["font-style"] = "italic";
|
|
52790
|
+
}
|
|
52791
|
+
} else if (key === "strike" && node) {
|
|
52792
|
+
const strikeValue = typeof value === "object" && value !== null ? value.value : value;
|
|
52793
|
+
const hasInlineStrikeOff = node.marks?.some((m2) => m2.type?.name === "strike" && m2.attrs?.value === "0");
|
|
52794
|
+
const hasInlineStrikeOn = node.marks?.some(
|
|
52795
|
+
(m2) => m2.type?.name === "strike" && (m2.attrs?.value === void 0 || m2.attrs?.value !== "0")
|
|
52796
|
+
);
|
|
52797
|
+
if (!listTypes.includes(node.type.name) && !hasInlineStrikeOff && !hasInlineStrikeOn && strikeValue !== "0" && strikeValue !== false) {
|
|
52798
|
+
markValue["text-decoration"] = "line-through";
|
|
52799
|
+
}
|
|
51596
52800
|
} else if (key === "text-transform" && node) {
|
|
51597
52801
|
if (!listTypes.includes(node.type.name)) {
|
|
51598
52802
|
markValue[key] = value;
|
|
@@ -51601,10 +52805,44 @@ const generateLinkedStyleString = (linkedStyle, basedOnStyle, node, parent, incl
|
|
|
51601
52805
|
if (!listTypes.includes(node.type.name)) {
|
|
51602
52806
|
markValue[key] = value;
|
|
51603
52807
|
}
|
|
52808
|
+
} else if (key === "font-family" && node) {
|
|
52809
|
+
if (!listTypes.includes(node.type.name)) {
|
|
52810
|
+
markValue[key] = value;
|
|
52811
|
+
}
|
|
51604
52812
|
} else if (key === "color" && node) {
|
|
51605
52813
|
if (!listTypes.includes(node.type.name)) {
|
|
51606
52814
|
markValue[key] = value;
|
|
51607
52815
|
}
|
|
52816
|
+
} else if (key === "highlight" && node) {
|
|
52817
|
+
const hasInlineHighlight = node.marks?.some((m2) => m2.type?.name === "highlight");
|
|
52818
|
+
if (!listTypes.includes(node.type.name) && !hasInlineHighlight) {
|
|
52819
|
+
const color = typeof value === "string" ? value : value?.color;
|
|
52820
|
+
if (color) markValue["background-color"] = color;
|
|
52821
|
+
}
|
|
52822
|
+
} else if (key === "underline" && node) {
|
|
52823
|
+
const styleValRaw = value?.value ?? value ?? "";
|
|
52824
|
+
const styleVal = styleValRaw.toString().toLowerCase();
|
|
52825
|
+
const hasInlineUnderlineOff = node.marks?.some(
|
|
52826
|
+
(m2) => m2.type?.name === "underline" && m2.attrs?.underlineType === "none"
|
|
52827
|
+
);
|
|
52828
|
+
const hasInlineUnderlineOn = node.marks?.some(
|
|
52829
|
+
(m2) => m2.type?.name === "underline" && m2.attrs?.underlineType && m2.attrs.underlineType !== "none"
|
|
52830
|
+
);
|
|
52831
|
+
if (!listTypes.includes(node.type.name) && !hasInlineUnderlineOff && !hasInlineUnderlineOn) {
|
|
52832
|
+
if (styleVal && styleVal !== "none" && styleVal !== "0") {
|
|
52833
|
+
const colorVal = value && typeof value === "object" ? value.color || value.underlineColor || null : null;
|
|
52834
|
+
const css = getUnderlineCssString({ type: styleVal, color: colorVal });
|
|
52835
|
+
css.split(";").forEach((decl) => {
|
|
52836
|
+
const d2 = decl.trim();
|
|
52837
|
+
if (!d2) return;
|
|
52838
|
+
const idx = d2.indexOf(":");
|
|
52839
|
+
if (idx === -1) return;
|
|
52840
|
+
const k2 = d2.slice(0, idx).trim();
|
|
52841
|
+
const v2 = d2.slice(idx + 1).trim();
|
|
52842
|
+
markValue[k2] = v2;
|
|
52843
|
+
});
|
|
52844
|
+
}
|
|
52845
|
+
}
|
|
51608
52846
|
} else if (typeof value === "string") {
|
|
51609
52847
|
markValue[key] = value;
|
|
51610
52848
|
}
|
|
@@ -51737,23 +52975,51 @@ const createLinkedStylesPlugin = (editor) => {
|
|
|
51737
52975
|
};
|
|
51738
52976
|
const generateDecorations = (state2, styles) => {
|
|
51739
52977
|
const decorations = [];
|
|
51740
|
-
let lastStyleId = null;
|
|
51741
52978
|
const doc2 = state2?.doc;
|
|
52979
|
+
const getParagraphStyleId = (pos) => {
|
|
52980
|
+
const $pos = state2.doc.resolve(pos);
|
|
52981
|
+
for (let d2 = $pos.depth; d2 >= 0; d2--) {
|
|
52982
|
+
const n = $pos.node(d2);
|
|
52983
|
+
if (n?.type?.name === "paragraph") return n.attrs?.styleId || null;
|
|
52984
|
+
}
|
|
52985
|
+
return null;
|
|
52986
|
+
};
|
|
51742
52987
|
doc2.descendants((node, pos) => {
|
|
51743
52988
|
const { name } = node.type;
|
|
51744
|
-
if (
|
|
51745
|
-
|
|
51746
|
-
|
|
52989
|
+
if (name !== "text") return;
|
|
52990
|
+
const paragraphStyleId = getParagraphStyleId(pos);
|
|
52991
|
+
let runStyleId = null;
|
|
52992
|
+
let inlineTextStyleId = null;
|
|
51747
52993
|
for (const mark of node.marks) {
|
|
51748
|
-
if (mark.type.name === "
|
|
51749
|
-
|
|
51750
|
-
|
|
51751
|
-
|
|
51752
|
-
|
|
51753
|
-
|
|
52994
|
+
if (mark.type.name === "run") {
|
|
52995
|
+
const rp = mark.attrs?.runProperties;
|
|
52996
|
+
if (rp && typeof rp === "object" && !Array.isArray(rp) && rp.styleId) runStyleId = rp.styleId;
|
|
52997
|
+
else if (Array.isArray(rp)) {
|
|
52998
|
+
const ent = rp.find((e) => e?.xmlName === "w:rStyle");
|
|
52999
|
+
const sid = ent?.attributes?.["w:val"];
|
|
53000
|
+
if (sid) runStyleId = sid;
|
|
53001
|
+
}
|
|
53002
|
+
} else if (mark.type.name === "textStyle" && mark.attrs?.styleId) {
|
|
53003
|
+
inlineTextStyleId = mark.attrs.styleId;
|
|
53004
|
+
}
|
|
53005
|
+
}
|
|
53006
|
+
const buildStyleMap = (sid) => {
|
|
53007
|
+
if (!sid) return {};
|
|
53008
|
+
const { linkedStyle, basedOnStyle: basedOnStyle2 } = getLinkedStyle(sid, styles);
|
|
53009
|
+
if (!linkedStyle) return {};
|
|
53010
|
+
const base2 = { ...basedOnStyle2?.definition?.styles || {} };
|
|
53011
|
+
return { ...base2, ...linkedStyle.definition?.styles || {} };
|
|
53012
|
+
};
|
|
53013
|
+
const pMap = buildStyleMap(paragraphStyleId);
|
|
53014
|
+
const tMap = buildStyleMap(inlineTextStyleId);
|
|
53015
|
+
const rMap = buildStyleMap(runStyleId);
|
|
53016
|
+
const finalStyles = { ...pMap, ...tMap, ...rMap };
|
|
53017
|
+
if (Object.keys(finalStyles).length === 0) return;
|
|
53018
|
+
const mergedLinkedStyle = { definition: { styles: finalStyles, attrs: {} } };
|
|
53019
|
+
const basedOnStyle = null;
|
|
51754
53020
|
const $pos = state2.doc.resolve(pos);
|
|
51755
53021
|
const parent = $pos.parent;
|
|
51756
|
-
const styleString = generateLinkedStyleString(
|
|
53022
|
+
const styleString = generateLinkedStyleString(mergedLinkedStyle, basedOnStyle, node, parent);
|
|
51757
53023
|
if (!styleString) return;
|
|
51758
53024
|
const decoration = Decoration.inline(pos, pos + node.nodeSize, { style: styleString });
|
|
51759
53025
|
decorations.push(decoration);
|
|
@@ -51888,6 +53154,70 @@ const LinkedStyles = Extension.create({
|
|
|
51888
53154
|
};
|
|
51889
53155
|
}
|
|
51890
53156
|
});
|
|
53157
|
+
function getUnderlineCssString({ type: type2 = "single", color = null, thickness = null, approximate = true } = {}) {
|
|
53158
|
+
const parts = [];
|
|
53159
|
+
const add = (k, v2) => {
|
|
53160
|
+
if (!v2) return;
|
|
53161
|
+
parts.push(`${k}: ${v2}`);
|
|
53162
|
+
};
|
|
53163
|
+
const lower = String(type2 || "single").toLowerCase();
|
|
53164
|
+
if (lower === "none" || lower === "0") {
|
|
53165
|
+
add("text-decoration", "none");
|
|
53166
|
+
return parts.join("; ");
|
|
53167
|
+
}
|
|
53168
|
+
add("text-decoration-line", "underline");
|
|
53169
|
+
const HEAVY = thickness || "0.2em";
|
|
53170
|
+
const THICK = thickness || "0.15em";
|
|
53171
|
+
switch (lower) {
|
|
53172
|
+
case "single":
|
|
53173
|
+
break;
|
|
53174
|
+
case "double":
|
|
53175
|
+
add("text-decoration-style", "double");
|
|
53176
|
+
break;
|
|
53177
|
+
case "thick":
|
|
53178
|
+
add("text-decoration-thickness", THICK);
|
|
53179
|
+
break;
|
|
53180
|
+
case "dotted":
|
|
53181
|
+
add("text-decoration-style", "dotted");
|
|
53182
|
+
break;
|
|
53183
|
+
case "dash":
|
|
53184
|
+
case "dashed":
|
|
53185
|
+
add("text-decoration-style", "dashed");
|
|
53186
|
+
break;
|
|
53187
|
+
case "dotdash":
|
|
53188
|
+
case "dotdotdash":
|
|
53189
|
+
case "dashlong":
|
|
53190
|
+
case "dashlongheavy":
|
|
53191
|
+
if (approximate) {
|
|
53192
|
+
add("text-decoration-style", "dashed");
|
|
53193
|
+
if (lower.includes("heavy")) add("text-decoration-thickness", HEAVY);
|
|
53194
|
+
}
|
|
53195
|
+
break;
|
|
53196
|
+
case "dottedheavy":
|
|
53197
|
+
add("text-decoration-style", "dotted");
|
|
53198
|
+
add("text-decoration-thickness", HEAVY);
|
|
53199
|
+
break;
|
|
53200
|
+
case "dashedheavy":
|
|
53201
|
+
add("text-decoration-style", "dashed");
|
|
53202
|
+
add("text-decoration-thickness", HEAVY);
|
|
53203
|
+
break;
|
|
53204
|
+
case "wavy":
|
|
53205
|
+
add("text-decoration-style", "wavy");
|
|
53206
|
+
break;
|
|
53207
|
+
case "wavyheavy":
|
|
53208
|
+
add("text-decoration-style", "wavy");
|
|
53209
|
+
add("text-decoration-thickness", HEAVY);
|
|
53210
|
+
break;
|
|
53211
|
+
case "wavydouble":
|
|
53212
|
+
if (approximate) {
|
|
53213
|
+
add("text-decoration-style", "wavy");
|
|
53214
|
+
add("text-decoration-thickness", HEAVY);
|
|
53215
|
+
}
|
|
53216
|
+
break;
|
|
53217
|
+
}
|
|
53218
|
+
if (color) add("text-decoration-color", color);
|
|
53219
|
+
return parts.join("; ");
|
|
53220
|
+
}
|
|
51891
53221
|
const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
|
|
51892
53222
|
const handler2 = listIndexMap[listNumberingType];
|
|
51893
53223
|
return handler2 ? handler2(listLevel, lvlText, customFormat) : null;
|
|
@@ -60173,6 +61503,30 @@ const TextStyle = Mark2.create({
|
|
|
60173
61503
|
};
|
|
60174
61504
|
}
|
|
60175
61505
|
});
|
|
61506
|
+
function createCascadeToggleCommands({
|
|
61507
|
+
markName,
|
|
61508
|
+
setCommand,
|
|
61509
|
+
unsetCommand,
|
|
61510
|
+
toggleCommand,
|
|
61511
|
+
negationAttrs,
|
|
61512
|
+
isNegation,
|
|
61513
|
+
extendEmptyMarkRange
|
|
61514
|
+
} = {}) {
|
|
61515
|
+
if (!markName) throw new Error("createCascadeToggleCommands requires a markName");
|
|
61516
|
+
const capitalized = markName.charAt(0).toUpperCase() + markName.slice(1);
|
|
61517
|
+
const setName = setCommand ?? `set${capitalized}`;
|
|
61518
|
+
const unsetName = unsetCommand ?? `unset${capitalized}`;
|
|
61519
|
+
const toggleName = toggleCommand ?? `toggle${capitalized}`;
|
|
61520
|
+
const cascadeOptions = {};
|
|
61521
|
+
if (negationAttrs) cascadeOptions.negationAttrs = negationAttrs;
|
|
61522
|
+
if (typeof isNegation === "function") cascadeOptions.isNegation = isNegation;
|
|
61523
|
+
if (extendEmptyMarkRange !== void 0) cascadeOptions.extendEmptyMarkRange = extendEmptyMarkRange;
|
|
61524
|
+
return {
|
|
61525
|
+
[setName]: () => ({ commands: commands2 }) => commands2.setMark(markName),
|
|
61526
|
+
[unsetName]: () => ({ commands: commands2 }) => commands2.unsetMark(markName),
|
|
61527
|
+
[toggleName]: () => ({ commands: commands2 }) => commands2.toggleMarkCascade(markName, cascadeOptions)
|
|
61528
|
+
};
|
|
61529
|
+
}
|
|
60176
61530
|
const Bold = Mark2.create({
|
|
60177
61531
|
name: "bold",
|
|
60178
61532
|
addOptions() {
|
|
@@ -60207,9 +61561,18 @@ const Bold = Mark2.create({
|
|
|
60207
61561
|
];
|
|
60208
61562
|
},
|
|
60209
61563
|
renderDOM({ htmlAttributes }) {
|
|
60210
|
-
|
|
61564
|
+
const merged = Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
61565
|
+
const { value, ...rest } = merged || {};
|
|
61566
|
+
if (value === "0") {
|
|
61567
|
+
return ["span", rest, 0];
|
|
61568
|
+
}
|
|
61569
|
+
return ["strong", rest, 0];
|
|
60211
61570
|
},
|
|
60212
61571
|
addCommands() {
|
|
61572
|
+
const { setBold, unsetBold, toggleBold } = createCascadeToggleCommands({
|
|
61573
|
+
markName: this.name,
|
|
61574
|
+
negationAttrs: { value: "0" }
|
|
61575
|
+
});
|
|
60213
61576
|
return {
|
|
60214
61577
|
/**
|
|
60215
61578
|
* Apply bold formatting
|
|
@@ -60219,7 +61582,7 @@ const Bold = Mark2.create({
|
|
|
60219
61582
|
* setBold()
|
|
60220
61583
|
* @note '0' renders as normal weight
|
|
60221
61584
|
*/
|
|
60222
|
-
setBold
|
|
61585
|
+
setBold,
|
|
60223
61586
|
/**
|
|
60224
61587
|
* Remove bold formatting
|
|
60225
61588
|
* @category Command
|
|
@@ -60227,7 +61590,7 @@ const Bold = Mark2.create({
|
|
|
60227
61590
|
* @example
|
|
60228
61591
|
* unsetBold()
|
|
60229
61592
|
*/
|
|
60230
|
-
unsetBold
|
|
61593
|
+
unsetBold,
|
|
60231
61594
|
/**
|
|
60232
61595
|
* Toggle bold formatting
|
|
60233
61596
|
* @category Command
|
|
@@ -60235,7 +61598,7 @@ const Bold = Mark2.create({
|
|
|
60235
61598
|
* @example
|
|
60236
61599
|
* toggleBold()
|
|
60237
61600
|
*/
|
|
60238
|
-
toggleBold
|
|
61601
|
+
toggleBold
|
|
60239
61602
|
};
|
|
60240
61603
|
},
|
|
60241
61604
|
addShortcuts() {
|
|
@@ -60252,6 +61615,22 @@ const Italic = Mark2.create({
|
|
|
60252
61615
|
htmlAttributes: {}
|
|
60253
61616
|
};
|
|
60254
61617
|
},
|
|
61618
|
+
addAttributes() {
|
|
61619
|
+
return {
|
|
61620
|
+
/**
|
|
61621
|
+
* @category Attribute
|
|
61622
|
+
* @param {string} [value] - Italic toggle value ('0' renders as normal)
|
|
61623
|
+
*/
|
|
61624
|
+
value: {
|
|
61625
|
+
default: null,
|
|
61626
|
+
renderDOM: (attrs) => {
|
|
61627
|
+
if (!attrs.value) return {};
|
|
61628
|
+
if (attrs.value === "0") return { style: "font-style: normal" };
|
|
61629
|
+
return {};
|
|
61630
|
+
}
|
|
61631
|
+
}
|
|
61632
|
+
};
|
|
61633
|
+
},
|
|
60255
61634
|
parseDOM() {
|
|
60256
61635
|
return [
|
|
60257
61636
|
{ tag: "i" },
|
|
@@ -60261,9 +61640,18 @@ const Italic = Mark2.create({
|
|
|
60261
61640
|
];
|
|
60262
61641
|
},
|
|
60263
61642
|
renderDOM({ htmlAttributes }) {
|
|
60264
|
-
|
|
61643
|
+
const merged = Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
61644
|
+
const { value, ...rest } = merged || {};
|
|
61645
|
+
if (value === "0") {
|
|
61646
|
+
return ["span", rest, 0];
|
|
61647
|
+
}
|
|
61648
|
+
return ["em", rest, 0];
|
|
60265
61649
|
},
|
|
60266
61650
|
addCommands() {
|
|
61651
|
+
const { setItalic, unsetItalic, toggleItalic } = createCascadeToggleCommands({
|
|
61652
|
+
markName: this.name,
|
|
61653
|
+
negationAttrs: { value: "0" }
|
|
61654
|
+
});
|
|
60267
61655
|
return {
|
|
60268
61656
|
/**
|
|
60269
61657
|
* Apply italic formatting
|
|
@@ -60272,7 +61660,7 @@ const Italic = Mark2.create({
|
|
|
60272
61660
|
* @example
|
|
60273
61661
|
* setItalic()
|
|
60274
61662
|
*/
|
|
60275
|
-
setItalic
|
|
61663
|
+
setItalic,
|
|
60276
61664
|
/**
|
|
60277
61665
|
* Remove italic formatting
|
|
60278
61666
|
* @category Command
|
|
@@ -60280,7 +61668,7 @@ const Italic = Mark2.create({
|
|
|
60280
61668
|
* @example
|
|
60281
61669
|
* unsetItalic()
|
|
60282
61670
|
*/
|
|
60283
|
-
unsetItalic
|
|
61671
|
+
unsetItalic,
|
|
60284
61672
|
/**
|
|
60285
61673
|
* Toggle italic formatting
|
|
60286
61674
|
* @category Command
|
|
@@ -60288,7 +61676,7 @@ const Italic = Mark2.create({
|
|
|
60288
61676
|
* @example
|
|
60289
61677
|
* toggleItalic()
|
|
60290
61678
|
*/
|
|
60291
|
-
toggleItalic
|
|
61679
|
+
toggleItalic
|
|
60292
61680
|
};
|
|
60293
61681
|
},
|
|
60294
61682
|
addShortcuts() {
|
|
@@ -60313,7 +61701,16 @@ const Underline = Mark2.create({
|
|
|
60313
61701
|
];
|
|
60314
61702
|
},
|
|
60315
61703
|
renderDOM({ htmlAttributes }) {
|
|
60316
|
-
|
|
61704
|
+
const merged = Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
61705
|
+
const type2 = merged?.underlineType;
|
|
61706
|
+
const color = merged?.underlineColor;
|
|
61707
|
+
const css = getUnderlineCssString({ type: type2, color });
|
|
61708
|
+
const { style: style2, ...rest } = merged || {};
|
|
61709
|
+
const styleString = [style2, css].filter(Boolean).join("; ");
|
|
61710
|
+
if (type2 === "none") {
|
|
61711
|
+
return ["span", { ...rest, ...styleString ? { style: styleString } : {} }, 0];
|
|
61712
|
+
}
|
|
61713
|
+
return ["u", { ...rest, ...styleString ? { style: styleString } : {} }, 0];
|
|
60317
61714
|
},
|
|
60318
61715
|
addAttributes() {
|
|
60319
61716
|
return {
|
|
@@ -60323,10 +61720,18 @@ const Underline = Mark2.create({
|
|
|
60323
61720
|
*/
|
|
60324
61721
|
underlineType: {
|
|
60325
61722
|
default: "single"
|
|
61723
|
+
},
|
|
61724
|
+
underlineColor: {
|
|
61725
|
+
default: null
|
|
60326
61726
|
}
|
|
60327
61727
|
};
|
|
60328
61728
|
},
|
|
60329
61729
|
addCommands() {
|
|
61730
|
+
const { setUnderline, unsetUnderline, toggleUnderline } = createCascadeToggleCommands({
|
|
61731
|
+
markName: this.name,
|
|
61732
|
+
negationAttrs: { underlineType: "none" },
|
|
61733
|
+
isNegation: (attrs) => attrs?.underlineType === "none"
|
|
61734
|
+
});
|
|
60330
61735
|
return {
|
|
60331
61736
|
/**
|
|
60332
61737
|
* Apply underline formatting
|
|
@@ -60335,7 +61740,7 @@ const Underline = Mark2.create({
|
|
|
60335
61740
|
* @example
|
|
60336
61741
|
* setUnderline()
|
|
60337
61742
|
*/
|
|
60338
|
-
setUnderline
|
|
61743
|
+
setUnderline,
|
|
60339
61744
|
/**
|
|
60340
61745
|
* Remove underline formatting
|
|
60341
61746
|
* @category Command
|
|
@@ -60343,7 +61748,7 @@ const Underline = Mark2.create({
|
|
|
60343
61748
|
* @example
|
|
60344
61749
|
* unsetUnderline()
|
|
60345
61750
|
*/
|
|
60346
|
-
unsetUnderline
|
|
61751
|
+
unsetUnderline,
|
|
60347
61752
|
/**
|
|
60348
61753
|
* Toggle underline formatting
|
|
60349
61754
|
* @category Command
|
|
@@ -60351,7 +61756,7 @@ const Underline = Mark2.create({
|
|
|
60351
61756
|
* @example
|
|
60352
61757
|
* toggleUnderline()
|
|
60353
61758
|
*/
|
|
60354
|
-
toggleUnderline
|
|
61759
|
+
toggleUnderline
|
|
60355
61760
|
};
|
|
60356
61761
|
},
|
|
60357
61762
|
addShortcuts() {
|
|
@@ -60446,9 +61851,18 @@ const Strike = Mark2.create({
|
|
|
60446
61851
|
];
|
|
60447
61852
|
},
|
|
60448
61853
|
renderDOM({ htmlAttributes }) {
|
|
60449
|
-
|
|
61854
|
+
const merged = Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
61855
|
+
const { value, ...rest } = merged || {};
|
|
61856
|
+
if (value === "0") {
|
|
61857
|
+
return ["span", rest, 0];
|
|
61858
|
+
}
|
|
61859
|
+
return ["s", rest, 0];
|
|
60450
61860
|
},
|
|
60451
61861
|
addCommands() {
|
|
61862
|
+
const { setStrike, unsetStrike, toggleStrike } = createCascadeToggleCommands({
|
|
61863
|
+
markName: this.name,
|
|
61864
|
+
negationAttrs: { value: "0" }
|
|
61865
|
+
});
|
|
60452
61866
|
return {
|
|
60453
61867
|
/**
|
|
60454
61868
|
* Apply strikethrough formatting
|
|
@@ -60457,9 +61871,7 @@ const Strike = Mark2.create({
|
|
|
60457
61871
|
* @example
|
|
60458
61872
|
* setStrike()
|
|
60459
61873
|
*/
|
|
60460
|
-
setStrike
|
|
60461
|
-
return commands2.setMark(this.name);
|
|
60462
|
-
},
|
|
61874
|
+
setStrike,
|
|
60463
61875
|
/**
|
|
60464
61876
|
* Remove strikethrough formatting
|
|
60465
61877
|
* @category Command
|
|
@@ -60467,9 +61879,7 @@ const Strike = Mark2.create({
|
|
|
60467
61879
|
* @example
|
|
60468
61880
|
* unsetStrike()
|
|
60469
61881
|
*/
|
|
60470
|
-
unsetStrike
|
|
60471
|
-
return commands2.unsetMark(this.name);
|
|
60472
|
-
},
|
|
61882
|
+
unsetStrike,
|
|
60473
61883
|
/**
|
|
60474
61884
|
* Toggle strikethrough formatting
|
|
60475
61885
|
* @category Command
|
|
@@ -60477,8 +61887,24 @@ const Strike = Mark2.create({
|
|
|
60477
61887
|
* @example
|
|
60478
61888
|
* toggleStrike()
|
|
60479
61889
|
*/
|
|
60480
|
-
toggleStrike
|
|
60481
|
-
|
|
61890
|
+
toggleStrike
|
|
61891
|
+
};
|
|
61892
|
+
},
|
|
61893
|
+
addAttributes() {
|
|
61894
|
+
return {
|
|
61895
|
+
/**
|
|
61896
|
+
* @category Attribute
|
|
61897
|
+
* @param {string} [value] - Strike toggle value ('0' renders as normal)
|
|
61898
|
+
*/
|
|
61899
|
+
value: {
|
|
61900
|
+
default: null,
|
|
61901
|
+
renderDOM: (attrs) => {
|
|
61902
|
+
if (!attrs.value) return {};
|
|
61903
|
+
if (attrs.value === "0") {
|
|
61904
|
+
return { style: "text-decoration: none" };
|
|
61905
|
+
}
|
|
61906
|
+
return {};
|
|
61907
|
+
}
|
|
60482
61908
|
}
|
|
60483
61909
|
};
|
|
60484
61910
|
},
|
|
@@ -66633,7 +68059,7 @@ const getStarterExtensions = () => {
|
|
|
66633
68059
|
Paragraph,
|
|
66634
68060
|
LineBreak,
|
|
66635
68061
|
HardBreak,
|
|
66636
|
-
|
|
68062
|
+
Run,
|
|
66637
68063
|
SlashMenu,
|
|
66638
68064
|
Strike,
|
|
66639
68065
|
TabNode,
|
|
@@ -69164,7 +70590,7 @@ function resolveTo(selector) {
|
|
|
69164
70590
|
if (typeof selector === "string") {
|
|
69165
70591
|
return document.querySelector(selector);
|
|
69166
70592
|
}
|
|
69167
|
-
return selector()
|
|
70593
|
+
return selector();
|
|
69168
70594
|
}
|
|
69169
70595
|
const LazyTeleport = vue.defineComponent({
|
|
69170
70596
|
name: "LazyTeleport",
|
|
@@ -69252,11 +70678,8 @@ const oppositeAlignCssPositionProps = {
|
|
|
69252
70678
|
};
|
|
69253
70679
|
const keepOffsetDirection = {
|
|
69254
70680
|
top: true,
|
|
69255
|
-
// top++
|
|
69256
70681
|
bottom: false,
|
|
69257
|
-
// top--
|
|
69258
70682
|
left: true,
|
|
69259
|
-
// left++
|
|
69260
70683
|
right: false
|
|
69261
70684
|
// left--
|
|
69262
70685
|
};
|
|
@@ -70373,6 +71796,7 @@ function isFocusable(element) {
|
|
|
70373
71796
|
return !!element.href && element.rel !== "ignore";
|
|
70374
71797
|
case "INPUT":
|
|
70375
71798
|
return element.type !== "hidden" && element.type !== "file";
|
|
71799
|
+
case "BUTTON":
|
|
70376
71800
|
case "SELECT":
|
|
70377
71801
|
case "TEXTAREA":
|
|
70378
71802
|
return true;
|
|
@@ -70391,8 +71815,8 @@ const FocusTrap = vue.defineComponent({
|
|
|
70391
71815
|
default: true
|
|
70392
71816
|
},
|
|
70393
71817
|
onEsc: Function,
|
|
70394
|
-
initialFocusTo:
|
|
70395
|
-
finalFocusTo:
|
|
71818
|
+
initialFocusTo: String,
|
|
71819
|
+
finalFocusTo: String,
|
|
70396
71820
|
returnFocusOnDeactivated: {
|
|
70397
71821
|
type: Boolean,
|
|
70398
71822
|
default: true
|
|
@@ -72490,7 +73914,6 @@ function self$6(vars) {
|
|
|
72490
73914
|
});
|
|
72491
73915
|
}
|
|
72492
73916
|
const scrollbarLight = {
|
|
72493
|
-
name: "Scrollbar",
|
|
72494
73917
|
common: derived,
|
|
72495
73918
|
self: self$6
|
|
72496
73919
|
};
|
|
@@ -74006,14 +75429,11 @@ function self$5(vars) {
|
|
|
74006
75429
|
boxShadow: boxShadow2
|
|
74007
75430
|
});
|
|
74008
75431
|
}
|
|
74009
|
-
const popoverLight =
|
|
75432
|
+
const popoverLight = {
|
|
74010
75433
|
name: "Popover",
|
|
74011
75434
|
common: derived,
|
|
74012
|
-
peers: {
|
|
74013
|
-
Scrollbar: scrollbarLight
|
|
74014
|
-
},
|
|
74015
75435
|
self: self$5
|
|
74016
|
-
}
|
|
75436
|
+
};
|
|
74017
75437
|
const oppositePlacement = {
|
|
74018
75438
|
top: "bottom",
|
|
74019
75439
|
bottom: "top",
|
|
@@ -74233,11 +75653,9 @@ const NPopoverBody = vue.defineComponent({
|
|
|
74233
75653
|
const {
|
|
74234
75654
|
namespaceRef,
|
|
74235
75655
|
mergedClsPrefixRef,
|
|
74236
|
-
inlineThemeDisabled
|
|
74237
|
-
mergedRtlRef
|
|
75656
|
+
inlineThemeDisabled
|
|
74238
75657
|
} = useConfig(props);
|
|
74239
75658
|
const themeRef = useTheme("Popover", "-popover", style$3, popoverLight, props, mergedClsPrefixRef);
|
|
74240
|
-
const rtlEnabledRef = useRtl("Popover", mergedRtlRef, mergedClsPrefixRef);
|
|
74241
75659
|
const followerRef = vue.ref(null);
|
|
74242
75660
|
const NPopover2 = vue.inject("NPopover");
|
|
74243
75661
|
const bodyRef = vue.ref(null);
|
|
@@ -74435,8 +75853,6 @@ const NPopoverBody = vue.defineComponent({
|
|
|
74435
75853
|
style: props.contentStyle
|
|
74436
75854
|
}, slots);
|
|
74437
75855
|
const maybeScrollableBody = props.scrollable ? vue.h(XScrollbar, {
|
|
74438
|
-
themeOverrides: themeRef.value.peerOverrides.Scrollbar,
|
|
74439
|
-
theme: themeRef.value.peers.Scrollbar,
|
|
74440
75856
|
contentClass: hasHeaderOrFooter ? void 0 : `${mergedClsPrefix}-popover__content ${(_b = props.contentClass) !== null && _b !== void 0 ? _b : ""}`,
|
|
74441
75857
|
contentStyle: hasHeaderOrFooter ? void 0 : props.contentStyle
|
|
74442
75858
|
}, {
|
|
@@ -74452,7 +75868,7 @@ const NPopoverBody = vue.defineComponent({
|
|
|
74452
75868
|
return [maybeScrollableBody, arrow2];
|
|
74453
75869
|
};
|
|
74454
75870
|
contentNode = vue.h("div", vue.mergeProps({
|
|
74455
|
-
class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`,
|
|
75871
|
+
class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, extraClass.map((v2) => `${mergedClsPrefix}-${v2}`), {
|
|
74456
75872
|
[`${mergedClsPrefix}-popover--scrollable`]: props.scrollable,
|
|
74457
75873
|
[`${mergedClsPrefix}-popover--show-header-or-footer`]: hasHeaderOrFooter,
|
|
74458
75874
|
[`${mergedClsPrefix}-popover--raw`]: props.raw,
|
|
@@ -74476,7 +75892,7 @@ const NPopoverBody = vue.defineComponent({
|
|
|
74476
75892
|
// The popover class and overlap class must exists, they will be used
|
|
74477
75893
|
// to place the body & transition animation.
|
|
74478
75894
|
// Shadow class exists for reuse box-shadow.
|
|
74479
|
-
[`${mergedClsPrefix}-popover-shared`,
|
|
75895
|
+
[`${mergedClsPrefix}-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, props.overlap && `${mergedClsPrefix}-popover-shared--overlap`, props.showArrow && `${mergedClsPrefix}-popover-shared--show-arrow`, props.arrowPointToCenter && `${mergedClsPrefix}-popover-shared--center-arrow`],
|
|
74480
75896
|
bodyRef,
|
|
74481
75897
|
styleRef.value,
|
|
74482
75898
|
handleMouseEnter,
|
|
@@ -79953,10 +81369,14 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
79953
81369
|
* @param {string} params.argument - The color to set
|
|
79954
81370
|
* @returns {void}
|
|
79955
81371
|
*/
|
|
79956
|
-
setColor: ({
|
|
79957
|
-
|
|
79958
|
-
|
|
79959
|
-
|
|
81372
|
+
setColor: ({ argument }) => {
|
|
81373
|
+
if (!argument || !this.activeEditor) return;
|
|
81374
|
+
const isNone = argument === "none";
|
|
81375
|
+
const value = isNone ? "inherit" : argument;
|
|
81376
|
+
if (this.activeEditor?.commands?.setColor) this.activeEditor.commands.setColor(value);
|
|
81377
|
+
const argValue = isNone ? null : argument;
|
|
81378
|
+
this.activeEditor?.commands.setFieldAnnotationsTextColor(argValue, true);
|
|
81379
|
+
this.updateToolbarState();
|
|
79960
81380
|
},
|
|
79961
81381
|
/**
|
|
79962
81382
|
* Sets the highlight color for text
|
|
@@ -79965,12 +81385,14 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
79965
81385
|
* @param {string} params.argument - The highlight color to set
|
|
79966
81386
|
* @returns {void}
|
|
79967
81387
|
*/
|
|
79968
|
-
setHighlight: ({
|
|
79969
|
-
|
|
79970
|
-
|
|
79971
|
-
|
|
79972
|
-
|
|
79973
|
-
|
|
81388
|
+
setHighlight: ({ argument }) => {
|
|
81389
|
+
if (!argument || !this.activeEditor) return;
|
|
81390
|
+
const inlineColor = argument !== "none" ? argument : "transparent";
|
|
81391
|
+
if (this.activeEditor?.commands?.setHighlight) this.activeEditor.commands.setHighlight(inlineColor);
|
|
81392
|
+
const argValue = argument !== "none" ? argument : null;
|
|
81393
|
+
this.activeEditor?.commands.setFieldAnnotationsTextHighlight(argValue, true);
|
|
81394
|
+
this.activeEditor?.commands.setCellBackground(argValue);
|
|
81395
|
+
this.updateToolbarState();
|
|
79974
81396
|
},
|
|
79975
81397
|
/**
|
|
79976
81398
|
* Toggles the ruler visibility
|
|
@@ -80337,7 +81759,6 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
80337
81759
|
if (!command2) {
|
|
80338
81760
|
return;
|
|
80339
81761
|
}
|
|
80340
|
-
this.log("(emmitCommand) Command:", command2, "\n item:", item, "\n argument:", argument, "\n option:", option);
|
|
80341
81762
|
if (command2 in __privateGet(this, _interceptedCommands)) {
|
|
80342
81763
|
return __privateGet(this, _interceptedCommands)[command2]({ item, argument });
|
|
80343
81764
|
}
|
|
@@ -81900,11 +83321,32 @@ const _sfc_main = {
|
|
|
81900
83321
|
}
|
|
81901
83322
|
};
|
|
81902
83323
|
const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
|
|
81903
|
-
const
|
|
81904
|
-
|
|
81905
|
-
"w:
|
|
81906
|
-
"w:
|
|
81907
|
-
|
|
83324
|
+
const baseHandlers = {
|
|
83325
|
+
...runPropertyTranslators,
|
|
83326
|
+
"w:br": translator$v,
|
|
83327
|
+
"w:cantSplit": translator$r,
|
|
83328
|
+
"w:cnfStyle": translator$q,
|
|
83329
|
+
"w:divId": translator$p,
|
|
83330
|
+
"w:gridAfter": translator$o,
|
|
83331
|
+
"w:gridBefore": translator$n,
|
|
83332
|
+
"w:hidden": translator$m,
|
|
83333
|
+
"w:hyperlink": translator$c,
|
|
83334
|
+
"w:jc": translator$l,
|
|
83335
|
+
"w:p": translator$s,
|
|
83336
|
+
"w:r": translator,
|
|
83337
|
+
"w:rPr": translator$1,
|
|
83338
|
+
"w:sdt": translator$b,
|
|
83339
|
+
"w:tab": translator$t,
|
|
83340
|
+
"w:tblCellSpacing": translator$k,
|
|
83341
|
+
"w:tblHeader": translator$j,
|
|
83342
|
+
"w:tc": translator$d,
|
|
83343
|
+
"w:tr": translator$e,
|
|
83344
|
+
"w:trHeight": translator$i,
|
|
83345
|
+
"w:trPr": translator$f,
|
|
83346
|
+
"w:wAfter": translator$h,
|
|
83347
|
+
"w:wBefore": translator$g
|
|
83348
|
+
};
|
|
83349
|
+
const registeredHandlers = Object.freeze(baseHandlers);
|
|
81908
83350
|
const Extensions = {
|
|
81909
83351
|
Node: Node$1,
|
|
81910
83352
|
Attribute: Attribute2,
|