@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
package/dist/superdoc.umd.js
CHANGED
|
@@ -1385,7 +1385,7 @@
|
|
|
1385
1385
|
shallowReadonlyMap
|
|
1386
1386
|
);
|
|
1387
1387
|
}
|
|
1388
|
-
function createReactiveObject(target, isReadonly2,
|
|
1388
|
+
function createReactiveObject(target, isReadonly2, baseHandlers2, collectionHandlers, proxyMap) {
|
|
1389
1389
|
if (!isObject$3(target)) {
|
|
1390
1390
|
return target;
|
|
1391
1391
|
}
|
|
@@ -1402,7 +1402,7 @@
|
|
|
1402
1402
|
}
|
|
1403
1403
|
const proxy = new Proxy(
|
|
1404
1404
|
target,
|
|
1405
|
-
targetType === 2 ? collectionHandlers :
|
|
1405
|
+
targetType === 2 ? collectionHandlers : baseHandlers2
|
|
1406
1406
|
);
|
|
1407
1407
|
proxyMap.set(target, proxy);
|
|
1408
1408
|
return proxy;
|
|
@@ -22619,25 +22619,47 @@
|
|
|
22619
22619
|
const defaults = xmlDoc.querySelectorAll("Default");
|
|
22620
22620
|
return Array.from(defaults).map((item) => item.getAttribute("Extension"));
|
|
22621
22621
|
};
|
|
22622
|
+
const DOCX_HIGHLIGHT_KEYWORD_MAP = /* @__PURE__ */ new Map([
|
|
22623
|
+
["yellow", "FFFF00"],
|
|
22624
|
+
["green", "00FF00"],
|
|
22625
|
+
["blue", "0000FF"],
|
|
22626
|
+
["cyan", "00FFFF"],
|
|
22627
|
+
["magenta", "FF00FF"],
|
|
22628
|
+
["red", "FF0000"],
|
|
22629
|
+
["darkYellow", "808000"],
|
|
22630
|
+
["darkGreen", "008000"],
|
|
22631
|
+
["darkBlue", "000080"],
|
|
22632
|
+
["darkCyan", "008080"],
|
|
22633
|
+
["darkMagenta", "800080"],
|
|
22634
|
+
["darkGray", "808080"],
|
|
22635
|
+
["darkRed", "800000"],
|
|
22636
|
+
["lightGray", "C0C0C0"],
|
|
22637
|
+
["black", "000000"],
|
|
22638
|
+
["white", "FFFFFF"]
|
|
22639
|
+
]);
|
|
22640
|
+
const normalizeHexColor = (hex2) => {
|
|
22641
|
+
if (!hex2) return null;
|
|
22642
|
+
let value = hex2.replace("#", "").trim();
|
|
22643
|
+
if (!value) return null;
|
|
22644
|
+
value = value.toUpperCase();
|
|
22645
|
+
if (value.length === 3)
|
|
22646
|
+
value = value.split("").map((c2) => c2 + c2).join("");
|
|
22647
|
+
if (value.length === 8) value = value.slice(0, 6);
|
|
22648
|
+
return value;
|
|
22649
|
+
};
|
|
22622
22650
|
const getHexColorFromDocxSystem = (docxColor) => {
|
|
22623
|
-
const
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
["darkGray", "#808080FF"],
|
|
22636
|
-
["darkRed", "#800000FF"],
|
|
22637
|
-
["lightGray", "#C0C0C0FF"],
|
|
22638
|
-
["black", "#000"]
|
|
22639
|
-
]);
|
|
22640
|
-
return colorMap.get(docxColor) || null;
|
|
22651
|
+
const hex2 = DOCX_HIGHLIGHT_KEYWORD_MAP.get(docxColor);
|
|
22652
|
+
return hex2 ? `#${hex2}` : null;
|
|
22653
|
+
};
|
|
22654
|
+
const getDocxHighlightKeywordFromHex = (hexColor) => {
|
|
22655
|
+
if (!hexColor) return null;
|
|
22656
|
+
if (DOCX_HIGHLIGHT_KEYWORD_MAP.has(hexColor)) return hexColor;
|
|
22657
|
+
const normalized = normalizeHexColor(hexColor);
|
|
22658
|
+
if (!normalized) return null;
|
|
22659
|
+
for (const [keyword, hex2] of DOCX_HIGHLIGHT_KEYWORD_MAP.entries()) {
|
|
22660
|
+
if (hex2 === normalized) return keyword;
|
|
22661
|
+
}
|
|
22662
|
+
return null;
|
|
22641
22663
|
};
|
|
22642
22664
|
function isValidHexColor(color) {
|
|
22643
22665
|
if (!color || typeof color !== "string") return false;
|
|
@@ -32038,37 +32060,37 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32038
32060
|
};
|
|
32039
32061
|
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
32040
32062
|
let NodeTranslator = _NodeTranslator;
|
|
32041
|
-
const encode$
|
|
32063
|
+
const encode$T = (attributes) => {
|
|
32042
32064
|
return attributes["w:type"];
|
|
32043
32065
|
};
|
|
32044
|
-
const decode$
|
|
32066
|
+
const decode$K = (attrs) => {
|
|
32045
32067
|
const { lineBreakType } = attrs;
|
|
32046
32068
|
return lineBreakType;
|
|
32047
32069
|
};
|
|
32048
|
-
const attrConfig$
|
|
32070
|
+
const attrConfig$z = Object.freeze({
|
|
32049
32071
|
xmlName: "w:type",
|
|
32050
32072
|
sdName: "lineBreakType",
|
|
32051
|
-
encode: encode$
|
|
32052
|
-
decode: decode$
|
|
32073
|
+
encode: encode$T,
|
|
32074
|
+
decode: decode$K
|
|
32053
32075
|
});
|
|
32054
|
-
const encode$
|
|
32076
|
+
const encode$S = (attributes) => {
|
|
32055
32077
|
const xmlAttrValue = attributes["w:clear"];
|
|
32056
32078
|
return xmlAttrValue;
|
|
32057
32079
|
};
|
|
32058
|
-
const decode$
|
|
32080
|
+
const decode$J = (attrs) => {
|
|
32059
32081
|
const { clear } = attrs;
|
|
32060
32082
|
return clear;
|
|
32061
32083
|
};
|
|
32062
|
-
const attrConfig$
|
|
32084
|
+
const attrConfig$y = Object.freeze({
|
|
32063
32085
|
xmlName: "w:clear",
|
|
32064
32086
|
sdName: "clear",
|
|
32065
|
-
encode: encode$
|
|
32066
|
-
decode: decode$
|
|
32087
|
+
encode: encode$S,
|
|
32088
|
+
decode: decode$J
|
|
32067
32089
|
});
|
|
32068
|
-
const validXmlAttributes$
|
|
32069
|
-
const XML_NODE_NAME$
|
|
32090
|
+
const validXmlAttributes$h = [attrConfig$z, attrConfig$y];
|
|
32091
|
+
const XML_NODE_NAME$j = "w:br";
|
|
32070
32092
|
const SD_NODE_NAME$6 = "lineBreak";
|
|
32071
|
-
const encode$
|
|
32093
|
+
const encode$R = (_2, encodedAttrs) => {
|
|
32072
32094
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
32073
32095
|
const translated = {
|
|
32074
32096
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -32078,7 +32100,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32078
32100
|
}
|
|
32079
32101
|
return translated;
|
|
32080
32102
|
};
|
|
32081
|
-
const decode$
|
|
32103
|
+
const decode$I = (params2, decodedAttrs) => {
|
|
32082
32104
|
const { node } = params2;
|
|
32083
32105
|
if (!node) return;
|
|
32084
32106
|
const wBreak = { name: "w:br" };
|
|
@@ -32095,63 +32117,120 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32095
32117
|
};
|
|
32096
32118
|
return translated;
|
|
32097
32119
|
};
|
|
32098
|
-
const config$
|
|
32099
|
-
xmlName: XML_NODE_NAME$
|
|
32120
|
+
const config$j = {
|
|
32121
|
+
xmlName: XML_NODE_NAME$j,
|
|
32100
32122
|
sdNodeOrKeyName: SD_NODE_NAME$6,
|
|
32101
32123
|
type: NodeTranslator.translatorTypes.NODE,
|
|
32102
|
-
encode: encode$
|
|
32103
|
-
decode: decode$
|
|
32104
|
-
attributes: validXmlAttributes$
|
|
32124
|
+
encode: encode$R,
|
|
32125
|
+
decode: decode$I,
|
|
32126
|
+
attributes: validXmlAttributes$h
|
|
32127
|
+
};
|
|
32128
|
+
const translator$v = NodeTranslator.from(config$j);
|
|
32129
|
+
const encode$Q = (attributes) => attributes?.["w:val"];
|
|
32130
|
+
const decode$H = (attrs) => attrs?.highlight;
|
|
32131
|
+
const attrConfig$x = Object.freeze({
|
|
32132
|
+
xmlName: "w:val",
|
|
32133
|
+
sdName: "highlight",
|
|
32134
|
+
encode: encode$Q,
|
|
32135
|
+
decode: decode$H
|
|
32136
|
+
});
|
|
32137
|
+
const validXmlAttributes$g = [attrConfig$x];
|
|
32138
|
+
const XML_NODE_NAME$i = "w:highlight";
|
|
32139
|
+
const SD_ATTR_KEY$b = "highlight";
|
|
32140
|
+
const encode$P = (params2, encodedAttrs = {}) => {
|
|
32141
|
+
const { nodes } = params2;
|
|
32142
|
+
const node = nodes?.[0];
|
|
32143
|
+
const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
|
|
32144
|
+
return {
|
|
32145
|
+
type: "attr",
|
|
32146
|
+
xmlName: XML_NODE_NAME$i,
|
|
32147
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
32148
|
+
attributes: { "w:val": value ?? null }
|
|
32149
|
+
};
|
|
32150
|
+
};
|
|
32151
|
+
const decode$G = (params2) => {
|
|
32152
|
+
const attrs = params2?.node?.attrs || {};
|
|
32153
|
+
const highlightValue = attrs.highlight ?? attrs.color ?? null;
|
|
32154
|
+
if (!highlightValue) return void 0;
|
|
32155
|
+
const normalizedValue = String(highlightValue).trim().toLowerCase();
|
|
32156
|
+
if (!normalizedValue || normalizedValue === "transparent" || normalizedValue === "none") {
|
|
32157
|
+
return void 0;
|
|
32158
|
+
}
|
|
32159
|
+
const keyword = getDocxHighlightKeywordFromHex(highlightValue);
|
|
32160
|
+
if (keyword) {
|
|
32161
|
+
return {
|
|
32162
|
+
name: XML_NODE_NAME$i,
|
|
32163
|
+
attributes: { "w:val": keyword }
|
|
32164
|
+
};
|
|
32165
|
+
}
|
|
32166
|
+
const fill = normalizeHexColor(highlightValue);
|
|
32167
|
+
if (!fill) return void 0;
|
|
32168
|
+
return {
|
|
32169
|
+
name: "w:shd",
|
|
32170
|
+
attributes: {
|
|
32171
|
+
"w:color": "auto",
|
|
32172
|
+
"w:val": "clear",
|
|
32173
|
+
"w:fill": fill
|
|
32174
|
+
}
|
|
32175
|
+
};
|
|
32105
32176
|
};
|
|
32106
|
-
const
|
|
32107
|
-
|
|
32177
|
+
const config$i = {
|
|
32178
|
+
xmlName: XML_NODE_NAME$i,
|
|
32179
|
+
sdNodeOrKeyName: SD_ATTR_KEY$b,
|
|
32180
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
32181
|
+
encode: encode$P,
|
|
32182
|
+
decode: decode$G,
|
|
32183
|
+
attributes: validXmlAttributes$g
|
|
32184
|
+
};
|
|
32185
|
+
const translator$u = NodeTranslator.from(config$i);
|
|
32186
|
+
const encode$O = (attributes) => {
|
|
32108
32187
|
return attributes["w:val"];
|
|
32109
32188
|
};
|
|
32110
|
-
const decode$
|
|
32189
|
+
const decode$F = (attrs) => {
|
|
32111
32190
|
const { tabSize } = attrs || {};
|
|
32112
32191
|
return tabSize;
|
|
32113
32192
|
};
|
|
32114
|
-
const attrConfig$
|
|
32193
|
+
const attrConfig$w = Object.freeze({
|
|
32115
32194
|
xmlName: "w:val",
|
|
32116
32195
|
sdName: "tabSize",
|
|
32117
|
-
encode: encode$
|
|
32118
|
-
decode: decode$
|
|
32196
|
+
encode: encode$O,
|
|
32197
|
+
decode: decode$F
|
|
32119
32198
|
});
|
|
32120
|
-
const encode$
|
|
32199
|
+
const encode$N = (attributes) => {
|
|
32121
32200
|
return attributes["w:leader"];
|
|
32122
32201
|
};
|
|
32123
|
-
const decode$
|
|
32202
|
+
const decode$E = (attrs) => {
|
|
32124
32203
|
const { leader } = attrs || {};
|
|
32125
32204
|
return leader;
|
|
32126
32205
|
};
|
|
32127
|
-
const attrConfig$
|
|
32206
|
+
const attrConfig$v = Object.freeze({
|
|
32128
32207
|
xmlName: "w:leader",
|
|
32129
32208
|
sdName: "leader",
|
|
32130
|
-
encode: encode$
|
|
32131
|
-
decode: decode$
|
|
32209
|
+
encode: encode$N,
|
|
32210
|
+
decode: decode$E
|
|
32132
32211
|
});
|
|
32133
|
-
const encode$
|
|
32212
|
+
const encode$M = (attributes) => {
|
|
32134
32213
|
return attributes["w:pos"];
|
|
32135
32214
|
};
|
|
32136
|
-
const decode$
|
|
32215
|
+
const decode$D = (attrs) => {
|
|
32137
32216
|
const { pos } = attrs || {};
|
|
32138
32217
|
return pos;
|
|
32139
32218
|
};
|
|
32140
|
-
const attrConfig$
|
|
32219
|
+
const attrConfig$u = Object.freeze({
|
|
32141
32220
|
xmlName: "w:pos",
|
|
32142
32221
|
sdName: "pos",
|
|
32143
|
-
encode: encode$
|
|
32144
|
-
decode: decode$
|
|
32222
|
+
encode: encode$M,
|
|
32223
|
+
decode: decode$D
|
|
32145
32224
|
});
|
|
32146
|
-
const validXmlAttributes$
|
|
32147
|
-
const XML_NODE_NAME$
|
|
32225
|
+
const validXmlAttributes$f = [attrConfig$w, attrConfig$u, attrConfig$v];
|
|
32226
|
+
const XML_NODE_NAME$h = "w:tab";
|
|
32148
32227
|
const SD_NODE_NAME$5 = "tab";
|
|
32149
|
-
const encode$
|
|
32228
|
+
const encode$L = (_2, encodedAttrs = {}) => {
|
|
32150
32229
|
const translated = { type: "tab" };
|
|
32151
32230
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
32152
32231
|
return translated;
|
|
32153
32232
|
};
|
|
32154
|
-
const decode$
|
|
32233
|
+
const decode$C = (params2, decodedAttrs = {}) => {
|
|
32155
32234
|
const { node } = params2 || {};
|
|
32156
32235
|
if (!node) return;
|
|
32157
32236
|
const wTab = { name: "w:tab" };
|
|
@@ -32167,15 +32246,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32167
32246
|
}
|
|
32168
32247
|
return translated;
|
|
32169
32248
|
};
|
|
32170
|
-
const config$
|
|
32171
|
-
xmlName: XML_NODE_NAME$
|
|
32249
|
+
const config$h = {
|
|
32250
|
+
xmlName: XML_NODE_NAME$h,
|
|
32172
32251
|
sdNodeOrKeyName: SD_NODE_NAME$5,
|
|
32173
32252
|
type: NodeTranslator.translatorTypes.NODE,
|
|
32174
|
-
encode: encode$
|
|
32175
|
-
decode: decode$
|
|
32176
|
-
attributes: validXmlAttributes$
|
|
32253
|
+
encode: encode$L,
|
|
32254
|
+
decode: decode$C,
|
|
32255
|
+
attributes: validXmlAttributes$f
|
|
32177
32256
|
};
|
|
32178
|
-
const translator$
|
|
32257
|
+
const translator$t = NodeTranslator.from(config$h);
|
|
32179
32258
|
const mergeTextNodes = (nodes) => {
|
|
32180
32259
|
if (!nodes || !Array.isArray(nodes)) {
|
|
32181
32260
|
return nodes;
|
|
@@ -32350,17 +32429,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32350
32429
|
function getFontFamilyValue(attributes, docx) {
|
|
32351
32430
|
const ascii = attributes["w:ascii"];
|
|
32352
32431
|
const themeAscii = attributes["w:asciiTheme"];
|
|
32353
|
-
|
|
32354
|
-
|
|
32355
|
-
|
|
32356
|
-
|
|
32357
|
-
|
|
32358
|
-
|
|
32359
|
-
|
|
32360
|
-
|
|
32361
|
-
|
|
32362
|
-
|
|
32363
|
-
|
|
32432
|
+
let resolved = ascii;
|
|
32433
|
+
if (docx && themeAscii) {
|
|
32434
|
+
const theme = docx["word/theme/theme1.xml"];
|
|
32435
|
+
if (theme?.elements?.length) {
|
|
32436
|
+
const { elements: topElements } = theme;
|
|
32437
|
+
const { elements } = topElements[0] || {};
|
|
32438
|
+
const themeElements = elements?.find((el) => el.name === "a:themeElements");
|
|
32439
|
+
const fontScheme = themeElements?.elements?.find((el) => el.name === "a:fontScheme");
|
|
32440
|
+
const majorFont = fontScheme?.elements?.find((el) => el.name === "a:majorFont");
|
|
32441
|
+
const latin = majorFont?.elements?.find((el) => el.name === "a:latin");
|
|
32442
|
+
resolved = latin?.attributes?.typeface || resolved;
|
|
32443
|
+
}
|
|
32444
|
+
}
|
|
32445
|
+
if (!resolved) return null;
|
|
32446
|
+
return SuperConverter.toCssFontFamily(resolved, docx);
|
|
32364
32447
|
}
|
|
32365
32448
|
function getIndentValue(attributes) {
|
|
32366
32449
|
let value = attributes["w:left"];
|
|
@@ -32381,7 +32464,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32381
32464
|
return getHexColorFromDocxSystem(attributes?.["w:val"]) || null;
|
|
32382
32465
|
}
|
|
32383
32466
|
function getStrikeValue(attributes) {
|
|
32384
|
-
|
|
32467
|
+
const raw = attributes?.["w:val"];
|
|
32468
|
+
if (raw === void 0 || raw === null) return "1";
|
|
32469
|
+
const value = String(raw).trim().toLowerCase();
|
|
32470
|
+
if (value === "1" || value === "true" || value === "on") return "1";
|
|
32471
|
+
return null;
|
|
32385
32472
|
}
|
|
32386
32473
|
const parseParagraphBorders = (pBdr) => {
|
|
32387
32474
|
if (!pBdr || !pBdr.elements) return {};
|
|
@@ -32745,102 +32832,102 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32745
32832
|
}
|
|
32746
32833
|
return schemaNode;
|
|
32747
32834
|
};
|
|
32748
|
-
const encode$
|
|
32835
|
+
const encode$K = (attributes) => {
|
|
32749
32836
|
return attributes["w:rsidDel"];
|
|
32750
32837
|
};
|
|
32751
|
-
const decode$
|
|
32838
|
+
const decode$B = (attrs) => {
|
|
32752
32839
|
return attrs.rsidDel;
|
|
32753
32840
|
};
|
|
32754
|
-
const attrConfig$
|
|
32841
|
+
const attrConfig$t = Object.freeze({
|
|
32755
32842
|
xmlName: "w:rsidDel",
|
|
32756
32843
|
sdName: "rsidDel",
|
|
32757
|
-
encode: encode$
|
|
32758
|
-
decode: decode$
|
|
32844
|
+
encode: encode$K,
|
|
32845
|
+
decode: decode$B
|
|
32759
32846
|
});
|
|
32760
|
-
const encode$
|
|
32847
|
+
const encode$J = (attributes) => {
|
|
32761
32848
|
return attributes["w:rsidP"];
|
|
32762
32849
|
};
|
|
32763
|
-
const decode$
|
|
32850
|
+
const decode$A = (attrs) => {
|
|
32764
32851
|
return attrs.rsidP;
|
|
32765
32852
|
};
|
|
32766
|
-
const attrConfig$
|
|
32853
|
+
const attrConfig$s = Object.freeze({
|
|
32767
32854
|
xmlName: "w:rsidP",
|
|
32768
32855
|
sdName: "rsidP",
|
|
32769
|
-
encode: encode$
|
|
32770
|
-
decode: decode$
|
|
32856
|
+
encode: encode$J,
|
|
32857
|
+
decode: decode$A
|
|
32771
32858
|
});
|
|
32772
|
-
const encode$
|
|
32859
|
+
const encode$I = (attributes) => {
|
|
32773
32860
|
return attributes["w:rsidR"];
|
|
32774
32861
|
};
|
|
32775
|
-
const decode$
|
|
32862
|
+
const decode$z = (attrs) => {
|
|
32776
32863
|
return attrs.rsidR;
|
|
32777
32864
|
};
|
|
32778
|
-
const attrConfig$
|
|
32865
|
+
const attrConfig$r = Object.freeze({
|
|
32779
32866
|
xmlName: "w:rsidR",
|
|
32780
32867
|
sdName: "rsidR",
|
|
32781
|
-
encode: encode$
|
|
32782
|
-
decode: decode$
|
|
32868
|
+
encode: encode$I,
|
|
32869
|
+
decode: decode$z
|
|
32783
32870
|
});
|
|
32784
|
-
const encode$
|
|
32871
|
+
const encode$H = (attributes) => {
|
|
32785
32872
|
return attributes["w:rsidRPr"];
|
|
32786
32873
|
};
|
|
32787
|
-
const decode$
|
|
32874
|
+
const decode$y = (attrs) => {
|
|
32788
32875
|
return attrs.rsidRPr;
|
|
32789
32876
|
};
|
|
32790
|
-
const attrConfig$
|
|
32877
|
+
const attrConfig$q = Object.freeze({
|
|
32791
32878
|
xmlName: "w:rsidRPr",
|
|
32792
32879
|
sdName: "rsidRPr",
|
|
32793
|
-
encode: encode$
|
|
32794
|
-
decode: decode$
|
|
32880
|
+
encode: encode$H,
|
|
32881
|
+
decode: decode$y
|
|
32795
32882
|
});
|
|
32796
|
-
const encode$
|
|
32883
|
+
const encode$G = (attributes) => {
|
|
32797
32884
|
return attributes["w:rsidRDefault"];
|
|
32798
32885
|
};
|
|
32799
|
-
const decode$
|
|
32886
|
+
const decode$x = (attrs) => {
|
|
32800
32887
|
return attrs.rsidRDefault;
|
|
32801
32888
|
};
|
|
32802
|
-
const attrConfig$
|
|
32889
|
+
const attrConfig$p = Object.freeze({
|
|
32803
32890
|
xmlName: "w:rsidRDefault",
|
|
32804
32891
|
sdName: "rsidRDefault",
|
|
32805
|
-
encode: encode$
|
|
32806
|
-
decode: decode$
|
|
32892
|
+
encode: encode$G,
|
|
32893
|
+
decode: decode$x
|
|
32807
32894
|
});
|
|
32808
|
-
const encode$
|
|
32895
|
+
const encode$F = (attributes) => {
|
|
32809
32896
|
return attributes["w14:paraId"];
|
|
32810
32897
|
};
|
|
32811
|
-
const decode$
|
|
32898
|
+
const decode$w = (attrs) => {
|
|
32812
32899
|
return attrs.paraId;
|
|
32813
32900
|
};
|
|
32814
|
-
const attrConfig$
|
|
32901
|
+
const attrConfig$o = Object.freeze({
|
|
32815
32902
|
xmlName: "w14:paraId",
|
|
32816
32903
|
sdName: "paraId",
|
|
32817
|
-
encode: encode$
|
|
32818
|
-
decode: decode$
|
|
32904
|
+
encode: encode$F,
|
|
32905
|
+
decode: decode$w
|
|
32819
32906
|
});
|
|
32820
|
-
const encode$
|
|
32907
|
+
const encode$E = (attributes) => {
|
|
32821
32908
|
return attributes["w14:textId"];
|
|
32822
32909
|
};
|
|
32823
|
-
const decode$
|
|
32910
|
+
const decode$v = (attrs) => {
|
|
32824
32911
|
return attrs.textId;
|
|
32825
32912
|
};
|
|
32826
|
-
const attrConfig = Object.freeze({
|
|
32913
|
+
const attrConfig$n = Object.freeze({
|
|
32827
32914
|
xmlName: "w14:textId",
|
|
32828
32915
|
sdName: "textId",
|
|
32829
|
-
encode: encode$
|
|
32830
|
-
decode: decode$
|
|
32916
|
+
encode: encode$E,
|
|
32917
|
+
decode: decode$v
|
|
32831
32918
|
});
|
|
32832
|
-
const validXmlAttributes$
|
|
32833
|
-
attrConfig$
|
|
32834
|
-
attrConfig,
|
|
32835
|
-
attrConfig$
|
|
32836
|
-
attrConfig$
|
|
32837
|
-
attrConfig$
|
|
32838
|
-
attrConfig$
|
|
32839
|
-
attrConfig$
|
|
32919
|
+
const validXmlAttributes$e = [
|
|
32920
|
+
attrConfig$o,
|
|
32921
|
+
attrConfig$n,
|
|
32922
|
+
attrConfig$r,
|
|
32923
|
+
attrConfig$p,
|
|
32924
|
+
attrConfig$s,
|
|
32925
|
+
attrConfig$q,
|
|
32926
|
+
attrConfig$t
|
|
32840
32927
|
];
|
|
32841
|
-
const XML_NODE_NAME$
|
|
32928
|
+
const XML_NODE_NAME$g = "w:p";
|
|
32842
32929
|
const SD_NODE_NAME$4 = "paragraph";
|
|
32843
|
-
const encode$
|
|
32930
|
+
const encode$D = (params2, encodedAttrs = {}) => {
|
|
32844
32931
|
const node = handleParagraphNode$1(params2);
|
|
32845
32932
|
if (!node) return void 0;
|
|
32846
32933
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -32848,7 +32935,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32848
32935
|
}
|
|
32849
32936
|
return node;
|
|
32850
32937
|
};
|
|
32851
|
-
const decode$
|
|
32938
|
+
const decode$u = (params2, decodedAttrs = {}) => {
|
|
32852
32939
|
const translated = translateParagraphNode(params2);
|
|
32853
32940
|
if (!translated) return void 0;
|
|
32854
32941
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -32856,15 +32943,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32856
32943
|
}
|
|
32857
32944
|
return translated;
|
|
32858
32945
|
};
|
|
32859
|
-
const config$
|
|
32860
|
-
xmlName: XML_NODE_NAME$
|
|
32946
|
+
const config$g = {
|
|
32947
|
+
xmlName: XML_NODE_NAME$g,
|
|
32861
32948
|
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
32862
32949
|
type: NodeTranslator.translatorTypes.NODE,
|
|
32863
|
-
encode: encode$
|
|
32864
|
-
decode: decode$
|
|
32865
|
-
attributes: validXmlAttributes$
|
|
32950
|
+
encode: encode$D,
|
|
32951
|
+
decode: decode$u,
|
|
32952
|
+
attributes: validXmlAttributes$e
|
|
32866
32953
|
};
|
|
32867
|
-
const translator$
|
|
32954
|
+
const translator$s = NodeTranslator.from(config$g);
|
|
32868
32955
|
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
32869
32956
|
handlerName,
|
|
32870
32957
|
handler: (params2) => {
|
|
@@ -32971,13 +33058,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32971
33058
|
const intValue = parseInteger(value);
|
|
32972
33059
|
return intValue != void 0 ? String(intValue) : void 0;
|
|
32973
33060
|
};
|
|
32974
|
-
const translator$
|
|
33061
|
+
const translator$r = NodeTranslator.from({
|
|
32975
33062
|
xmlName: "w:cantSplit",
|
|
32976
33063
|
sdNodeOrKeyName: "cantSplit",
|
|
32977
33064
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
32978
33065
|
decode: ({ node }) => node.attrs?.cantSplit ? {} : void 0
|
|
32979
33066
|
});
|
|
32980
|
-
const translator$
|
|
33067
|
+
const translator$q = NodeTranslator.from({
|
|
32981
33068
|
xmlName: "w:cnfStyle",
|
|
32982
33069
|
sdNodeOrKeyName: "cnfStyle",
|
|
32983
33070
|
attributes: [
|
|
@@ -33010,8 +33097,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33010
33097
|
return Object.keys(cnfStyleAttrs).length > 0 ? cnfStyleAttrs : void 0;
|
|
33011
33098
|
}
|
|
33012
33099
|
});
|
|
33013
|
-
const translator$
|
|
33014
|
-
const translator$
|
|
33100
|
+
const translator$p = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
33101
|
+
const translator$o = NodeTranslator.from(
|
|
33015
33102
|
createSingleAttrPropertyHandler(
|
|
33016
33103
|
"w:gridAfter",
|
|
33017
33104
|
null,
|
|
@@ -33020,7 +33107,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33020
33107
|
(v2) => integerToString(v2)
|
|
33021
33108
|
)
|
|
33022
33109
|
);
|
|
33023
|
-
const translator$
|
|
33110
|
+
const translator$n = NodeTranslator.from(
|
|
33024
33111
|
createSingleAttrPropertyHandler(
|
|
33025
33112
|
"w:gridBefore",
|
|
33026
33113
|
null,
|
|
@@ -33029,21 +33116,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33029
33116
|
(v2) => integerToString(v2)
|
|
33030
33117
|
)
|
|
33031
33118
|
);
|
|
33032
|
-
const translator$
|
|
33119
|
+
const translator$m = NodeTranslator.from({
|
|
33033
33120
|
xmlName: "w:hidden",
|
|
33034
33121
|
sdNodeOrKeyName: "hidden",
|
|
33035
33122
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
33036
33123
|
decode: ({ node }) => node.attrs.hidden ? {} : void 0
|
|
33037
33124
|
});
|
|
33038
|
-
const translator$
|
|
33039
|
-
const translator$
|
|
33040
|
-
const translator$
|
|
33125
|
+
const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc"));
|
|
33126
|
+
const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "cellSpacing"));
|
|
33127
|
+
const translator$j = NodeTranslator.from({
|
|
33041
33128
|
xmlName: "w:tblHeader",
|
|
33042
33129
|
sdNodeOrKeyName: "repeatHeader",
|
|
33043
33130
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
33044
33131
|
decode: ({ node }) => node.attrs.repeatHeader ? {} : void 0
|
|
33045
33132
|
});
|
|
33046
|
-
const translator$
|
|
33133
|
+
const translator$i = NodeTranslator.from({
|
|
33047
33134
|
xmlName: "w:trHeight",
|
|
33048
33135
|
sdNodeOrKeyName: "rowHeight",
|
|
33049
33136
|
encode: ({ nodes }) => {
|
|
@@ -33070,11 +33157,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33070
33157
|
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
33071
33158
|
}
|
|
33072
33159
|
});
|
|
33073
|
-
const translator$
|
|
33074
|
-
const translator$
|
|
33075
|
-
const XML_NODE_NAME$
|
|
33076
|
-
const SD_ATTR_KEY = "tableRowProperties";
|
|
33077
|
-
const encode$
|
|
33160
|
+
const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
33161
|
+
const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
33162
|
+
const XML_NODE_NAME$f = "w:trPr";
|
|
33163
|
+
const SD_ATTR_KEY$a = "tableRowProperties";
|
|
33164
|
+
const encode$C = (params2) => {
|
|
33078
33165
|
const { nodes } = params2;
|
|
33079
33166
|
const node = nodes[0];
|
|
33080
33167
|
let attributes = {
|
|
@@ -33088,12 +33175,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33088
33175
|
};
|
|
33089
33176
|
return {
|
|
33090
33177
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33091
|
-
xmlName: XML_NODE_NAME$
|
|
33092
|
-
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
33178
|
+
xmlName: XML_NODE_NAME$f,
|
|
33179
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
33093
33180
|
attributes
|
|
33094
33181
|
};
|
|
33095
33182
|
};
|
|
33096
|
-
const decode$
|
|
33183
|
+
const decode$t = (params2) => {
|
|
33097
33184
|
const { tableRowProperties = {} } = params2.node.attrs || {};
|
|
33098
33185
|
const elements = decodeProperties(propertyTranslatorsBySdName, tableRowProperties);
|
|
33099
33186
|
const newNode = {
|
|
@@ -33105,18 +33192,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33105
33192
|
return newNode;
|
|
33106
33193
|
};
|
|
33107
33194
|
const propertyTranslators = [
|
|
33108
|
-
translator$
|
|
33109
|
-
translator$
|
|
33110
|
-
translator$
|
|
33111
|
-
translator$
|
|
33112
|
-
translator$
|
|
33113
|
-
translator$
|
|
33114
|
-
translator$
|
|
33115
|
-
translator$
|
|
33116
|
-
translator$
|
|
33117
|
-
translator$
|
|
33118
|
-
translator$
|
|
33119
|
-
translator$
|
|
33195
|
+
translator$r,
|
|
33196
|
+
translator$q,
|
|
33197
|
+
translator$p,
|
|
33198
|
+
translator$o,
|
|
33199
|
+
translator$n,
|
|
33200
|
+
translator$m,
|
|
33201
|
+
translator$l,
|
|
33202
|
+
translator$k,
|
|
33203
|
+
translator$j,
|
|
33204
|
+
translator$i,
|
|
33205
|
+
translator$h,
|
|
33206
|
+
translator$g
|
|
33120
33207
|
];
|
|
33121
33208
|
const propertyTranslatorsByXmlName = {};
|
|
33122
33209
|
propertyTranslators.forEach((translator2) => {
|
|
@@ -33126,25 +33213,25 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33126
33213
|
propertyTranslators.forEach((translator2) => {
|
|
33127
33214
|
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
33128
33215
|
});
|
|
33129
|
-
const config$
|
|
33130
|
-
xmlName: XML_NODE_NAME$
|
|
33131
|
-
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
33216
|
+
const config$f = {
|
|
33217
|
+
xmlName: XML_NODE_NAME$f,
|
|
33218
|
+
sdNodeOrKeyName: SD_ATTR_KEY$a,
|
|
33132
33219
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
33133
|
-
encode: encode$
|
|
33134
|
-
decode: decode$
|
|
33220
|
+
encode: encode$C,
|
|
33221
|
+
decode: decode$t
|
|
33135
33222
|
};
|
|
33136
|
-
const translator$
|
|
33137
|
-
const XML_NODE_NAME$
|
|
33223
|
+
const translator$f = NodeTranslator.from(config$f);
|
|
33224
|
+
const XML_NODE_NAME$e = "w:tr";
|
|
33138
33225
|
const SD_NODE_NAME$3 = "tableRow";
|
|
33139
|
-
const validXmlAttributes$
|
|
33226
|
+
const validXmlAttributes$d = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
33140
33227
|
(xmlName) => createAttributeHandler(xmlName)
|
|
33141
33228
|
);
|
|
33142
|
-
const encode$
|
|
33229
|
+
const encode$B = (params2, encodedAttrs) => {
|
|
33143
33230
|
const { row, table } = params2.extraParams;
|
|
33144
33231
|
let tableRowProperties = {};
|
|
33145
33232
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
33146
33233
|
if (tPr) {
|
|
33147
|
-
({ attributes: tableRowProperties } = translator$
|
|
33234
|
+
({ attributes: tableRowProperties } = translator$f.encode({
|
|
33148
33235
|
...params2,
|
|
33149
33236
|
nodes: [tPr]
|
|
33150
33237
|
}));
|
|
@@ -33157,7 +33244,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33157
33244
|
let currentColumnIndex = 0;
|
|
33158
33245
|
const content = cellNodes?.map((n) => {
|
|
33159
33246
|
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
33160
|
-
const result = translator$
|
|
33247
|
+
const result = translator$d.encode({
|
|
33161
33248
|
...params2,
|
|
33162
33249
|
extraParams: {
|
|
33163
33250
|
...params2.extraParams,
|
|
@@ -33188,7 +33275,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33188
33275
|
}) || [];
|
|
33189
33276
|
return columnWidths;
|
|
33190
33277
|
};
|
|
33191
|
-
const decode$
|
|
33278
|
+
const decode$s = (params2, decodedAttrs) => {
|
|
33192
33279
|
const { node } = params2;
|
|
33193
33280
|
const elements = translateChildNodes(params2);
|
|
33194
33281
|
if (node.attrs?.tableRowProperties) {
|
|
@@ -33200,7 +33287,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33200
33287
|
}
|
|
33201
33288
|
}
|
|
33202
33289
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
33203
|
-
const trPr = translator$
|
|
33290
|
+
const trPr = translator$f.decode({
|
|
33204
33291
|
...params2,
|
|
33205
33292
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
33206
33293
|
});
|
|
@@ -33212,15 +33299,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33212
33299
|
elements
|
|
33213
33300
|
};
|
|
33214
33301
|
};
|
|
33215
|
-
const config$
|
|
33216
|
-
xmlName: XML_NODE_NAME$
|
|
33302
|
+
const config$e = {
|
|
33303
|
+
xmlName: XML_NODE_NAME$e,
|
|
33217
33304
|
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
33218
33305
|
type: NodeTranslator.translatorTypes.NODE,
|
|
33219
|
-
encode: encode$
|
|
33220
|
-
decode: decode$
|
|
33221
|
-
attributes: validXmlAttributes$
|
|
33306
|
+
encode: encode$B,
|
|
33307
|
+
decode: decode$s,
|
|
33308
|
+
attributes: validXmlAttributes$d
|
|
33222
33309
|
};
|
|
33223
|
-
const translator$
|
|
33310
|
+
const translator$e = NodeTranslator.from(config$e);
|
|
33224
33311
|
const handleAllTableNodes = (params2) => {
|
|
33225
33312
|
const { nodes } = params2;
|
|
33226
33313
|
if (nodes.length === 0) {
|
|
@@ -33284,7 +33371,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33284
33371
|
attrs["borders"] = borderData;
|
|
33285
33372
|
const content = [];
|
|
33286
33373
|
rows.forEach((row) => {
|
|
33287
|
-
const result = translator$
|
|
33374
|
+
const result = translator$e.encode({
|
|
33288
33375
|
...params2,
|
|
33289
33376
|
nodes: [row],
|
|
33290
33377
|
extraParams: {
|
|
@@ -33665,10 +33752,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33665
33752
|
if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
|
|
33666
33753
|
return elements;
|
|
33667
33754
|
}
|
|
33668
|
-
const XML_NODE_NAME$
|
|
33755
|
+
const XML_NODE_NAME$d = "w:tc";
|
|
33669
33756
|
const SD_NODE_NAME$2 = "tableCell";
|
|
33670
|
-
const validXmlAttributes$
|
|
33671
|
-
function encode$
|
|
33757
|
+
const validXmlAttributes$c = [];
|
|
33758
|
+
function encode$A(params2, encodedAttrs) {
|
|
33672
33759
|
const { node, table, row, rowBorders, styleTag, columnIndex, columnWidth } = params2.extraParams;
|
|
33673
33760
|
const schemaNode = handleTableCellNode({
|
|
33674
33761
|
params: params2,
|
|
@@ -33685,23 +33772,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33685
33772
|
}
|
|
33686
33773
|
return schemaNode;
|
|
33687
33774
|
}
|
|
33688
|
-
function decode$
|
|
33775
|
+
function decode$r(params2, decodedAttrs) {
|
|
33689
33776
|
const translated = translateTableCell(params2);
|
|
33690
33777
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
33691
33778
|
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
33692
33779
|
}
|
|
33693
33780
|
return translated;
|
|
33694
33781
|
}
|
|
33695
|
-
const config$
|
|
33696
|
-
xmlName: XML_NODE_NAME$
|
|
33782
|
+
const config$d = {
|
|
33783
|
+
xmlName: XML_NODE_NAME$d,
|
|
33697
33784
|
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
33698
33785
|
type: NodeTranslator.translatorTypes.NODE,
|
|
33699
|
-
encode: encode$
|
|
33700
|
-
decode: decode$
|
|
33701
|
-
attributes: validXmlAttributes$
|
|
33786
|
+
encode: encode$A,
|
|
33787
|
+
decode: decode$r,
|
|
33788
|
+
attributes: validXmlAttributes$c
|
|
33702
33789
|
};
|
|
33703
|
-
const translator$
|
|
33704
|
-
const XML_NODE_NAME$
|
|
33790
|
+
const translator$d = NodeTranslator.from(config$d);
|
|
33791
|
+
const XML_NODE_NAME$c = "w:hyperlink";
|
|
33705
33792
|
const SD_NODE_NAME$1 = "link";
|
|
33706
33793
|
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
33707
33794
|
xmlName,
|
|
@@ -33709,7 +33796,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33709
33796
|
encode: (attributes) => attributes[xmlName],
|
|
33710
33797
|
decode: (attributes) => attributes[sdName]
|
|
33711
33798
|
});
|
|
33712
|
-
const validXmlAttributes$
|
|
33799
|
+
const validXmlAttributes$b = [
|
|
33713
33800
|
_createAttributeHandler("w:anchor", "anchor"),
|
|
33714
33801
|
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
33715
33802
|
{
|
|
@@ -33722,7 +33809,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33722
33809
|
_createAttributeHandler("r:id", "rId"),
|
|
33723
33810
|
_createAttributeHandler("w:tgtFrame", "target")
|
|
33724
33811
|
];
|
|
33725
|
-
const encode$
|
|
33812
|
+
const encode$z = (params2, encodedAttrs) => {
|
|
33726
33813
|
const { nodes, docx, nodeListHandler } = params2;
|
|
33727
33814
|
const node = nodes[0];
|
|
33728
33815
|
let href = _resolveHref(docx, encodedAttrs);
|
|
@@ -33736,7 +33823,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33736
33823
|
nodes: runNodes,
|
|
33737
33824
|
path: [...params2.path || [], node]
|
|
33738
33825
|
});
|
|
33739
|
-
|
|
33826
|
+
const ensureLinkMark = (child) => {
|
|
33827
|
+
if (!child || typeof child !== "object") return child;
|
|
33828
|
+
const existingMarks = Array.isArray(child.marks) ? child.marks : [];
|
|
33829
|
+
const hasLink = existingMarks.some((mark) => mark?.type === "link");
|
|
33830
|
+
if (hasLink) return child;
|
|
33831
|
+
const linkClone = { type: "link", attrs: { ...linkMark.attrs } };
|
|
33832
|
+
return { ...child, marks: [...existingMarks, linkClone] };
|
|
33833
|
+
};
|
|
33834
|
+
if (!Array.isArray(updatedNode)) return updatedNode;
|
|
33835
|
+
return updatedNode.map((child) => ensureLinkMark(child));
|
|
33740
33836
|
};
|
|
33741
33837
|
const _resolveHref = (docx, encodedAttrs) => {
|
|
33742
33838
|
const rels = docx["word/_rels/document.xml.rels"];
|
|
@@ -33753,7 +33849,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33753
33849
|
}
|
|
33754
33850
|
return href;
|
|
33755
33851
|
};
|
|
33756
|
-
function decode$
|
|
33852
|
+
function decode$q(params2) {
|
|
33757
33853
|
const { node } = params2;
|
|
33758
33854
|
const linkMark = node.marks.find((m2) => m2.type === "link");
|
|
33759
33855
|
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
@@ -33797,15 +33893,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33797
33893
|
});
|
|
33798
33894
|
return rId;
|
|
33799
33895
|
}
|
|
33800
|
-
const config$
|
|
33801
|
-
xmlName: XML_NODE_NAME$
|
|
33896
|
+
const config$c = {
|
|
33897
|
+
xmlName: XML_NODE_NAME$c,
|
|
33802
33898
|
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
33803
33899
|
type: NodeTranslator.translatorTypes.NODE,
|
|
33804
|
-
encode: encode$
|
|
33805
|
-
decode: decode$
|
|
33806
|
-
attributes: validXmlAttributes$
|
|
33900
|
+
encode: encode$z,
|
|
33901
|
+
decode: decode$q,
|
|
33902
|
+
attributes: validXmlAttributes$b
|
|
33807
33903
|
};
|
|
33808
|
-
const translator$
|
|
33904
|
+
const translator$c = NodeTranslator.from(config$c);
|
|
33809
33905
|
function parseTagValueJSON(json) {
|
|
33810
33906
|
if (typeof json !== "string") {
|
|
33811
33907
|
return {};
|
|
@@ -33816,7 +33912,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33816
33912
|
}
|
|
33817
33913
|
try {
|
|
33818
33914
|
return JSON.parse(trimmed);
|
|
33819
|
-
} catch
|
|
33915
|
+
} catch {
|
|
33820
33916
|
return {};
|
|
33821
33917
|
}
|
|
33822
33918
|
}
|
|
@@ -35618,10 +35714,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35618
35714
|
};
|
|
35619
35715
|
return result;
|
|
35620
35716
|
}
|
|
35621
|
-
const XML_NODE_NAME = "w:sdt";
|
|
35717
|
+
const XML_NODE_NAME$b = "w:sdt";
|
|
35622
35718
|
const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
35623
|
-
const validXmlAttributes = [];
|
|
35624
|
-
function encode$
|
|
35719
|
+
const validXmlAttributes$a = [];
|
|
35720
|
+
function encode$y(params2) {
|
|
35625
35721
|
const nodes = params2.nodes;
|
|
35626
35722
|
const node = nodes[0];
|
|
35627
35723
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -35631,7 +35727,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35631
35727
|
const result = handler2(params2);
|
|
35632
35728
|
return result;
|
|
35633
35729
|
}
|
|
35634
|
-
function decode(params2
|
|
35730
|
+
function decode$p(params2) {
|
|
35635
35731
|
const { node } = params2;
|
|
35636
35732
|
if (!node || !node.type) {
|
|
35637
35733
|
return null;
|
|
@@ -35647,43 +35743,138 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35647
35743
|
const result = decoder();
|
|
35648
35744
|
return result;
|
|
35649
35745
|
}
|
|
35650
|
-
const config = {
|
|
35651
|
-
xmlName: XML_NODE_NAME,
|
|
35746
|
+
const config$b = {
|
|
35747
|
+
xmlName: XML_NODE_NAME$b,
|
|
35652
35748
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
35653
35749
|
type: NodeTranslator.translatorTypes.NODE,
|
|
35654
|
-
encode: encode$
|
|
35655
|
-
decode,
|
|
35656
|
-
attributes: validXmlAttributes
|
|
35750
|
+
encode: encode$y,
|
|
35751
|
+
decode: decode$p,
|
|
35752
|
+
attributes: validXmlAttributes$a
|
|
35753
|
+
};
|
|
35754
|
+
const translator$b = NodeTranslator.from(config$b);
|
|
35755
|
+
const encode$x = (attributes) => attributes?.["w:val"];
|
|
35756
|
+
const decode$o = (attrs) => attrs?.underline;
|
|
35757
|
+
const attrConfig$m = Object.freeze({
|
|
35758
|
+
xmlName: "w:val",
|
|
35759
|
+
sdName: "underline",
|
|
35760
|
+
encode: encode$x,
|
|
35761
|
+
decode: decode$o
|
|
35762
|
+
});
|
|
35763
|
+
const encode$w = (attributes) => attributes?.["w:color"];
|
|
35764
|
+
const decode$n = (attrs) => attrs?.color;
|
|
35765
|
+
const attrConfig$l = Object.freeze({
|
|
35766
|
+
xmlName: "w:color",
|
|
35767
|
+
sdName: "color",
|
|
35768
|
+
encode: encode$w,
|
|
35769
|
+
decode: decode$n
|
|
35770
|
+
});
|
|
35771
|
+
const encode$v = (attributes) => attributes?.["w:themeColor"];
|
|
35772
|
+
const decode$m = (attrs) => attrs?.themeColor;
|
|
35773
|
+
const attrConfig$k = Object.freeze({
|
|
35774
|
+
xmlName: "w:themeColor",
|
|
35775
|
+
sdName: "themeColor",
|
|
35776
|
+
encode: encode$v,
|
|
35777
|
+
decode: decode$m
|
|
35778
|
+
});
|
|
35779
|
+
const encode$u = (attributes) => attributes?.["w:themeTint"];
|
|
35780
|
+
const decode$l = (attrs) => attrs?.themeTint;
|
|
35781
|
+
const attrConfig$j = Object.freeze({
|
|
35782
|
+
xmlName: "w:themeTint",
|
|
35783
|
+
sdName: "themeTint",
|
|
35784
|
+
encode: encode$u,
|
|
35785
|
+
decode: decode$l
|
|
35786
|
+
});
|
|
35787
|
+
const encode$t = (attributes) => attributes?.["w:themeShade"];
|
|
35788
|
+
const decode$k = (attrs) => attrs?.themeShade;
|
|
35789
|
+
const attrConfig$i = Object.freeze({
|
|
35790
|
+
xmlName: "w:themeShade",
|
|
35791
|
+
sdName: "themeShade",
|
|
35792
|
+
encode: encode$t,
|
|
35793
|
+
decode: decode$k
|
|
35794
|
+
});
|
|
35795
|
+
const validXmlAttributes$9 = [attrConfig$m, attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
|
|
35796
|
+
const XML_NODE_NAME$a = "w:u";
|
|
35797
|
+
const SD_ATTR_KEY$9 = "underline";
|
|
35798
|
+
const encode$s = (params2, encodedAttrs = {}) => {
|
|
35799
|
+
const { nodes } = params2;
|
|
35800
|
+
const node = nodes?.[0];
|
|
35801
|
+
const sourceAttrs = node?.attributes || {};
|
|
35802
|
+
const underlineType = encodedAttrs.underline ?? sourceAttrs["w:val"];
|
|
35803
|
+
const color = encodedAttrs.color ?? sourceAttrs["w:color"];
|
|
35804
|
+
const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
|
|
35805
|
+
const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
|
|
35806
|
+
const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
|
|
35807
|
+
const attributes = { "w:val": underlineType ?? null };
|
|
35808
|
+
if (color !== void 0 && color !== null) attributes["w:color"] = color;
|
|
35809
|
+
if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
|
|
35810
|
+
if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
|
|
35811
|
+
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
35812
|
+
return {
|
|
35813
|
+
type: "attr",
|
|
35814
|
+
xmlName: XML_NODE_NAME$a,
|
|
35815
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
35816
|
+
attributes
|
|
35817
|
+
};
|
|
35657
35818
|
};
|
|
35658
|
-
const
|
|
35819
|
+
const decode$j = (params2) => {
|
|
35820
|
+
const attrs = params2?.node?.attrs || {};
|
|
35821
|
+
const underlineType = attrs.underlineType ?? attrs.underline ?? null;
|
|
35822
|
+
const color = attrs.underlineColor ?? attrs.color ?? null;
|
|
35823
|
+
const themeColor = attrs.underlineThemeColor ?? attrs.themeColor ?? null;
|
|
35824
|
+
const themeTint = attrs.underlineThemeTint ?? attrs.themeTint ?? null;
|
|
35825
|
+
const themeShade = attrs.underlineThemeShade ?? attrs.themeShade ?? null;
|
|
35826
|
+
if (!underlineType && !color && !themeColor && !themeTint && !themeShade) return void 0;
|
|
35827
|
+
const attributes = {};
|
|
35828
|
+
if (underlineType) attributes["w:val"] = underlineType;
|
|
35829
|
+
if (color) {
|
|
35830
|
+
const normalized = normalizeHexColor(color);
|
|
35831
|
+
if (normalized) attributes["w:color"] = normalized;
|
|
35832
|
+
}
|
|
35833
|
+
if (themeColor) attributes["w:themeColor"] = themeColor;
|
|
35834
|
+
if (themeTint) attributes["w:themeTint"] = themeTint;
|
|
35835
|
+
if (themeShade) attributes["w:themeShade"] = themeShade;
|
|
35836
|
+
return {
|
|
35837
|
+
name: XML_NODE_NAME$a,
|
|
35838
|
+
attributes
|
|
35839
|
+
};
|
|
35840
|
+
};
|
|
35841
|
+
const config$a = {
|
|
35842
|
+
xmlName: XML_NODE_NAME$a,
|
|
35843
|
+
sdNodeOrKeyName: SD_ATTR_KEY$9,
|
|
35844
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
35845
|
+
encode: encode$s,
|
|
35846
|
+
decode: decode$j,
|
|
35847
|
+
attributes: validXmlAttributes$9
|
|
35848
|
+
};
|
|
35849
|
+
const translator$a = NodeTranslator.from(config$a);
|
|
35659
35850
|
function exportSchemaToJson(params2) {
|
|
35660
35851
|
const { type: type2 } = params2.node || {};
|
|
35661
35852
|
const router = {
|
|
35662
35853
|
doc: translateDocumentNode,
|
|
35663
35854
|
body: translateBodyNode,
|
|
35664
35855
|
heading: translateHeadingNode,
|
|
35665
|
-
paragraph: translator$
|
|
35856
|
+
paragraph: translator$s,
|
|
35666
35857
|
text: translateTextNode,
|
|
35667
35858
|
bulletList: translateList,
|
|
35668
35859
|
orderedList: translateList,
|
|
35669
|
-
lineBreak: translator$
|
|
35860
|
+
lineBreak: translator$v,
|
|
35670
35861
|
table: translateTable,
|
|
35671
|
-
tableRow: translator$
|
|
35672
|
-
tableCell: translator$
|
|
35862
|
+
tableRow: translator$e,
|
|
35863
|
+
tableCell: translator$d,
|
|
35673
35864
|
bookmarkStart: translateBookmarkStart,
|
|
35674
|
-
fieldAnnotation: translator,
|
|
35675
|
-
tab: translator$
|
|
35865
|
+
fieldAnnotation: translator$b,
|
|
35866
|
+
tab: translator$t,
|
|
35676
35867
|
image: translateImageNode,
|
|
35677
|
-
hardBreak: translator$
|
|
35868
|
+
hardBreak: translator$v,
|
|
35678
35869
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
35679
35870
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
35680
35871
|
commentReference: () => null,
|
|
35681
35872
|
shapeContainer: translateShapeContainer,
|
|
35682
35873
|
shapeTextbox: translateShapeTextbox,
|
|
35683
35874
|
contentBlock: translateContentBlock,
|
|
35684
|
-
structuredContent: translator,
|
|
35685
|
-
structuredContentBlock: translator,
|
|
35686
|
-
documentSection: translator,
|
|
35875
|
+
structuredContent: translator$b,
|
|
35876
|
+
structuredContentBlock: translator$b,
|
|
35877
|
+
documentSection: translator$b,
|
|
35687
35878
|
"page-number": translatePageNumberNode,
|
|
35688
35879
|
"total-page-number": translateTotalPageNumberNode
|
|
35689
35880
|
};
|
|
@@ -36006,7 +36197,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36006
36197
|
const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
|
|
36007
36198
|
if (isTrackedNode) return translateTrackedNode(params2);
|
|
36008
36199
|
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
36009
|
-
if (isLinkNode) return translator$
|
|
36200
|
+
if (isLinkNode) return translator$c.decode(params2);
|
|
36010
36201
|
const { text, marks = [] } = node;
|
|
36011
36202
|
return getTextNodeForExport(text, marks, params2);
|
|
36012
36203
|
}
|
|
@@ -36491,10 +36682,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36491
36682
|
delete markElement.attributes;
|
|
36492
36683
|
markElement.type = "element";
|
|
36493
36684
|
break;
|
|
36494
|
-
case "underline":
|
|
36495
|
-
|
|
36496
|
-
|
|
36497
|
-
|
|
36685
|
+
case "underline": {
|
|
36686
|
+
const translated = translator$a.decode({
|
|
36687
|
+
node: {
|
|
36688
|
+
attrs: {
|
|
36689
|
+
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
36690
|
+
underlineColor: attrs.underlineColor ?? attrs.color ?? null,
|
|
36691
|
+
underlineThemeColor: attrs.underlineThemeColor ?? attrs.themeColor ?? null,
|
|
36692
|
+
underlineThemeTint: attrs.underlineThemeTint ?? attrs.themeTint ?? null,
|
|
36693
|
+
underlineThemeShade: attrs.underlineThemeShade ?? attrs.themeShade ?? null
|
|
36694
|
+
}
|
|
36695
|
+
}
|
|
36696
|
+
});
|
|
36697
|
+
return translated || {};
|
|
36698
|
+
}
|
|
36498
36699
|
// Text style cases
|
|
36499
36700
|
case "fontSize":
|
|
36500
36701
|
value = attrs.fontSize;
|
|
@@ -36536,12 +36737,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36536
36737
|
case "lineHeight":
|
|
36537
36738
|
markElement.attributes["w:line"] = linesToTwips(attrs.lineHeight);
|
|
36538
36739
|
break;
|
|
36539
|
-
case "highlight":
|
|
36540
|
-
|
|
36541
|
-
|
|
36542
|
-
|
|
36543
|
-
|
|
36544
|
-
break;
|
|
36740
|
+
case "highlight": {
|
|
36741
|
+
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
36742
|
+
const translated = translator$u.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
36743
|
+
return translated || {};
|
|
36744
|
+
}
|
|
36545
36745
|
}
|
|
36546
36746
|
return markElement;
|
|
36547
36747
|
}
|
|
@@ -37409,82 +37609,912 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37409
37609
|
handlerName: "trackChangeNodeHandler",
|
|
37410
37610
|
handler: handleTrackChangeNode
|
|
37411
37611
|
};
|
|
37412
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
37413
|
-
const
|
|
37414
|
-
const
|
|
37415
|
-
if (
|
|
37416
|
-
|
|
37417
|
-
|
|
37612
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$c);
|
|
37613
|
+
const encode$r = (attributes) => {
|
|
37614
|
+
const raw = attributes?.["w:val"];
|
|
37615
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
37616
|
+
if (typeof raw === "boolean") return raw;
|
|
37617
|
+
if (typeof raw === "number") return raw !== 0;
|
|
37618
|
+
const val = String(raw).trim().toLowerCase();
|
|
37619
|
+
if (val === "0" || val === "false" || val === "off") return false;
|
|
37620
|
+
if (val === "1" || val === "true" || val === "on") return true;
|
|
37621
|
+
return void 0;
|
|
37622
|
+
};
|
|
37623
|
+
const decode$i = (runProps) => {
|
|
37624
|
+
if (runProps?.bold === false) return "0";
|
|
37625
|
+
return void 0;
|
|
37626
|
+
};
|
|
37627
|
+
const attrConfig$h = Object.freeze({
|
|
37628
|
+
xmlName: "w:val",
|
|
37629
|
+
sdName: "bold",
|
|
37630
|
+
encode: encode$r,
|
|
37631
|
+
decode: decode$i
|
|
37632
|
+
});
|
|
37633
|
+
const validXmlAttributes$8 = [attrConfig$h];
|
|
37634
|
+
const XML_NODE_NAME$9 = "w:b";
|
|
37635
|
+
const SD_ATTR_KEY$8 = "bold";
|
|
37636
|
+
const encode$q = (params2, encodedAttrs = {}) => {
|
|
37637
|
+
const { nodes } = params2;
|
|
37418
37638
|
const node = nodes[0];
|
|
37419
|
-
|
|
37420
|
-
|
|
37421
|
-
|
|
37422
|
-
|
|
37423
|
-
if (
|
|
37424
|
-
|
|
37425
|
-
|
|
37426
|
-
|
|
37427
|
-
|
|
37428
|
-
|
|
37429
|
-
|
|
37430
|
-
|
|
37431
|
-
|
|
37432
|
-
|
|
37433
|
-
|
|
37434
|
-
|
|
37435
|
-
|
|
37436
|
-
|
|
37437
|
-
|
|
37438
|
-
|
|
37439
|
-
|
|
37440
|
-
|
|
37441
|
-
|
|
37442
|
-
|
|
37639
|
+
if (!node) return void 0;
|
|
37640
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$8];
|
|
37641
|
+
let attributes;
|
|
37642
|
+
if (val === false) attributes = { "w:val": "0" };
|
|
37643
|
+
else if (val === true)
|
|
37644
|
+
attributes = {};
|
|
37645
|
+
else attributes = node.attributes || {};
|
|
37646
|
+
return {
|
|
37647
|
+
type: "attr",
|
|
37648
|
+
xmlName: XML_NODE_NAME$9,
|
|
37649
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
37650
|
+
attributes
|
|
37651
|
+
};
|
|
37652
|
+
};
|
|
37653
|
+
const config$9 = {
|
|
37654
|
+
xmlName: XML_NODE_NAME$9,
|
|
37655
|
+
sdNodeOrKeyName: SD_ATTR_KEY$8,
|
|
37656
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37657
|
+
encode: encode$q,
|
|
37658
|
+
attributes: validXmlAttributes$8
|
|
37659
|
+
};
|
|
37660
|
+
const translator$9 = NodeTranslator.from(config$9);
|
|
37661
|
+
const encode$p = (attributes) => {
|
|
37662
|
+
const raw = attributes?.["w:val"];
|
|
37663
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
37664
|
+
if (typeof raw === "boolean") return raw;
|
|
37665
|
+
if (typeof raw === "number") return raw !== 0;
|
|
37666
|
+
const val = String(raw).trim().toLowerCase();
|
|
37667
|
+
if (val === "0" || val === "false" || val === "off") return false;
|
|
37668
|
+
if (val === "1" || val === "true" || val === "on") return true;
|
|
37669
|
+
return void 0;
|
|
37670
|
+
};
|
|
37671
|
+
const decode$h = (attrs) => {
|
|
37672
|
+
if (attrs?.italic === false) return "0";
|
|
37673
|
+
return void 0;
|
|
37674
|
+
};
|
|
37675
|
+
const attrConfig$g = Object.freeze({
|
|
37676
|
+
xmlName: "w:val",
|
|
37677
|
+
sdName: "italic",
|
|
37678
|
+
encode: encode$p,
|
|
37679
|
+
decode: decode$h
|
|
37680
|
+
});
|
|
37681
|
+
const validXmlAttributes$7 = [attrConfig$g];
|
|
37682
|
+
const XML_NODE_NAME$8 = "w:i";
|
|
37683
|
+
const SD_ATTR_KEY$7 = "italic";
|
|
37684
|
+
const encode$o = (params2, encodedAttrs = {}) => {
|
|
37685
|
+
const { nodes } = params2;
|
|
37686
|
+
const node = nodes?.[0];
|
|
37687
|
+
if (!node) return void 0;
|
|
37688
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$7];
|
|
37689
|
+
let attributes;
|
|
37690
|
+
if (val === false) attributes = { "w:val": "0" };
|
|
37691
|
+
else if (val === true) attributes = {};
|
|
37692
|
+
else attributes = { ...node.attributes || {} };
|
|
37693
|
+
if (attributes["w:val"] === void 0 && val !== true) attributes["w:val"] = null;
|
|
37694
|
+
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
37695
|
+
return {
|
|
37696
|
+
type: "attr",
|
|
37697
|
+
xmlName: XML_NODE_NAME$8,
|
|
37698
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
37699
|
+
attributes
|
|
37700
|
+
};
|
|
37701
|
+
};
|
|
37702
|
+
const config$8 = {
|
|
37703
|
+
xmlName: XML_NODE_NAME$8,
|
|
37704
|
+
sdNodeOrKeyName: SD_ATTR_KEY$7,
|
|
37705
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37706
|
+
encode: encode$o,
|
|
37707
|
+
attributes: validXmlAttributes$7
|
|
37708
|
+
};
|
|
37709
|
+
const translator$8 = NodeTranslator.from(config$8);
|
|
37710
|
+
const encode$n = (attributes) => {
|
|
37711
|
+
const raw = attributes?.["w:val"];
|
|
37712
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
37713
|
+
if (typeof raw === "boolean") return raw;
|
|
37714
|
+
if (typeof raw === "number") return raw !== 0;
|
|
37715
|
+
const val = String(raw).trim().toLowerCase();
|
|
37716
|
+
if (val === "0" || val === "false" || val === "off") return false;
|
|
37717
|
+
if (val === "1" || val === "true" || val === "on") return true;
|
|
37718
|
+
return void 0;
|
|
37719
|
+
};
|
|
37720
|
+
const decode$g = (attrs) => {
|
|
37721
|
+
if (attrs?.strike === false) return "0";
|
|
37722
|
+
return void 0;
|
|
37723
|
+
};
|
|
37724
|
+
const attrConfig$f = Object.freeze({
|
|
37725
|
+
xmlName: "w:val",
|
|
37726
|
+
sdName: "strike",
|
|
37727
|
+
encode: encode$n,
|
|
37728
|
+
decode: decode$g
|
|
37729
|
+
});
|
|
37730
|
+
const validXmlAttributes$6 = [attrConfig$f];
|
|
37731
|
+
const XML_NODE_NAME$7 = "w:strike";
|
|
37732
|
+
const SD_ATTR_KEY$6 = "strike";
|
|
37733
|
+
const encode$m = (params2, encodedAttrs = {}) => {
|
|
37734
|
+
const { nodes } = params2;
|
|
37735
|
+
const node = nodes?.[0];
|
|
37736
|
+
if (!node) return void 0;
|
|
37737
|
+
const val = encodedAttrs?.[SD_ATTR_KEY$6];
|
|
37738
|
+
let attributes;
|
|
37739
|
+
if (val === false) attributes = { "w:val": "0" };
|
|
37740
|
+
else if (val === true) attributes = {};
|
|
37741
|
+
else attributes = { ...node.attributes || {} };
|
|
37742
|
+
if (attributes["w:val"] === void 0 && val !== true) attributes["w:val"] = null;
|
|
37743
|
+
else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
37744
|
+
return {
|
|
37745
|
+
type: "attr",
|
|
37746
|
+
xmlName: XML_NODE_NAME$7,
|
|
37747
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
37748
|
+
attributes
|
|
37749
|
+
};
|
|
37750
|
+
};
|
|
37751
|
+
const config$7 = {
|
|
37752
|
+
xmlName: XML_NODE_NAME$7,
|
|
37753
|
+
sdNodeOrKeyName: SD_ATTR_KEY$6,
|
|
37754
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37755
|
+
encode: encode$m,
|
|
37756
|
+
attributes: validXmlAttributes$6
|
|
37757
|
+
};
|
|
37758
|
+
const translator$7 = NodeTranslator.from(config$7);
|
|
37759
|
+
const encode$l = (attributes) => attributes?.["w:val"];
|
|
37760
|
+
const decode$f = (attrs) => attrs?.color;
|
|
37761
|
+
const attrConfig$e = Object.freeze({
|
|
37762
|
+
xmlName: "w:val",
|
|
37763
|
+
sdName: "color",
|
|
37764
|
+
encode: encode$l,
|
|
37765
|
+
decode: decode$f
|
|
37766
|
+
});
|
|
37767
|
+
const encode$k = (attributes) => attributes?.["w:themeColor"];
|
|
37768
|
+
const decode$e = (attrs) => attrs?.themeColor;
|
|
37769
|
+
const attrConfig$d = Object.freeze({
|
|
37770
|
+
xmlName: "w:themeColor",
|
|
37771
|
+
sdName: "themeColor",
|
|
37772
|
+
encode: encode$k,
|
|
37773
|
+
decode: decode$e
|
|
37774
|
+
});
|
|
37775
|
+
const encode$j = (attributes) => attributes?.["w:themeTint"];
|
|
37776
|
+
const decode$d = (attrs) => attrs?.themeTint;
|
|
37777
|
+
const attrConfig$c = Object.freeze({
|
|
37778
|
+
xmlName: "w:themeTint",
|
|
37779
|
+
sdName: "themeTint",
|
|
37780
|
+
encode: encode$j,
|
|
37781
|
+
decode: decode$d
|
|
37782
|
+
});
|
|
37783
|
+
const encode$i = (attributes) => attributes?.["w:themeShade"];
|
|
37784
|
+
const decode$c = (attrs) => attrs?.themeShade;
|
|
37785
|
+
const attrConfig$b = Object.freeze({
|
|
37786
|
+
xmlName: "w:themeShade",
|
|
37787
|
+
sdName: "themeShade",
|
|
37788
|
+
encode: encode$i,
|
|
37789
|
+
decode: decode$c
|
|
37790
|
+
});
|
|
37791
|
+
const validXmlAttributes$5 = [attrConfig$e, attrConfig$d, attrConfig$c, attrConfig$b];
|
|
37792
|
+
const XML_NODE_NAME$6 = "w:color";
|
|
37793
|
+
const SD_ATTR_KEY$5 = "color";
|
|
37794
|
+
const encode$h = (params2, encodedAttrs = {}) => {
|
|
37795
|
+
const { nodes } = params2;
|
|
37796
|
+
const node = nodes?.[0];
|
|
37797
|
+
const sourceAttrs = node?.attributes || {};
|
|
37798
|
+
const value = encodedAttrs.color ?? sourceAttrs["w:val"];
|
|
37799
|
+
const themeColor = encodedAttrs.themeColor ?? sourceAttrs["w:themeColor"];
|
|
37800
|
+
const themeTint = encodedAttrs.themeTint ?? sourceAttrs["w:themeTint"];
|
|
37801
|
+
const themeShade = encodedAttrs.themeShade ?? sourceAttrs["w:themeShade"];
|
|
37802
|
+
const attributes = {};
|
|
37803
|
+
attributes["w:val"] = value ?? null;
|
|
37804
|
+
if (themeColor !== void 0 && themeColor !== null) attributes["w:themeColor"] = themeColor;
|
|
37805
|
+
if (themeTint !== void 0 && themeTint !== null) attributes["w:themeTint"] = themeTint;
|
|
37806
|
+
if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
|
|
37807
|
+
return {
|
|
37808
|
+
type: "attr",
|
|
37809
|
+
xmlName: XML_NODE_NAME$6,
|
|
37810
|
+
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
37811
|
+
attributes
|
|
37812
|
+
};
|
|
37813
|
+
};
|
|
37814
|
+
const config$6 = {
|
|
37815
|
+
xmlName: XML_NODE_NAME$6,
|
|
37816
|
+
sdNodeOrKeyName: SD_ATTR_KEY$5,
|
|
37817
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37818
|
+
encode: encode$h,
|
|
37819
|
+
attributes: validXmlAttributes$5
|
|
37820
|
+
};
|
|
37821
|
+
const translator$6 = NodeTranslator.from(config$6);
|
|
37822
|
+
const encode$g = (attributes) => attributes?.["w:eastAsia"];
|
|
37823
|
+
const decode$b = (attrs) => attrs?.eastAsia;
|
|
37824
|
+
const attrConfig$a = Object.freeze({
|
|
37825
|
+
xmlName: "w:eastAsia",
|
|
37826
|
+
sdName: "eastAsia",
|
|
37827
|
+
encode: encode$g,
|
|
37828
|
+
decode: decode$b
|
|
37829
|
+
});
|
|
37830
|
+
const encode$f = (attributes) => attributes?.["w:ascii"];
|
|
37831
|
+
const decode$a = (attrs) => attrs?.ascii;
|
|
37832
|
+
const attrConfig$9 = Object.freeze({
|
|
37833
|
+
xmlName: "w:ascii",
|
|
37834
|
+
sdName: "ascii",
|
|
37835
|
+
encode: encode$f,
|
|
37836
|
+
decode: decode$a
|
|
37837
|
+
});
|
|
37838
|
+
const encode$e = (attributes) => attributes?.["w:hAnsi"];
|
|
37839
|
+
const decode$9 = (attrs) => attrs?.hAnsi;
|
|
37840
|
+
const attrConfig$8 = Object.freeze({
|
|
37841
|
+
xmlName: "w:hAnsi",
|
|
37842
|
+
sdName: "hAnsi",
|
|
37843
|
+
encode: encode$e,
|
|
37844
|
+
decode: decode$9
|
|
37845
|
+
});
|
|
37846
|
+
const encode$d = (attributes) => attributes?.["w:cs"];
|
|
37847
|
+
const decode$8 = (attrs) => attrs?.cs;
|
|
37848
|
+
const attrConfig$7 = Object.freeze({
|
|
37849
|
+
xmlName: "w:cs",
|
|
37850
|
+
sdName: "cs",
|
|
37851
|
+
encode: encode$d,
|
|
37852
|
+
decode: decode$8
|
|
37853
|
+
});
|
|
37854
|
+
const encode$c = (attributes) => attributes?.["w:val"];
|
|
37855
|
+
const decode$7 = (attrs) => attrs?.value;
|
|
37856
|
+
const attrConfig$6 = Object.freeze({
|
|
37857
|
+
xmlName: "w:val",
|
|
37858
|
+
sdName: "value",
|
|
37859
|
+
encode: encode$c,
|
|
37860
|
+
decode: decode$7
|
|
37861
|
+
});
|
|
37862
|
+
const validXmlAttributes$4 = [attrConfig$a, attrConfig$9, attrConfig$8, attrConfig$7, attrConfig$6];
|
|
37863
|
+
const XML_NODE_NAME$5 = "w:rFonts";
|
|
37864
|
+
const SD_ATTR_KEY$4 = "fontFamily";
|
|
37865
|
+
const encode$b = (params2, encodedAttrs = {}) => {
|
|
37866
|
+
const { nodes } = params2;
|
|
37867
|
+
const node = nodes?.[0];
|
|
37868
|
+
const sourceAttrs = node?.attributes || {};
|
|
37869
|
+
const attributes = {};
|
|
37870
|
+
const setAttr = (xmlName, sdName) => {
|
|
37871
|
+
if (encodedAttrs[sdName] !== void 0 && encodedAttrs[sdName] !== null) {
|
|
37872
|
+
attributes[xmlName] = encodedAttrs[sdName];
|
|
37873
|
+
} else if (sourceAttrs[xmlName] !== void 0) {
|
|
37874
|
+
attributes[xmlName] = sourceAttrs[xmlName];
|
|
37443
37875
|
}
|
|
37444
|
-
|
|
37445
|
-
|
|
37446
|
-
|
|
37447
|
-
|
|
37448
|
-
|
|
37449
|
-
|
|
37450
|
-
|
|
37876
|
+
};
|
|
37877
|
+
setAttr("w:eastAsia", "eastAsia");
|
|
37878
|
+
setAttr("w:ascii", "ascii");
|
|
37879
|
+
setAttr("w:hAnsi", "hAnsi");
|
|
37880
|
+
setAttr("w:cs", "cs");
|
|
37881
|
+
setAttr("w:val", "value");
|
|
37882
|
+
Object.keys(sourceAttrs).forEach((key) => {
|
|
37883
|
+
if (attributes[key] === void 0) attributes[key] = sourceAttrs[key];
|
|
37884
|
+
});
|
|
37885
|
+
if (attributes["w:val"] === void 0 && attributes["w:eastAsia"]) {
|
|
37886
|
+
attributes["w:val"] = attributes["w:eastAsia"];
|
|
37887
|
+
}
|
|
37888
|
+
if (attributes["w:val"] === void 0) delete attributes["w:val"];
|
|
37889
|
+
return {
|
|
37890
|
+
type: "attr",
|
|
37891
|
+
xmlName: XML_NODE_NAME$5,
|
|
37892
|
+
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
37893
|
+
attributes
|
|
37894
|
+
};
|
|
37895
|
+
};
|
|
37896
|
+
const config$5 = {
|
|
37897
|
+
xmlName: XML_NODE_NAME$5,
|
|
37898
|
+
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
37899
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37900
|
+
encode: encode$b,
|
|
37901
|
+
attributes: validXmlAttributes$4
|
|
37902
|
+
};
|
|
37903
|
+
const translator$5 = NodeTranslator.from(config$5);
|
|
37904
|
+
const encode$a = (attributes) => attributes?.["w:val"];
|
|
37905
|
+
const decode$6 = (attrs) => attrs?.styleId;
|
|
37906
|
+
const attrConfig$5 = Object.freeze({
|
|
37907
|
+
xmlName: "w:val",
|
|
37908
|
+
sdName: "styleId",
|
|
37909
|
+
encode: encode$a,
|
|
37910
|
+
decode: decode$6
|
|
37911
|
+
});
|
|
37912
|
+
const validXmlAttributes$3 = [attrConfig$5];
|
|
37913
|
+
const XML_NODE_NAME$4 = "w:rStyle";
|
|
37914
|
+
const SD_ATTR_KEY$3 = "styleId";
|
|
37915
|
+
const encode$9 = (params2, encodedAttrs = {}) => {
|
|
37916
|
+
const { nodes } = params2;
|
|
37917
|
+
const node = nodes?.[0];
|
|
37918
|
+
const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
|
|
37919
|
+
return {
|
|
37920
|
+
type: "attr",
|
|
37921
|
+
xmlName: XML_NODE_NAME$4,
|
|
37922
|
+
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
37923
|
+
attributes: { "w:val": value ?? null }
|
|
37924
|
+
};
|
|
37925
|
+
};
|
|
37926
|
+
const config$4 = {
|
|
37927
|
+
xmlName: XML_NODE_NAME$4,
|
|
37928
|
+
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
37929
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37930
|
+
encode: encode$9,
|
|
37931
|
+
attributes: validXmlAttributes$3
|
|
37932
|
+
};
|
|
37933
|
+
const translator$4 = NodeTranslator.from(config$4);
|
|
37934
|
+
const encode$8 = (attributes) => attributes?.["w:val"];
|
|
37935
|
+
const decode$5 = (attrs) => attrs?.fontSize;
|
|
37936
|
+
const attrConfig$4 = Object.freeze({
|
|
37937
|
+
xmlName: "w:val",
|
|
37938
|
+
sdName: "fontSize",
|
|
37939
|
+
encode: encode$8,
|
|
37940
|
+
decode: decode$5
|
|
37941
|
+
});
|
|
37942
|
+
const validXmlAttributes$2 = [attrConfig$4];
|
|
37943
|
+
const XML_NODE_NAME$3 = "w:sz";
|
|
37944
|
+
const SD_ATTR_KEY$2 = "fontSize";
|
|
37945
|
+
const encode$7 = (params2, encodedAttrs = {}) => {
|
|
37946
|
+
const { nodes } = params2;
|
|
37947
|
+
const node = nodes?.[0];
|
|
37948
|
+
const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
|
|
37949
|
+
return {
|
|
37950
|
+
type: "attr",
|
|
37951
|
+
xmlName: XML_NODE_NAME$3,
|
|
37952
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
37953
|
+
attributes: { "w:val": value ?? null }
|
|
37954
|
+
};
|
|
37955
|
+
};
|
|
37956
|
+
const config$3 = {
|
|
37957
|
+
xmlName: XML_NODE_NAME$3,
|
|
37958
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
37959
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37960
|
+
encode: encode$7,
|
|
37961
|
+
attributes: validXmlAttributes$2
|
|
37962
|
+
};
|
|
37963
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
37964
|
+
const encode$6 = (attributes) => attributes?.["w:val"];
|
|
37965
|
+
const decode$4 = (attrs) => attrs?.fontSizeCs;
|
|
37966
|
+
const attrConfig$3 = Object.freeze({
|
|
37967
|
+
xmlName: "w:val",
|
|
37968
|
+
sdName: "fontSizeCs",
|
|
37969
|
+
encode: encode$6,
|
|
37970
|
+
decode: decode$4
|
|
37971
|
+
});
|
|
37972
|
+
const validXmlAttributes$1 = [attrConfig$3];
|
|
37973
|
+
const XML_NODE_NAME$2 = "w:szCs";
|
|
37974
|
+
const SD_ATTR_KEY$1 = "fontSizeCs";
|
|
37975
|
+
const encode$5 = (params2, encodedAttrs = {}) => {
|
|
37976
|
+
const { nodes } = params2;
|
|
37977
|
+
const node = nodes?.[0];
|
|
37978
|
+
const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
|
|
37979
|
+
return {
|
|
37980
|
+
type: "attr",
|
|
37981
|
+
xmlName: XML_NODE_NAME$2,
|
|
37982
|
+
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
37983
|
+
attributes: { "w:val": value ?? null }
|
|
37984
|
+
};
|
|
37985
|
+
};
|
|
37986
|
+
const config$2 = {
|
|
37987
|
+
xmlName: XML_NODE_NAME$2,
|
|
37988
|
+
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
37989
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
37990
|
+
encode: encode$5,
|
|
37991
|
+
attributes: validXmlAttributes$1
|
|
37992
|
+
};
|
|
37993
|
+
const translator$2 = NodeTranslator.from(config$2);
|
|
37994
|
+
const runPropertyTranslators = Object.freeze({
|
|
37995
|
+
"w:b": translator$9,
|
|
37996
|
+
"w:i": translator$8,
|
|
37997
|
+
"w:u": translator$a,
|
|
37998
|
+
"w:strike": translator$7,
|
|
37999
|
+
"w:color": translator$6,
|
|
38000
|
+
"w:highlight": translator$u,
|
|
38001
|
+
"w:rFonts": translator$5,
|
|
38002
|
+
"w:rStyle": translator$4,
|
|
38003
|
+
"w:sz": translator$3,
|
|
38004
|
+
"w:szCs": translator$2
|
|
38005
|
+
});
|
|
38006
|
+
const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
|
|
38007
|
+
const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
|
|
38008
|
+
const KNOWN_CHILD_XML_NAMES = /* @__PURE__ */ new Set([...Object.keys(runPropertyTranslators), ...RAW_CHILD_NAME_SET]);
|
|
38009
|
+
const toRunPropertyEntry = (candidate) => {
|
|
38010
|
+
if (!candidate || candidate.type !== "attr") return null;
|
|
38011
|
+
const xmlName = candidate.xmlName || candidate.name;
|
|
38012
|
+
if (!xmlName) return null;
|
|
38013
|
+
return {
|
|
38014
|
+
xmlName,
|
|
38015
|
+
attributes: { ...candidate.attributes || {} }
|
|
38016
|
+
};
|
|
38017
|
+
};
|
|
38018
|
+
const XML_NODE_NAME$1 = "w:rPr";
|
|
38019
|
+
const SD_ATTR_KEY = "runProperties";
|
|
38020
|
+
const encode$4 = (params2) => {
|
|
38021
|
+
const { nodes } = params2;
|
|
38022
|
+
const node = nodes?.[0] || {};
|
|
38023
|
+
const contents = Array.isArray(node.elements) ? node.elements : [];
|
|
38024
|
+
const runPropsArray = contents.reduce(
|
|
38025
|
+
(acc, child) => {
|
|
38026
|
+
if (!child || typeof child !== "object") return acc;
|
|
38027
|
+
const xmlName = child.name;
|
|
38028
|
+
if (!KNOWN_CHILD_XML_NAMES.has(xmlName)) return acc;
|
|
38029
|
+
const translator2 = runPropertyTranslators[xmlName];
|
|
38030
|
+
let entry = null;
|
|
38031
|
+
if (translator2) {
|
|
38032
|
+
const encoded = translator2.encode({ ...params2, nodes: [child] }) || null;
|
|
38033
|
+
entry = toRunPropertyEntry(encoded);
|
|
38034
|
+
} else if (RAW_CHILD_NAME_SET.has(xmlName)) {
|
|
38035
|
+
entry = toRunPropertyEntry({
|
|
38036
|
+
type: "attr",
|
|
38037
|
+
xmlName,
|
|
38038
|
+
attributes: { ...child.attributes || {} }
|
|
38039
|
+
});
|
|
37451
38040
|
}
|
|
37452
|
-
|
|
38041
|
+
if (entry) acc.push(entry);
|
|
38042
|
+
return acc;
|
|
38043
|
+
},
|
|
38044
|
+
/** @type {{ xmlName: string, attributes: Record<string, any> }[]} */
|
|
38045
|
+
[]
|
|
38046
|
+
);
|
|
38047
|
+
return {
|
|
38048
|
+
type: "attr",
|
|
38049
|
+
xmlName: "w:rPr",
|
|
38050
|
+
sdNodeOrKeyName: "runProperties",
|
|
38051
|
+
attributes: runPropsArray
|
|
38052
|
+
};
|
|
38053
|
+
};
|
|
38054
|
+
const config$1 = {
|
|
38055
|
+
xmlName: XML_NODE_NAME$1,
|
|
38056
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
38057
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
38058
|
+
encode: encode$4
|
|
38059
|
+
};
|
|
38060
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
38061
|
+
const collectRunProperties = (params2, rPrNode, translator2 = translator$1) => {
|
|
38062
|
+
if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
|
|
38063
|
+
const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
|
|
38064
|
+
let entries = [];
|
|
38065
|
+
if (Array.isArray(result.attributes) && result.attributes.length) {
|
|
38066
|
+
entries = result.attributes.map((attr) => ({
|
|
38067
|
+
xmlName: attr?.xmlName,
|
|
38068
|
+
attributes: { ...attr?.attributes || {} }
|
|
38069
|
+
}));
|
|
38070
|
+
} else if (Array.isArray(rPrNode.elements) && rPrNode.elements.length) {
|
|
38071
|
+
entries = rPrNode.elements.filter((el) => el && typeof el === "object").map((el) => ({
|
|
38072
|
+
xmlName: el.name,
|
|
38073
|
+
attributes: { ...el.attributes || {} }
|
|
38074
|
+
}));
|
|
38075
|
+
}
|
|
38076
|
+
const legacyMarks = parseMarks(rPrNode, [], params2?.docx) || [];
|
|
38077
|
+
const styleChangeMarks = handleStyleChangeMarks(rPrNode, legacyMarks) || [];
|
|
38078
|
+
return { entries, hadRPr: true, styleChangeMarks };
|
|
38079
|
+
};
|
|
38080
|
+
const buildRunAttrs = (encodedAttrs = {}, hadRPr, runProps) => {
|
|
38081
|
+
const base2 = { ...encodedAttrs || {} };
|
|
38082
|
+
if (hadRPr) {
|
|
38083
|
+
base2.runProperties = runProps.length ? runProps : null;
|
|
38084
|
+
}
|
|
38085
|
+
return base2;
|
|
38086
|
+
};
|
|
38087
|
+
const ensureRunMark = (marks, runAttrs) => {
|
|
38088
|
+
if (!runAttrs) return;
|
|
38089
|
+
const runMark = createRunMark(runAttrs);
|
|
38090
|
+
const runMarkIndex = marks.findIndex((mark) => mark?.type === "run");
|
|
38091
|
+
if (runMarkIndex >= 0) {
|
|
38092
|
+
const existing = marks[runMarkIndex];
|
|
38093
|
+
if (runMark.attrs) {
|
|
38094
|
+
marks[runMarkIndex] = { ...existing, attrs: mergeRunAttrs(existing?.attrs, runMark.attrs) };
|
|
38095
|
+
}
|
|
38096
|
+
return;
|
|
38097
|
+
}
|
|
38098
|
+
marks.push(runMark);
|
|
38099
|
+
};
|
|
38100
|
+
const ensureInlineMarks = (marks, inlineMarks = []) => {
|
|
38101
|
+
inlineMarks.forEach(({ type: type2, attrs }) => {
|
|
38102
|
+
if (!type2) return;
|
|
38103
|
+
if (marks.some((mark) => mark?.type === type2)) return;
|
|
38104
|
+
marks.push(attrs ? { type: type2, attrs: { ...attrs } } : { type: type2 });
|
|
38105
|
+
});
|
|
38106
|
+
};
|
|
38107
|
+
const ensureTextStyleMark = (marks, textStyleAttrs) => {
|
|
38108
|
+
if (!textStyleAttrs) return;
|
|
38109
|
+
const existingTextStyle = marks.find((mark) => mark?.type === "textStyle");
|
|
38110
|
+
if (existingTextStyle) {
|
|
38111
|
+
existingTextStyle.attrs = { ...existingTextStyle.attrs || {}, ...textStyleAttrs };
|
|
38112
|
+
return;
|
|
38113
|
+
}
|
|
38114
|
+
marks.push({ type: "textStyle", attrs: { ...textStyleAttrs } });
|
|
38115
|
+
};
|
|
38116
|
+
const applyRunMarks = (node, runAttrs, inlineMarks, textStyleAttrs) => {
|
|
38117
|
+
if (!node || typeof node !== "object") return node;
|
|
38118
|
+
const baseMarks = Array.isArray(node.marks) ? node.marks : [];
|
|
38119
|
+
const marks = baseMarks.map((mark) => cloneMark(mark));
|
|
38120
|
+
ensureRunMark(marks, runAttrs);
|
|
38121
|
+
ensureInlineMarks(marks, inlineMarks);
|
|
38122
|
+
if (node.type === "text") {
|
|
38123
|
+
ensureTextStyleMark(marks, textStyleAttrs);
|
|
38124
|
+
}
|
|
38125
|
+
return { ...node, marks };
|
|
38126
|
+
};
|
|
38127
|
+
const createRunMark = (attrs = {}) => {
|
|
38128
|
+
const hasAttrs = attrs && Object.keys(attrs).length > 0;
|
|
38129
|
+
return hasAttrs ? { type: "run", attrs: cloneRunAttrs(attrs) } : { type: "run" };
|
|
38130
|
+
};
|
|
38131
|
+
const deriveStyleMarks = ({ docx, paragraphStyleId, runStyleId }) => {
|
|
38132
|
+
const paragraphStyleMarks = collectStyleMarks(paragraphStyleId, docx);
|
|
38133
|
+
const runStyleMarks = collectStyleMarks(runStyleId, docx);
|
|
38134
|
+
const inlineMarks = mergeInlineMarkSets(paragraphStyleMarks.inlineMarks, runStyleMarks.inlineMarks);
|
|
38135
|
+
const textStyleAttrs = mergeTextStyleAttrs(paragraphStyleMarks.textStyleAttrs, runStyleMarks.textStyleAttrs);
|
|
38136
|
+
return { inlineMarks, textStyleAttrs };
|
|
38137
|
+
};
|
|
38138
|
+
const collectStyleMarks = (styleId, docx, seen = /* @__PURE__ */ new Set()) => {
|
|
38139
|
+
if (!styleId || !docx || seen.has(styleId)) return { inlineMarks: [], textStyleAttrs: null };
|
|
38140
|
+
seen.add(styleId);
|
|
38141
|
+
const chain = collectStyleChain(styleId, docx, seen);
|
|
38142
|
+
if (!chain.length) return { inlineMarks: [], textStyleAttrs: null };
|
|
38143
|
+
const inlineMap = /* @__PURE__ */ new Map();
|
|
38144
|
+
let textStyleAttrs = {};
|
|
38145
|
+
chain.forEach((styleTag) => {
|
|
38146
|
+
const marks = extractMarksFromStyle(styleTag, docx);
|
|
38147
|
+
marks.inlineMarks.forEach((mark) => {
|
|
38148
|
+
inlineMap.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
|
|
38149
|
+
});
|
|
38150
|
+
if (marks.textStyleAttrs) textStyleAttrs = { ...textStyleAttrs, ...marks.textStyleAttrs };
|
|
38151
|
+
});
|
|
38152
|
+
return {
|
|
38153
|
+
inlineMarks: Array.from(inlineMap.values()),
|
|
38154
|
+
textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
|
|
38155
|
+
};
|
|
38156
|
+
};
|
|
38157
|
+
const collectStyleChain = (styleId, docx, seen) => {
|
|
38158
|
+
if (!styleId || !docx) return [];
|
|
38159
|
+
const styleTag = findStyleTag(docx, styleId);
|
|
38160
|
+
if (!styleTag || !styleTag.elements) return [];
|
|
38161
|
+
const basedOn = styleTag.elements?.find((el) => el.name === "w:basedOn")?.attributes?.["w:val"];
|
|
38162
|
+
let chain = [];
|
|
38163
|
+
if (basedOn && !seen.has(basedOn)) {
|
|
38164
|
+
seen.add(basedOn);
|
|
38165
|
+
chain = collectStyleChain(basedOn, docx, seen);
|
|
38166
|
+
}
|
|
38167
|
+
chain.push(styleTag);
|
|
38168
|
+
return chain;
|
|
38169
|
+
};
|
|
38170
|
+
const findStyleTag = (docx, styleId) => {
|
|
38171
|
+
const stylesFile = docx?.["word/styles.xml"];
|
|
38172
|
+
if (!stylesFile?.elements?.length) return null;
|
|
38173
|
+
const candidates = [];
|
|
38174
|
+
stylesFile.elements.forEach((el) => {
|
|
38175
|
+
if (!el) return;
|
|
38176
|
+
if (el.name === "w:styles" && Array.isArray(el.elements)) {
|
|
38177
|
+
el.elements.forEach((child) => {
|
|
38178
|
+
if (child?.name === "w:style") candidates.push(child);
|
|
38179
|
+
});
|
|
38180
|
+
return;
|
|
38181
|
+
}
|
|
38182
|
+
if (el.name === "w:style") {
|
|
38183
|
+
candidates.push(el);
|
|
38184
|
+
return;
|
|
38185
|
+
}
|
|
38186
|
+
if (Array.isArray(el.elements)) {
|
|
38187
|
+
el.elements.forEach((child) => {
|
|
38188
|
+
if (child?.name === "w:style") candidates.push(child);
|
|
38189
|
+
});
|
|
38190
|
+
}
|
|
38191
|
+
});
|
|
38192
|
+
return candidates.find((tag) => tag?.attributes?.["w:styleId"] === styleId) || null;
|
|
38193
|
+
};
|
|
38194
|
+
const extractMarksFromStyle = (styleTag, docx) => {
|
|
38195
|
+
const rPr = styleTag?.elements?.find((el) => el.name === "w:rPr");
|
|
38196
|
+
if (!rPr) return { inlineMarks: [], textStyleAttrs: null };
|
|
38197
|
+
const marks = parseMarks(rPr, [], docx) || [];
|
|
38198
|
+
const inlineMarks = [];
|
|
38199
|
+
let textStyleAttrs = {};
|
|
38200
|
+
marks.forEach((mark) => {
|
|
38201
|
+
if (!mark) return;
|
|
38202
|
+
if (mark.type === "textStyle") {
|
|
38203
|
+
const attrs = mark.attrs || {};
|
|
38204
|
+
if (Object.keys(attrs).length) textStyleAttrs = { ...textStyleAttrs, ...attrs };
|
|
38205
|
+
return;
|
|
38206
|
+
}
|
|
38207
|
+
if (mark.type) inlineMarks.push(mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
|
|
38208
|
+
});
|
|
38209
|
+
return {
|
|
38210
|
+
inlineMarks,
|
|
38211
|
+
textStyleAttrs: Object.keys(textStyleAttrs).length ? textStyleAttrs : null
|
|
38212
|
+
};
|
|
38213
|
+
};
|
|
38214
|
+
const mergeInlineMarkSets = (...markSets) => {
|
|
38215
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
38216
|
+
markSets.filter(Boolean).forEach((marks) => {
|
|
37453
38217
|
marks.forEach((mark) => {
|
|
37454
|
-
|
|
37455
|
-
|
|
37456
|
-
);
|
|
37457
|
-
if (!exists2) {
|
|
37458
|
-
combinedMarks.push(mark);
|
|
37459
|
-
}
|
|
38218
|
+
if (!mark || !mark.type) return;
|
|
38219
|
+
map2.set(mark.type, mark.attrs ? { type: mark.type, attrs: { ...mark.attrs } } : { type: mark.type });
|
|
37460
38220
|
});
|
|
37461
|
-
|
|
37462
|
-
|
|
37463
|
-
|
|
37464
|
-
|
|
37465
|
-
|
|
37466
|
-
|
|
37467
|
-
|
|
37468
|
-
|
|
37469
|
-
|
|
38221
|
+
});
|
|
38222
|
+
return Array.from(map2.values());
|
|
38223
|
+
};
|
|
38224
|
+
const mergeTextStyleAttrs = (...attrsList) => {
|
|
38225
|
+
const merged = attrsList.filter((attrs) => attrs && Object.keys(attrs).length).reduce((acc, attrs) => ({ ...acc, ...attrs }), {});
|
|
38226
|
+
return Object.keys(merged).length ? merged : null;
|
|
38227
|
+
};
|
|
38228
|
+
const cloneRunAttrs = (attrs) => {
|
|
38229
|
+
const clone = { ...attrs };
|
|
38230
|
+
if (Array.isArray(attrs?.runProperties)) {
|
|
38231
|
+
clone.runProperties = attrs.runProperties.map((entry) => ({
|
|
38232
|
+
xmlName: entry?.xmlName,
|
|
38233
|
+
attributes: { ...entry?.attributes || {} }
|
|
38234
|
+
}));
|
|
38235
|
+
}
|
|
38236
|
+
return clone;
|
|
38237
|
+
};
|
|
38238
|
+
const cloneMark = (mark) => {
|
|
38239
|
+
if (!mark || typeof mark !== "object") return mark;
|
|
38240
|
+
const cloned = { ...mark };
|
|
38241
|
+
if (mark.attrs && typeof mark.attrs === "object") {
|
|
38242
|
+
cloned.attrs = { ...mark.attrs };
|
|
38243
|
+
if (Array.isArray(mark.attrs.runProperties)) {
|
|
38244
|
+
cloned.attrs.runProperties = mark.attrs.runProperties.map((entry) => ({
|
|
38245
|
+
xmlName: entry?.xmlName,
|
|
38246
|
+
attributes: { ...entry?.attributes || {} }
|
|
38247
|
+
}));
|
|
38248
|
+
}
|
|
38249
|
+
}
|
|
38250
|
+
return cloned;
|
|
38251
|
+
};
|
|
38252
|
+
const mergeRunAttrs = (existing = {}, incoming = {}) => {
|
|
38253
|
+
const merged = { ...existing, ...cloneRunAttrs(incoming) };
|
|
38254
|
+
if (Array.isArray(existing?.runProperties) && Array.isArray(incoming?.runProperties)) {
|
|
38255
|
+
const seen = /* @__PURE__ */ new Set();
|
|
38256
|
+
const combined = [...existing.runProperties, ...incoming.runProperties];
|
|
38257
|
+
merged.runProperties = combined.filter((entry) => {
|
|
38258
|
+
const key = entry?.xmlName;
|
|
38259
|
+
if (!key || seen.has(key)) return false;
|
|
38260
|
+
seen.add(key);
|
|
38261
|
+
return true;
|
|
37470
38262
|
});
|
|
37471
38263
|
}
|
|
37472
|
-
return
|
|
38264
|
+
return merged;
|
|
37473
38265
|
};
|
|
37474
|
-
const
|
|
37475
|
-
|
|
37476
|
-
if (
|
|
37477
|
-
|
|
38266
|
+
const normalizeBool = (value) => {
|
|
38267
|
+
if (value === void 0 || value === null) return true;
|
|
38268
|
+
if (typeof value === "boolean") return value;
|
|
38269
|
+
if (typeof value === "number") return value !== 0;
|
|
38270
|
+
const normalized = String(value).trim().toLowerCase();
|
|
38271
|
+
if (normalized === "0" || normalized === "false" || normalized === "off") return false;
|
|
38272
|
+
if (normalized === "1" || normalized === "true" || normalized === "on") return true;
|
|
38273
|
+
return true;
|
|
38274
|
+
};
|
|
38275
|
+
const resolveRunElement = (node) => {
|
|
38276
|
+
if (!node) return null;
|
|
38277
|
+
if (node.name === "w:r") return node;
|
|
38278
|
+
return (node.elements || []).find((el) => el.name === "w:r") || null;
|
|
38279
|
+
};
|
|
38280
|
+
const ensureRunPropertiesContainer = (runElement) => {
|
|
38281
|
+
if (!Array.isArray(runElement.elements)) runElement.elements = [];
|
|
38282
|
+
let rPr = runElement.elements.find((el) => el.name === "w:rPr");
|
|
38283
|
+
if (!rPr) {
|
|
38284
|
+
rPr = { name: "w:rPr", elements: [] };
|
|
38285
|
+
runElement.elements.unshift(rPr);
|
|
38286
|
+
}
|
|
38287
|
+
if (!Array.isArray(rPr.elements)) rPr.elements = [];
|
|
38288
|
+
return rPr;
|
|
38289
|
+
};
|
|
38290
|
+
const splitRunProperties = (entries = [], docx = null) => {
|
|
38291
|
+
const remainingProps = [];
|
|
38292
|
+
const inlineMarks = [];
|
|
38293
|
+
const textStyleAttrs = {};
|
|
38294
|
+
let hasTextStyle = false;
|
|
38295
|
+
let highlightColor = null;
|
|
38296
|
+
let runStyleId = null;
|
|
38297
|
+
entries.forEach((entry) => {
|
|
38298
|
+
if (!entry || !entry.xmlName) return;
|
|
38299
|
+
const attributes = entry.attributes || {};
|
|
38300
|
+
switch (entry.xmlName) {
|
|
38301
|
+
case "w:b": {
|
|
38302
|
+
const val = normalizeBool(attributes["w:val"]);
|
|
38303
|
+
inlineMarks.push(val ? { type: "bold" } : { type: "bold", attrs: { value: "0" } });
|
|
38304
|
+
break;
|
|
38305
|
+
}
|
|
38306
|
+
case "w:i": {
|
|
38307
|
+
const val = normalizeBool(attributes["w:val"]);
|
|
38308
|
+
inlineMarks.push(val ? { type: "italic" } : { type: "italic", attrs: { value: "0" } });
|
|
38309
|
+
break;
|
|
38310
|
+
}
|
|
38311
|
+
case "w:u": {
|
|
38312
|
+
const rawVal = attributes["w:val"];
|
|
38313
|
+
const underlineType = rawVal == null || rawVal === "" ? "single" : String(rawVal);
|
|
38314
|
+
const attrs = {};
|
|
38315
|
+
if (underlineType.toLowerCase() === "none" || underlineType === "0") {
|
|
38316
|
+
attrs.underlineType = "none";
|
|
38317
|
+
} else {
|
|
38318
|
+
attrs.underlineType = underlineType;
|
|
38319
|
+
const colorRaw = attributes["w:color"];
|
|
38320
|
+
if (typeof colorRaw === "string" && colorRaw.toLowerCase() !== "auto") {
|
|
38321
|
+
const normalizedColor = normalizeHexColor(colorRaw);
|
|
38322
|
+
if (normalizedColor) attrs.underlineColor = `#${normalizedColor}`;
|
|
38323
|
+
}
|
|
38324
|
+
}
|
|
38325
|
+
if (attributes["w:themeColor"]) attrs.underlineThemeColor = attributes["w:themeColor"];
|
|
38326
|
+
if (attributes["w:themeTint"]) attrs.underlineThemeTint = attributes["w:themeTint"];
|
|
38327
|
+
if (attributes["w:themeShade"]) attrs.underlineThemeShade = attributes["w:themeShade"];
|
|
38328
|
+
inlineMarks.push({ type: "underline", attrs });
|
|
38329
|
+
break;
|
|
38330
|
+
}
|
|
38331
|
+
case "w:color": {
|
|
38332
|
+
const raw = attributes["w:val"];
|
|
38333
|
+
if (typeof raw === "string" && raw) {
|
|
38334
|
+
hasTextStyle = true;
|
|
38335
|
+
textStyleAttrs.color = `#${raw.replace("#", "").toUpperCase()}`;
|
|
38336
|
+
}
|
|
38337
|
+
break;
|
|
38338
|
+
}
|
|
38339
|
+
case "w:rFonts": {
|
|
38340
|
+
const family = attributes["w:ascii"] || attributes["w:eastAsia"] || attributes["w:hAnsi"] || attributes["w:val"];
|
|
38341
|
+
if (family) {
|
|
38342
|
+
hasTextStyle = true;
|
|
38343
|
+
textStyleAttrs.fontFamily = SuperConverter.toCssFontFamily(family, docx);
|
|
38344
|
+
}
|
|
38345
|
+
break;
|
|
38346
|
+
}
|
|
38347
|
+
case "w:sz":
|
|
38348
|
+
case "w:szCs": {
|
|
38349
|
+
const rawSize = Number(attributes["w:val"]);
|
|
38350
|
+
if (Number.isFinite(rawSize) && rawSize > 0) {
|
|
38351
|
+
hasTextStyle = true;
|
|
38352
|
+
textStyleAttrs.fontSize = `${rawSize / 2}pt`;
|
|
38353
|
+
}
|
|
38354
|
+
break;
|
|
38355
|
+
}
|
|
38356
|
+
case "w:strike": {
|
|
38357
|
+
const val = normalizeBool(attributes["w:val"]);
|
|
38358
|
+
inlineMarks.push(val ? { type: "strike" } : { type: "strike", attrs: { value: "0" } });
|
|
38359
|
+
break;
|
|
38360
|
+
}
|
|
38361
|
+
case "w:highlight": {
|
|
38362
|
+
const color = attributes["w:val"];
|
|
38363
|
+
if (typeof color === "string" && color) {
|
|
38364
|
+
highlightColor = color.toLowerCase() === "none" ? "transparent" : color;
|
|
38365
|
+
}
|
|
38366
|
+
break;
|
|
38367
|
+
}
|
|
38368
|
+
case "w:shd": {
|
|
38369
|
+
const fill = attributes["w:fill"];
|
|
38370
|
+
const shdVal = attributes["w:val"];
|
|
38371
|
+
if (fill && String(fill).toLowerCase() !== "auto") {
|
|
38372
|
+
highlightColor = `#${String(fill).replace("#", "")}`;
|
|
38373
|
+
} else if (typeof shdVal === "string") {
|
|
38374
|
+
const normalized = shdVal.toLowerCase();
|
|
38375
|
+
if (normalized === "clear" || normalized === "nil" || normalized === "none") {
|
|
38376
|
+
highlightColor = "transparent";
|
|
38377
|
+
}
|
|
38378
|
+
}
|
|
38379
|
+
break;
|
|
38380
|
+
}
|
|
38381
|
+
case "w:rStyle": {
|
|
38382
|
+
if (typeof attributes["w:val"] === "string") runStyleId = attributes["w:val"];
|
|
38383
|
+
remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
|
|
38384
|
+
break;
|
|
38385
|
+
}
|
|
38386
|
+
default: {
|
|
38387
|
+
remainingProps.push({ xmlName: entry.xmlName, attributes: { ...attributes } });
|
|
38388
|
+
}
|
|
38389
|
+
}
|
|
38390
|
+
});
|
|
38391
|
+
if (highlightColor) inlineMarks.push({ type: "highlight", attrs: { color: highlightColor } });
|
|
38392
|
+
return {
|
|
38393
|
+
remainingProps,
|
|
38394
|
+
inlineMarks,
|
|
38395
|
+
textStyleAttrs: hasTextStyle ? textStyleAttrs : null,
|
|
38396
|
+
runStyleId
|
|
38397
|
+
};
|
|
38398
|
+
};
|
|
38399
|
+
const encode$3 = (attributes) => {
|
|
38400
|
+
return attributes["w:rsidR"];
|
|
38401
|
+
};
|
|
38402
|
+
const decode$3 = (attrs) => {
|
|
38403
|
+
return attrs.rsidR;
|
|
38404
|
+
};
|
|
38405
|
+
const attrConfig$2 = Object.freeze({
|
|
38406
|
+
xmlName: "w:rsidR",
|
|
38407
|
+
sdName: "rsidR",
|
|
38408
|
+
encode: encode$3,
|
|
38409
|
+
decode: decode$3
|
|
38410
|
+
});
|
|
38411
|
+
const encode$2 = (attributes) => {
|
|
38412
|
+
return attributes["w:rsidRPr"];
|
|
38413
|
+
};
|
|
38414
|
+
const decode$2 = (attrs) => {
|
|
38415
|
+
return attrs.rsidRPr;
|
|
38416
|
+
};
|
|
38417
|
+
const attrConfig$1 = Object.freeze({
|
|
38418
|
+
xmlName: "w:rsidRPr",
|
|
38419
|
+
sdName: "rsidRPr",
|
|
38420
|
+
encode: encode$2,
|
|
38421
|
+
decode: decode$2
|
|
38422
|
+
});
|
|
38423
|
+
const encode$1 = (attributes) => {
|
|
38424
|
+
return attributes["w:rsidDel"];
|
|
38425
|
+
};
|
|
38426
|
+
const decode$1 = (attrs) => {
|
|
38427
|
+
return attrs.rsidDel;
|
|
38428
|
+
};
|
|
38429
|
+
const attrConfig = Object.freeze({
|
|
38430
|
+
xmlName: "w:rsidDel",
|
|
38431
|
+
sdName: "rsidDel",
|
|
38432
|
+
encode: encode$1,
|
|
38433
|
+
decode: decode$1
|
|
38434
|
+
});
|
|
38435
|
+
const validXmlAttributes = [attrConfig$2, attrConfig$1, attrConfig];
|
|
38436
|
+
const XML_NODE_NAME = "w:r";
|
|
38437
|
+
const SD_KEY_NAME = "run";
|
|
38438
|
+
const encode$U = (params2, encodedAttrs = {}) => {
|
|
38439
|
+
const { nodes = [], nodeListHandler } = params2 || {};
|
|
38440
|
+
const runNode = nodes[0];
|
|
38441
|
+
if (!runNode) return void 0;
|
|
38442
|
+
const elements = Array.isArray(runNode.elements) ? runNode.elements : [];
|
|
38443
|
+
const rPrNode = elements.find((child) => child?.name === "w:rPr");
|
|
38444
|
+
const contentElements = rPrNode ? elements.filter((el) => el !== rPrNode) : elements;
|
|
38445
|
+
const { entries: runPropEntries, hadRPr, styleChangeMarks } = collectRunProperties(params2, rPrNode);
|
|
38446
|
+
const { remainingProps, inlineMarks, textStyleAttrs, runStyleId } = splitRunProperties(runPropEntries, params2?.docx);
|
|
38447
|
+
const styleMarks = deriveStyleMarks({
|
|
38448
|
+
docx: params2?.docx,
|
|
38449
|
+
paragraphStyleId: params2?.parentStyleId,
|
|
38450
|
+
runStyleId
|
|
38451
|
+
});
|
|
38452
|
+
const mergedInlineMarks = mergeInlineMarkSets(styleMarks.inlineMarks, inlineMarks);
|
|
38453
|
+
let mergedTextStyleAttrs = mergeTextStyleAttrs(styleMarks.textStyleAttrs, textStyleAttrs);
|
|
38454
|
+
if (runStyleId) {
|
|
38455
|
+
mergedTextStyleAttrs = mergedTextStyleAttrs ? { ...mergedTextStyleAttrs, styleId: runStyleId } : { styleId: runStyleId };
|
|
38456
|
+
}
|
|
38457
|
+
const runAttrs = buildRunAttrs(encodedAttrs, hadRPr, remainingProps);
|
|
38458
|
+
let runLevelMarks = Array.isArray(runNode.marks) ? runNode.marks.map((mark) => cloneMark(mark)) : [];
|
|
38459
|
+
if (styleChangeMarks?.length) {
|
|
38460
|
+
runLevelMarks = [...runLevelMarks, ...styleChangeMarks.map((mark) => cloneMark(mark))];
|
|
38461
|
+
}
|
|
38462
|
+
const childParams = { ...params2, nodes: contentElements };
|
|
38463
|
+
const content = nodeListHandler?.handler(childParams) || [];
|
|
38464
|
+
const contentWithRunMarks = content.map((child) => {
|
|
38465
|
+
if (!child || typeof child !== "object") return child;
|
|
38466
|
+
const baseMarks = Array.isArray(child.marks) ? child.marks.map((mark) => cloneMark(mark)) : [];
|
|
38467
|
+
if (!runLevelMarks.length) return child;
|
|
38468
|
+
return { ...child, marks: [...baseMarks, ...runLevelMarks.map((mark) => cloneMark(mark))] };
|
|
38469
|
+
});
|
|
38470
|
+
const marked = contentWithRunMarks.map(
|
|
38471
|
+
(child) => applyRunMarks(child, runAttrs, mergedInlineMarks, mergedTextStyleAttrs)
|
|
38472
|
+
);
|
|
38473
|
+
const filtered = marked.filter(Boolean);
|
|
38474
|
+
if (!filtered.length) return [];
|
|
38475
|
+
if (filtered.length === 1) return filtered[0];
|
|
38476
|
+
return filtered;
|
|
38477
|
+
};
|
|
38478
|
+
const decode = (params2, decodedAttrs = {}) => {
|
|
38479
|
+
const { node } = params2 || {};
|
|
38480
|
+
if (!node) return void 0;
|
|
38481
|
+
const marks = Array.isArray(node.marks) ? node.marks : [];
|
|
38482
|
+
const runMarkIndex = marks.findIndex((mark) => mark?.type === SD_KEY_NAME);
|
|
38483
|
+
const runMark = runMarkIndex >= 0 ? marks[runMarkIndex] : void 0;
|
|
38484
|
+
const strippedMarks = marks.filter((_2, idx) => idx !== runMarkIndex);
|
|
38485
|
+
const exportNode = { ...node, marks: strippedMarks };
|
|
38486
|
+
const exportParams = { ...params2, node: exportNode };
|
|
38487
|
+
if (!exportParams.editor) {
|
|
38488
|
+
exportParams.editor = { extensionService: { extensions: [] } };
|
|
38489
|
+
}
|
|
38490
|
+
const translated = exportSchemaToJson(exportParams);
|
|
38491
|
+
if (!translated) return void 0;
|
|
38492
|
+
const runElement = resolveRunElement(translated);
|
|
38493
|
+
if (!runElement) return translated;
|
|
38494
|
+
runElement.attributes = { ...runElement.attributes || {}, ...decodedAttrs };
|
|
38495
|
+
const runProperties = Array.isArray(runMark?.attrs?.runProperties) ? runMark.attrs.runProperties : null;
|
|
38496
|
+
if (runProperties && runProperties.length) {
|
|
38497
|
+
const rPr = ensureRunPropertiesContainer(runElement);
|
|
38498
|
+
const existingNames = new Set((rPr.elements || []).map((el) => el.name));
|
|
38499
|
+
runProperties.forEach((entry) => {
|
|
38500
|
+
if (!entry || !entry.xmlName || entry.xmlName === "w:b") return;
|
|
38501
|
+
if (existingNames.has(entry.xmlName)) return;
|
|
38502
|
+
rPr.elements.push({ name: entry.xmlName, attributes: { ...entry.attributes || {} } });
|
|
38503
|
+
existingNames.add(entry.xmlName);
|
|
38504
|
+
});
|
|
37478
38505
|
}
|
|
37479
|
-
|
|
37480
|
-
const style2 = styleTags.find((tag) => tag.attributes["w:styleId"] === styleId) || {};
|
|
37481
|
-
if (!style2) return {};
|
|
37482
|
-
return parseProperties(style2);
|
|
38506
|
+
return translated;
|
|
37483
38507
|
};
|
|
37484
|
-
const
|
|
37485
|
-
|
|
37486
|
-
|
|
38508
|
+
const config = {
|
|
38509
|
+
xmlName: XML_NODE_NAME,
|
|
38510
|
+
sdNodeOrKeyName: SD_KEY_NAME,
|
|
38511
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
38512
|
+
encode: encode$U,
|
|
38513
|
+
decode,
|
|
38514
|
+
attributes: validXmlAttributes
|
|
37487
38515
|
};
|
|
38516
|
+
const translator = NodeTranslator.from(config);
|
|
38517
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator);
|
|
37488
38518
|
const handleTextNode = (params2) => {
|
|
37489
38519
|
const { nodes, insideTrackChange } = params2;
|
|
37490
38520
|
if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
|
|
@@ -37521,7 +38551,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37521
38551
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
37522
38552
|
return { nodes: [], consumed: 0 };
|
|
37523
38553
|
}
|
|
37524
|
-
const schemaNode = translator$
|
|
38554
|
+
const schemaNode = translator$s.encode(params2);
|
|
37525
38555
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
37526
38556
|
return { nodes: newNodes, consumed: 1 };
|
|
37527
38557
|
};
|
|
@@ -37534,7 +38564,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37534
38564
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
37535
38565
|
return { nodes: [], consumed: 0 };
|
|
37536
38566
|
}
|
|
37537
|
-
const result = translator.encode(params2);
|
|
38567
|
+
const result = translator$b.encode(params2);
|
|
37538
38568
|
if (!result) {
|
|
37539
38569
|
return { nodes: [], consumed: 0 };
|
|
37540
38570
|
}
|
|
@@ -37624,7 +38654,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37624
38654
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
37625
38655
|
return { nodes: [], consumed: 0 };
|
|
37626
38656
|
}
|
|
37627
|
-
const result = translator$
|
|
38657
|
+
const result = translator$v.encode(params2);
|
|
37628
38658
|
if (!result) return { nodes: [], consumed: 0 };
|
|
37629
38659
|
return {
|
|
37630
38660
|
nodes: [result],
|
|
@@ -38293,7 +39323,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38293
39323
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
38294
39324
|
return { nodes: [], consumed: 0 };
|
|
38295
39325
|
}
|
|
38296
|
-
const node = translator$
|
|
39326
|
+
const node = translator$t.encode(params2);
|
|
38297
39327
|
return { nodes: [node], consumed: 1 };
|
|
38298
39328
|
};
|
|
38299
39329
|
const tabNodeEntityHandler = {
|
|
@@ -38740,6 +39770,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38740
39770
|
};
|
|
38741
39771
|
const HYPERLINK_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
|
|
38742
39772
|
const HEADER_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
|
|
39773
|
+
const FONT_FAMILY_FALLBACKS = Object.freeze({
|
|
39774
|
+
swiss: "Arial, sans-serif",
|
|
39775
|
+
roman: "Times New Roman, serif",
|
|
39776
|
+
modern: "Courier New, monospace",
|
|
39777
|
+
script: "cursive",
|
|
39778
|
+
decorative: "fantasy",
|
|
39779
|
+
system: "system-ui",
|
|
39780
|
+
auto: "sans-serif"
|
|
39781
|
+
});
|
|
39782
|
+
const DEFAULT_GENERIC_FALLBACK = "sans-serif";
|
|
38743
39783
|
const _SuperConverter = class _SuperConverter2 {
|
|
38744
39784
|
constructor(params2 = null) {
|
|
38745
39785
|
__privateAdd$2(this, _SuperConverter_instances);
|
|
@@ -38775,6 +39815,31 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38775
39815
|
this.documentId = params2?.documentId || null;
|
|
38776
39816
|
if (this.docx.length || this.xml) this.parseFromXml();
|
|
38777
39817
|
}
|
|
39818
|
+
static getFontTableEntry(docx, fontName) {
|
|
39819
|
+
if (!docx || !fontName) return null;
|
|
39820
|
+
const fontTable = docx["word/fontTable.xml"];
|
|
39821
|
+
if (!fontTable?.elements?.length) return null;
|
|
39822
|
+
const fontsNode = fontTable.elements.find((el) => el.name === "w:fonts");
|
|
39823
|
+
if (!fontsNode?.elements?.length) return null;
|
|
39824
|
+
return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
|
|
39825
|
+
}
|
|
39826
|
+
static getFallbackFromFontTable(docx, fontName) {
|
|
39827
|
+
const fontEntry = _SuperConverter2.getFontTableEntry(docx, fontName);
|
|
39828
|
+
const family = fontEntry?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
39829
|
+
if (!family) return null;
|
|
39830
|
+
const mapped = FONT_FAMILY_FALLBACKS[family.toLowerCase()];
|
|
39831
|
+
return mapped || DEFAULT_GENERIC_FALLBACK;
|
|
39832
|
+
}
|
|
39833
|
+
static toCssFontFamily(fontName, docx) {
|
|
39834
|
+
if (!fontName) return fontName;
|
|
39835
|
+
if (fontName.includes(",")) return fontName;
|
|
39836
|
+
const fallback = _SuperConverter2.getFallbackFromFontTable(docx, fontName) || DEFAULT_GENERIC_FALLBACK;
|
|
39837
|
+
const normalizedFallbackParts = fallback.split(",").map((part) => part.trim().toLowerCase()).filter(Boolean);
|
|
39838
|
+
if (normalizedFallbackParts.includes(fontName.trim().toLowerCase())) {
|
|
39839
|
+
return fallback;
|
|
39840
|
+
}
|
|
39841
|
+
return `${fontName}, ${fallback}`;
|
|
39842
|
+
}
|
|
38778
39843
|
/**
|
|
38779
39844
|
* Get the DocxHelpers object that contains utility functions for working with docx files.
|
|
38780
39845
|
* @returns {import('./docx-helpers/docx-helpers.js').DocxHelpers} The DocxHelpers object.
|
|
@@ -38820,7 +39885,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38820
39885
|
return;
|
|
38821
39886
|
}
|
|
38822
39887
|
}
|
|
38823
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.
|
|
39888
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.21.0-RC1") {
|
|
38824
39889
|
const customLocation = "docProps/custom.xml";
|
|
38825
39890
|
if (!docx[customLocation]) {
|
|
38826
39891
|
docx[customLocation] = generateCustomXml();
|
|
@@ -38871,13 +39936,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38871
39936
|
if (rPrDefaults) {
|
|
38872
39937
|
const rPr = rPrDefaults.elements?.find((el) => el.name === "w:rPr");
|
|
38873
39938
|
const fonts = rPr?.elements?.find((el) => el.name === "w:rFonts");
|
|
38874
|
-
|
|
38875
|
-
|
|
38876
|
-
|
|
39939
|
+
if (fonts?.attributes?.["w:ascii"]) {
|
|
39940
|
+
typeface = fonts.attributes["w:ascii"];
|
|
39941
|
+
}
|
|
39942
|
+
const fontSizeRaw = rPr?.elements?.find((el) => el.name === "w:sz")?.attributes?.["w:val"];
|
|
39943
|
+
if (!fontSizeNormal && fontSizeRaw) {
|
|
39944
|
+
fontSizeNormal = Number(fontSizeRaw) / 2;
|
|
39945
|
+
}
|
|
38877
39946
|
}
|
|
38878
|
-
const
|
|
39947
|
+
const fallbackSz = Number(rElements.find((el) => el.name === "w:sz")?.attributes?.["w:val"]);
|
|
39948
|
+
const fontSizePt = fontSizeNormal ?? (Number.isFinite(fallbackSz) ? fallbackSz / 2 : void 0) ?? 10;
|
|
38879
39949
|
const kern = rElements.find((el) => el.name === "w:kern")?.attributes["w:val"];
|
|
38880
|
-
|
|
39950
|
+
const fontFamilyCss = _SuperConverter2.toCssFontFamily(typeface, this.convertedXml);
|
|
39951
|
+
return { fontSizePt, kern, typeface, panose, fontFamilyCss };
|
|
38881
39952
|
}
|
|
38882
39953
|
}
|
|
38883
39954
|
getDocumentFonts() {
|
|
@@ -39307,7 +40378,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
39307
40378
|
function generateCustomXml() {
|
|
39308
40379
|
return DEFAULT_CUSTOM_XML;
|
|
39309
40380
|
}
|
|
39310
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.
|
|
40381
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.21.0-RC1") {
|
|
39311
40382
|
return {
|
|
39312
40383
|
type: "element",
|
|
39313
40384
|
name: "property",
|
|
@@ -50721,6 +51792,95 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
50721
51792
|
if (isActive2) return commands2.unsetMark(type2, { extendEmptyMarkRange });
|
|
50722
51793
|
return commands2.setMark(type2, attrs);
|
|
50723
51794
|
};
|
|
51795
|
+
const toggleMarkCascade = (markName, options = {}) => ({ state: state2, chain, editor }) => {
|
|
51796
|
+
const {
|
|
51797
|
+
negationAttrs = { value: "0" },
|
|
51798
|
+
isNegation = (attrs) => attrs?.value === "0",
|
|
51799
|
+
styleDetector = defaultStyleDetector,
|
|
51800
|
+
extendEmptyMarkRange = true
|
|
51801
|
+
} = options;
|
|
51802
|
+
const selectionMarks = getMarksFromSelection(state2) || [];
|
|
51803
|
+
const inlineMarks = selectionMarks.filter((m2) => m2.type?.name === markName);
|
|
51804
|
+
const hasNegation = inlineMarks.some((m2) => isNegation(m2.attrs || {}));
|
|
51805
|
+
const hasInline = inlineMarks.some((m2) => !isNegation(m2.attrs || {}));
|
|
51806
|
+
const styleOn = styleDetector({ state: state2, selectionMarks, markName, editor });
|
|
51807
|
+
const cmdChain = chain();
|
|
51808
|
+
if (hasNegation) return cmdChain.unsetMark(markName, { extendEmptyMarkRange }).run();
|
|
51809
|
+
if (hasInline && styleOn) {
|
|
51810
|
+
return cmdChain.unsetMark(markName, { extendEmptyMarkRange }).setMark(markName, negationAttrs, { extendEmptyMarkRange }).run();
|
|
51811
|
+
}
|
|
51812
|
+
if (hasInline) return cmdChain.unsetMark(markName, { extendEmptyMarkRange }).run();
|
|
51813
|
+
if (styleOn) return cmdChain.setMark(markName, negationAttrs, { extendEmptyMarkRange }).run();
|
|
51814
|
+
return cmdChain.setMark(markName, {}, { extendEmptyMarkRange }).run();
|
|
51815
|
+
};
|
|
51816
|
+
function defaultStyleDetector({ state: state2, selectionMarks, markName, editor }) {
|
|
51817
|
+
try {
|
|
51818
|
+
const styleId = getEffectiveStyleId(state2, selectionMarks);
|
|
51819
|
+
if (!styleId || !editor?.converter?.linkedStyles) return false;
|
|
51820
|
+
const styles = editor.converter.linkedStyles;
|
|
51821
|
+
const seen = /* @__PURE__ */ new Set();
|
|
51822
|
+
let current = styleId;
|
|
51823
|
+
const key = mapMarkToStyleKey(markName);
|
|
51824
|
+
while (current && !seen.has(current)) {
|
|
51825
|
+
seen.add(current);
|
|
51826
|
+
const style2 = styles.find((s) => s.id === current);
|
|
51827
|
+
const def2 = style2?.definition?.styles || {};
|
|
51828
|
+
if (key in def2) {
|
|
51829
|
+
const raw = def2[key];
|
|
51830
|
+
if (raw === void 0) return true;
|
|
51831
|
+
const val = raw?.value ?? raw;
|
|
51832
|
+
if (val === "0" || val === false) return false;
|
|
51833
|
+
return !!val;
|
|
51834
|
+
}
|
|
51835
|
+
current = style2?.definition?.attrs?.basedOn || null;
|
|
51836
|
+
}
|
|
51837
|
+
return false;
|
|
51838
|
+
} catch {
|
|
51839
|
+
return false;
|
|
51840
|
+
}
|
|
51841
|
+
}
|
|
51842
|
+
function getEffectiveStyleId(state2, selectionMarks) {
|
|
51843
|
+
const sidFromMarks = getStyleIdFromMarks(selectionMarks);
|
|
51844
|
+
if (sidFromMarks) return sidFromMarks;
|
|
51845
|
+
const $from = state2.selection.$from;
|
|
51846
|
+
const before = $from.nodeBefore;
|
|
51847
|
+
const after = $from.nodeAfter;
|
|
51848
|
+
if (before && before.marks) {
|
|
51849
|
+
const sid = getStyleIdFromMarks(before.marks);
|
|
51850
|
+
if (sid) return sid;
|
|
51851
|
+
}
|
|
51852
|
+
if (after && after.marks) {
|
|
51853
|
+
const sid = getStyleIdFromMarks(after.marks);
|
|
51854
|
+
if (sid) return sid;
|
|
51855
|
+
}
|
|
51856
|
+
const ts = selectionMarks.find((m2) => m2.type?.name === "textStyle" && m2.attrs?.styleId);
|
|
51857
|
+
if (ts) return ts.attrs.styleId;
|
|
51858
|
+
const pos = state2.selection.$from.pos;
|
|
51859
|
+
const $pos = state2.doc.resolve(pos);
|
|
51860
|
+
for (let d2 = $pos.depth; d2 >= 0; d2--) {
|
|
51861
|
+
const n = $pos.node(d2);
|
|
51862
|
+
if (n?.type?.name === "paragraph") return n.attrs?.styleId || null;
|
|
51863
|
+
}
|
|
51864
|
+
return null;
|
|
51865
|
+
}
|
|
51866
|
+
function getStyleIdFromMarks(marks) {
|
|
51867
|
+
const run2 = marks.find((m2) => m2.type?.name === "run");
|
|
51868
|
+
const runProperties = run2?.attrs?.runProperties;
|
|
51869
|
+
if (!runProperties) return null;
|
|
51870
|
+
if (runProperties && typeof runProperties === "object" && !Array.isArray(runProperties) && runProperties.styleId) {
|
|
51871
|
+
return runProperties.styleId;
|
|
51872
|
+
}
|
|
51873
|
+
if (Array.isArray(runProperties)) {
|
|
51874
|
+
const rStyleEntry = runProperties.find((e) => e?.xmlName === "w:rStyle");
|
|
51875
|
+
const sid = rStyleEntry?.attributes?.["w:val"];
|
|
51876
|
+
if (sid) return sid;
|
|
51877
|
+
}
|
|
51878
|
+
return null;
|
|
51879
|
+
}
|
|
51880
|
+
function mapMarkToStyleKey(markName) {
|
|
51881
|
+
if (markName === "textStyle" || markName === "color") return "color";
|
|
51882
|
+
return markName;
|
|
51883
|
+
}
|
|
50724
51884
|
const clearNodes = () => ({ state: state2, tr, dispatch }) => {
|
|
50725
51885
|
const { selection } = tr;
|
|
50726
51886
|
const { ranges } = selection;
|
|
@@ -52066,11 +53226,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
52066
53226
|
command,
|
|
52067
53227
|
createParagraphNear,
|
|
52068
53228
|
decreaseListIndent,
|
|
53229
|
+
defaultStyleDetector,
|
|
52069
53230
|
deleteListItem,
|
|
52070
53231
|
deleteSelection,
|
|
52071
53232
|
exitCode,
|
|
52072
53233
|
first,
|
|
53234
|
+
getEffectiveStyleId,
|
|
52073
53235
|
getParaCtx,
|
|
53236
|
+
getStyleIdFromMarks,
|
|
52074
53237
|
handleBackspaceNextToList,
|
|
52075
53238
|
handleDeleteNextToList,
|
|
52076
53239
|
increaseListIndent,
|
|
@@ -52085,6 +53248,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
52085
53248
|
joinUp,
|
|
52086
53249
|
liftEmptyBlock,
|
|
52087
53250
|
liftListItem,
|
|
53251
|
+
mapMarkToStyleKey,
|
|
52088
53252
|
nearestListAt,
|
|
52089
53253
|
newlineInCode,
|
|
52090
53254
|
rebuildListNodeWithNewNum,
|
|
@@ -52104,6 +53268,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
52104
53268
|
splitListItem,
|
|
52105
53269
|
toggleList,
|
|
52106
53270
|
toggleMark,
|
|
53271
|
+
toggleMarkCascade,
|
|
52107
53272
|
toggleNode,
|
|
52108
53273
|
undoInputRule,
|
|
52109
53274
|
unsetAllMarks,
|
|
@@ -53307,7 +54472,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53307
54472
|
currentPageNumber
|
|
53308
54473
|
}) => {
|
|
53309
54474
|
const parentStyles = editor.converter.getDocumentDefaultStyles();
|
|
53310
|
-
const { fontSizePt, typeface } = parentStyles;
|
|
54475
|
+
const { fontSizePt, typeface, fontFamilyCss } = parentStyles;
|
|
53311
54476
|
const fontSizeInPixles = fontSizePt * 1.3333;
|
|
53312
54477
|
const lineHeight2 = fontSizeInPixles * 1.2;
|
|
53313
54478
|
Object.assign(editorContainer.style, {
|
|
@@ -53320,7 +54485,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
53320
54485
|
left: "0",
|
|
53321
54486
|
width: "auto",
|
|
53322
54487
|
maxWidth: "none",
|
|
53323
|
-
fontFamily: typeface,
|
|
54488
|
+
fontFamily: fontFamilyCss || typeface,
|
|
53324
54489
|
fontSize: `${fontSizeInPixles}px`,
|
|
53325
54490
|
lineHeight: `${lineHeight2}px`
|
|
53326
54491
|
});
|
|
@@ -54150,7 +55315,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
54150
55315
|
originalStep,
|
|
54151
55316
|
originalStepIndex
|
|
54152
55317
|
});
|
|
54153
|
-
console.debug("[track-changes]: replaceStep");
|
|
54154
55318
|
} else if (step instanceof AddMarkStep) {
|
|
54155
55319
|
addMarkStep({
|
|
54156
55320
|
state: state2,
|
|
@@ -54160,7 +55324,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
54160
55324
|
user,
|
|
54161
55325
|
date
|
|
54162
55326
|
});
|
|
54163
|
-
console.debug("[track-changes]: addMarkStep");
|
|
54164
55327
|
} else if (step instanceof RemoveMarkStep) {
|
|
54165
55328
|
removeMarkStep({
|
|
54166
55329
|
state: state2,
|
|
@@ -54170,10 +55333,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
54170
55333
|
user,
|
|
54171
55334
|
date
|
|
54172
55335
|
});
|
|
54173
|
-
console.debug("[track-changes]: removeMarkStep");
|
|
54174
55336
|
} else {
|
|
54175
55337
|
newTr.step(step);
|
|
54176
|
-
console.log("[track-changes]: otherStep");
|
|
54177
55338
|
}
|
|
54178
55339
|
});
|
|
54179
55340
|
if (tr.getMeta("inputType")) {
|
|
@@ -56243,9 +57404,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56243
57404
|
element.style.isolation = "isolate";
|
|
56244
57405
|
proseMirror.style.outline = "none";
|
|
56245
57406
|
proseMirror.style.border = "none";
|
|
56246
|
-
const { typeface, fontSizePt } = this.converter.getDocumentDefaultStyles() ?? {};
|
|
56247
|
-
|
|
56248
|
-
|
|
57407
|
+
const { typeface, fontSizePt, fontFamilyCss } = this.converter.getDocumentDefaultStyles() ?? {};
|
|
57408
|
+
const resolvedFontFamily = fontFamilyCss || typeface;
|
|
57409
|
+
if (resolvedFontFamily) {
|
|
57410
|
+
element.style.fontFamily = resolvedFontFamily;
|
|
56249
57411
|
}
|
|
56250
57412
|
if (fontSizePt) {
|
|
56251
57413
|
element.style.fontSize = `${fontSizePt}pt`;
|
|
@@ -56559,7 +57721,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56559
57721
|
* @returns {Object | void} Migration results
|
|
56560
57722
|
*/
|
|
56561
57723
|
processCollaborationMigrations() {
|
|
56562
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
57724
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.21.0-RC1");
|
|
56563
57725
|
if (!this.options.ydoc) return;
|
|
56564
57726
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
56565
57727
|
let docVersion = metaMap.get("version");
|
|
@@ -57668,6 +58830,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
57668
58830
|
},
|
|
57669
58831
|
addCommands() {
|
|
57670
58832
|
return {
|
|
58833
|
+
toggleMarkCascade,
|
|
57671
58834
|
/**
|
|
57672
58835
|
* Clear all formatting (nodes and marks)
|
|
57673
58836
|
* @category Command
|
|
@@ -58652,24 +59815,32 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
58652
59815
|
group: "inline",
|
|
58653
59816
|
inline: true
|
|
58654
59817
|
});
|
|
58655
|
-
const
|
|
59818
|
+
const Run = Mark.create({
|
|
58656
59819
|
name: "run",
|
|
58657
|
-
|
|
58658
|
-
|
|
58659
|
-
|
|
58660
|
-
|
|
58661
|
-
|
|
58662
|
-
},
|
|
58663
|
-
renderDOM() {
|
|
58664
|
-
return ["run", 0];
|
|
59820
|
+
inclusive: false,
|
|
59821
|
+
addOptions() {
|
|
59822
|
+
return {
|
|
59823
|
+
htmlAttributes: {}
|
|
59824
|
+
};
|
|
58665
59825
|
},
|
|
58666
59826
|
addAttributes() {
|
|
58667
59827
|
return {
|
|
58668
|
-
|
|
58669
|
-
|
|
58670
|
-
|
|
59828
|
+
runProperties: {
|
|
59829
|
+
default: null,
|
|
59830
|
+
rendered: false
|
|
58671
59831
|
}
|
|
58672
59832
|
};
|
|
59833
|
+
},
|
|
59834
|
+
parseDOM() {
|
|
59835
|
+
return [
|
|
59836
|
+
{
|
|
59837
|
+
tag: "span[data-run]"
|
|
59838
|
+
}
|
|
59839
|
+
];
|
|
59840
|
+
},
|
|
59841
|
+
renderDOM({ htmlAttributes }) {
|
|
59842
|
+
const base2 = Attribute.mergeAttributes({ "data-run": "1" }, this.options.htmlAttributes, htmlAttributes);
|
|
59843
|
+
return ["span", base2, 0];
|
|
58673
59844
|
}
|
|
58674
59845
|
});
|
|
58675
59846
|
const inputRegex$1 = /^\s*([-+*])\s$/;
|
|
@@ -59233,6 +60404,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59233
60404
|
case "textStyle":
|
|
59234
60405
|
const { fontFamily: fontFamily2, fontSize: fontSize2 } = attr.attrs;
|
|
59235
60406
|
styles += `${fontFamily2 ? `font-family: ${fontFamily2};` : ""} ${fontSize2 ? `font-size: ${fontSize2};` : ""}`;
|
|
60407
|
+
break;
|
|
59236
60408
|
}
|
|
59237
60409
|
}
|
|
59238
60410
|
return styles.trim();
|
|
@@ -59251,12 +60423,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59251
60423
|
const linkedDefinitionStyles = { ...linkedStyle.definition.styles };
|
|
59252
60424
|
const basedOnDefinitionStyles = { ...basedOnStyle?.definition?.styles };
|
|
59253
60425
|
const resultStyles = { ...linkedDefinitionStyles };
|
|
59254
|
-
|
|
59255
|
-
|
|
59256
|
-
|
|
59257
|
-
|
|
59258
|
-
|
|
59259
|
-
|
|
60426
|
+
const inheritKeys = [
|
|
60427
|
+
"font-size",
|
|
60428
|
+
"font-family",
|
|
60429
|
+
"text-transform",
|
|
60430
|
+
"bold",
|
|
60431
|
+
"italic",
|
|
60432
|
+
"underline",
|
|
60433
|
+
"strike",
|
|
60434
|
+
"color",
|
|
60435
|
+
"highlight"
|
|
60436
|
+
];
|
|
60437
|
+
inheritKeys.forEach((k) => {
|
|
60438
|
+
if (!linkedDefinitionStyles[k] && basedOnDefinitionStyles[k]) {
|
|
60439
|
+
resultStyles[k] = basedOnDefinitionStyles[k];
|
|
60440
|
+
}
|
|
60441
|
+
});
|
|
59260
60442
|
Object.entries(resultStyles).forEach(([k, value]) => {
|
|
59261
60443
|
const key = kebabCase$2(k);
|
|
59262
60444
|
const flattenedMarks = [];
|
|
@@ -59271,6 +60453,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59271
60453
|
}
|
|
59272
60454
|
flattenedMarks.push({ key: n.type.name, value: n.attrs[key] });
|
|
59273
60455
|
});
|
|
60456
|
+
const underlineNone = node?.marks?.some((m2) => m2.type?.name === "underline" && m2.attrs?.underlineType === "none");
|
|
60457
|
+
if (underlineNone) {
|
|
60458
|
+
markValue["text-decoration"] = "none";
|
|
60459
|
+
}
|
|
59274
60460
|
const mark = flattenedMarks.find((n) => n.key === key);
|
|
59275
60461
|
const hasParentIndent = Object.keys(parent?.attrs?.indent || {});
|
|
59276
60462
|
const hasParentSpacing = Object.keys(parent?.attrs?.spacing || {});
|
|
@@ -59287,10 +60473,28 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59287
60473
|
if (rightIndent) markValue["margin-right"] = rightIndent + "px";
|
|
59288
60474
|
if (firstLine) markValue["text-indent"] = firstLine + "px";
|
|
59289
60475
|
} else if (key === "bold" && node) {
|
|
59290
|
-
const
|
|
59291
|
-
|
|
60476
|
+
const boldValue = typeof value === "object" && value !== null ? value.value : value;
|
|
60477
|
+
const hasInlineBoldOff = node.marks?.some((m2) => m2.type?.name === "bold" && m2.attrs?.value === "0");
|
|
60478
|
+
const hasInlineBoldOn = node.marks?.some((m2) => m2.type?.name === "bold" && m2.attrs?.value !== "0");
|
|
60479
|
+
if (!listTypes.includes(node.type.name) && !hasInlineBoldOff && !hasInlineBoldOn && boldValue !== "0" && boldValue !== false) {
|
|
59292
60480
|
markValue["font-weight"] = "bold";
|
|
59293
60481
|
}
|
|
60482
|
+
} else if (key === "italic" && node) {
|
|
60483
|
+
const italicValue = typeof value === "object" && value !== null ? value.value : value;
|
|
60484
|
+
const hasInlineItalicOff = node.marks?.some((m2) => m2.type?.name === "italic" && m2.attrs?.value === "0");
|
|
60485
|
+
const hasInlineItalicOn = node.marks?.some((m2) => m2.type?.name === "italic" && m2.attrs?.value !== "0");
|
|
60486
|
+
if (!listTypes.includes(node.type.name) && !hasInlineItalicOff && !hasInlineItalicOn && italicValue !== "0" && italicValue !== false) {
|
|
60487
|
+
markValue["font-style"] = "italic";
|
|
60488
|
+
}
|
|
60489
|
+
} else if (key === "strike" && node) {
|
|
60490
|
+
const strikeValue = typeof value === "object" && value !== null ? value.value : value;
|
|
60491
|
+
const hasInlineStrikeOff = node.marks?.some((m2) => m2.type?.name === "strike" && m2.attrs?.value === "0");
|
|
60492
|
+
const hasInlineStrikeOn = node.marks?.some(
|
|
60493
|
+
(m2) => m2.type?.name === "strike" && (m2.attrs?.value === void 0 || m2.attrs?.value !== "0")
|
|
60494
|
+
);
|
|
60495
|
+
if (!listTypes.includes(node.type.name) && !hasInlineStrikeOff && !hasInlineStrikeOn && strikeValue !== "0" && strikeValue !== false) {
|
|
60496
|
+
markValue["text-decoration"] = "line-through";
|
|
60497
|
+
}
|
|
59294
60498
|
} else if (key === "text-transform" && node) {
|
|
59295
60499
|
if (!listTypes.includes(node.type.name)) {
|
|
59296
60500
|
markValue[key] = value;
|
|
@@ -59299,10 +60503,44 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59299
60503
|
if (!listTypes.includes(node.type.name)) {
|
|
59300
60504
|
markValue[key] = value;
|
|
59301
60505
|
}
|
|
60506
|
+
} else if (key === "font-family" && node) {
|
|
60507
|
+
if (!listTypes.includes(node.type.name)) {
|
|
60508
|
+
markValue[key] = value;
|
|
60509
|
+
}
|
|
59302
60510
|
} else if (key === "color" && node) {
|
|
59303
60511
|
if (!listTypes.includes(node.type.name)) {
|
|
59304
60512
|
markValue[key] = value;
|
|
59305
60513
|
}
|
|
60514
|
+
} else if (key === "highlight" && node) {
|
|
60515
|
+
const hasInlineHighlight = node.marks?.some((m2) => m2.type?.name === "highlight");
|
|
60516
|
+
if (!listTypes.includes(node.type.name) && !hasInlineHighlight) {
|
|
60517
|
+
const color = typeof value === "string" ? value : value?.color;
|
|
60518
|
+
if (color) markValue["background-color"] = color;
|
|
60519
|
+
}
|
|
60520
|
+
} else if (key === "underline" && node) {
|
|
60521
|
+
const styleValRaw = value?.value ?? value ?? "";
|
|
60522
|
+
const styleVal = styleValRaw.toString().toLowerCase();
|
|
60523
|
+
const hasInlineUnderlineOff = node.marks?.some(
|
|
60524
|
+
(m2) => m2.type?.name === "underline" && m2.attrs?.underlineType === "none"
|
|
60525
|
+
);
|
|
60526
|
+
const hasInlineUnderlineOn = node.marks?.some(
|
|
60527
|
+
(m2) => m2.type?.name === "underline" && m2.attrs?.underlineType && m2.attrs.underlineType !== "none"
|
|
60528
|
+
);
|
|
60529
|
+
if (!listTypes.includes(node.type.name) && !hasInlineUnderlineOff && !hasInlineUnderlineOn) {
|
|
60530
|
+
if (styleVal && styleVal !== "none" && styleVal !== "0") {
|
|
60531
|
+
const colorVal = value && typeof value === "object" ? value.color || value.underlineColor || null : null;
|
|
60532
|
+
const css = getUnderlineCssString({ type: styleVal, color: colorVal });
|
|
60533
|
+
css.split(";").forEach((decl) => {
|
|
60534
|
+
const d2 = decl.trim();
|
|
60535
|
+
if (!d2) return;
|
|
60536
|
+
const idx = d2.indexOf(":");
|
|
60537
|
+
if (idx === -1) return;
|
|
60538
|
+
const k2 = d2.slice(0, idx).trim();
|
|
60539
|
+
const v2 = d2.slice(idx + 1).trim();
|
|
60540
|
+
markValue[k2] = v2;
|
|
60541
|
+
});
|
|
60542
|
+
}
|
|
60543
|
+
}
|
|
59306
60544
|
} else if (typeof value === "string") {
|
|
59307
60545
|
markValue[key] = value;
|
|
59308
60546
|
}
|
|
@@ -59435,23 +60673,51 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59435
60673
|
};
|
|
59436
60674
|
const generateDecorations = (state2, styles) => {
|
|
59437
60675
|
const decorations = [];
|
|
59438
|
-
let lastStyleId = null;
|
|
59439
60676
|
const doc2 = state2?.doc;
|
|
60677
|
+
const getParagraphStyleId = (pos) => {
|
|
60678
|
+
const $pos = state2.doc.resolve(pos);
|
|
60679
|
+
for (let d2 = $pos.depth; d2 >= 0; d2--) {
|
|
60680
|
+
const n = $pos.node(d2);
|
|
60681
|
+
if (n?.type?.name === "paragraph") return n.attrs?.styleId || null;
|
|
60682
|
+
}
|
|
60683
|
+
return null;
|
|
60684
|
+
};
|
|
59440
60685
|
doc2.descendants((node, pos) => {
|
|
59441
60686
|
const { name } = node.type;
|
|
59442
|
-
if (
|
|
59443
|
-
|
|
59444
|
-
|
|
60687
|
+
if (name !== "text") return;
|
|
60688
|
+
const paragraphStyleId = getParagraphStyleId(pos);
|
|
60689
|
+
let runStyleId = null;
|
|
60690
|
+
let inlineTextStyleId = null;
|
|
59445
60691
|
for (const mark of node.marks) {
|
|
59446
|
-
if (mark.type.name === "
|
|
59447
|
-
|
|
59448
|
-
|
|
59449
|
-
|
|
59450
|
-
|
|
59451
|
-
|
|
60692
|
+
if (mark.type.name === "run") {
|
|
60693
|
+
const rp = mark.attrs?.runProperties;
|
|
60694
|
+
if (rp && typeof rp === "object" && !Array.isArray(rp) && rp.styleId) runStyleId = rp.styleId;
|
|
60695
|
+
else if (Array.isArray(rp)) {
|
|
60696
|
+
const ent = rp.find((e) => e?.xmlName === "w:rStyle");
|
|
60697
|
+
const sid = ent?.attributes?.["w:val"];
|
|
60698
|
+
if (sid) runStyleId = sid;
|
|
60699
|
+
}
|
|
60700
|
+
} else if (mark.type.name === "textStyle" && mark.attrs?.styleId) {
|
|
60701
|
+
inlineTextStyleId = mark.attrs.styleId;
|
|
60702
|
+
}
|
|
60703
|
+
}
|
|
60704
|
+
const buildStyleMap = (sid) => {
|
|
60705
|
+
if (!sid) return {};
|
|
60706
|
+
const { linkedStyle, basedOnStyle: basedOnStyle2 } = getLinkedStyle(sid, styles);
|
|
60707
|
+
if (!linkedStyle) return {};
|
|
60708
|
+
const base2 = { ...basedOnStyle2?.definition?.styles || {} };
|
|
60709
|
+
return { ...base2, ...linkedStyle.definition?.styles || {} };
|
|
60710
|
+
};
|
|
60711
|
+
const pMap = buildStyleMap(paragraphStyleId);
|
|
60712
|
+
const tMap = buildStyleMap(inlineTextStyleId);
|
|
60713
|
+
const rMap = buildStyleMap(runStyleId);
|
|
60714
|
+
const finalStyles = { ...pMap, ...tMap, ...rMap };
|
|
60715
|
+
if (Object.keys(finalStyles).length === 0) return;
|
|
60716
|
+
const mergedLinkedStyle = { definition: { styles: finalStyles, attrs: {} } };
|
|
60717
|
+
const basedOnStyle = null;
|
|
59452
60718
|
const $pos = state2.doc.resolve(pos);
|
|
59453
60719
|
const parent = $pos.parent;
|
|
59454
|
-
const styleString = generateLinkedStyleString(
|
|
60720
|
+
const styleString = generateLinkedStyleString(mergedLinkedStyle, basedOnStyle, node, parent);
|
|
59455
60721
|
if (!styleString) return;
|
|
59456
60722
|
const decoration = Decoration.inline(pos, pos + node.nodeSize, { style: styleString });
|
|
59457
60723
|
decorations.push(decoration);
|
|
@@ -59586,6 +60852,70 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
59586
60852
|
};
|
|
59587
60853
|
}
|
|
59588
60854
|
});
|
|
60855
|
+
function getUnderlineCssString({ type: type2 = "single", color = null, thickness = null, approximate = true } = {}) {
|
|
60856
|
+
const parts = [];
|
|
60857
|
+
const add = (k, v2) => {
|
|
60858
|
+
if (!v2) return;
|
|
60859
|
+
parts.push(`${k}: ${v2}`);
|
|
60860
|
+
};
|
|
60861
|
+
const lower = String(type2 || "single").toLowerCase();
|
|
60862
|
+
if (lower === "none" || lower === "0") {
|
|
60863
|
+
add("text-decoration", "none");
|
|
60864
|
+
return parts.join("; ");
|
|
60865
|
+
}
|
|
60866
|
+
add("text-decoration-line", "underline");
|
|
60867
|
+
const HEAVY = thickness || "0.2em";
|
|
60868
|
+
const THICK = thickness || "0.15em";
|
|
60869
|
+
switch (lower) {
|
|
60870
|
+
case "single":
|
|
60871
|
+
break;
|
|
60872
|
+
case "double":
|
|
60873
|
+
add("text-decoration-style", "double");
|
|
60874
|
+
break;
|
|
60875
|
+
case "thick":
|
|
60876
|
+
add("text-decoration-thickness", THICK);
|
|
60877
|
+
break;
|
|
60878
|
+
case "dotted":
|
|
60879
|
+
add("text-decoration-style", "dotted");
|
|
60880
|
+
break;
|
|
60881
|
+
case "dash":
|
|
60882
|
+
case "dashed":
|
|
60883
|
+
add("text-decoration-style", "dashed");
|
|
60884
|
+
break;
|
|
60885
|
+
case "dotdash":
|
|
60886
|
+
case "dotdotdash":
|
|
60887
|
+
case "dashlong":
|
|
60888
|
+
case "dashlongheavy":
|
|
60889
|
+
if (approximate) {
|
|
60890
|
+
add("text-decoration-style", "dashed");
|
|
60891
|
+
if (lower.includes("heavy")) add("text-decoration-thickness", HEAVY);
|
|
60892
|
+
}
|
|
60893
|
+
break;
|
|
60894
|
+
case "dottedheavy":
|
|
60895
|
+
add("text-decoration-style", "dotted");
|
|
60896
|
+
add("text-decoration-thickness", HEAVY);
|
|
60897
|
+
break;
|
|
60898
|
+
case "dashedheavy":
|
|
60899
|
+
add("text-decoration-style", "dashed");
|
|
60900
|
+
add("text-decoration-thickness", HEAVY);
|
|
60901
|
+
break;
|
|
60902
|
+
case "wavy":
|
|
60903
|
+
add("text-decoration-style", "wavy");
|
|
60904
|
+
break;
|
|
60905
|
+
case "wavyheavy":
|
|
60906
|
+
add("text-decoration-style", "wavy");
|
|
60907
|
+
add("text-decoration-thickness", HEAVY);
|
|
60908
|
+
break;
|
|
60909
|
+
case "wavydouble":
|
|
60910
|
+
if (approximate) {
|
|
60911
|
+
add("text-decoration-style", "wavy");
|
|
60912
|
+
add("text-decoration-thickness", HEAVY);
|
|
60913
|
+
}
|
|
60914
|
+
break;
|
|
60915
|
+
}
|
|
60916
|
+
if (color) add("text-decoration-color", color);
|
|
60917
|
+
return parts.join("; ");
|
|
60918
|
+
}
|
|
59589
60919
|
const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
|
|
59590
60920
|
const handler2 = listIndexMap[listNumberingType];
|
|
59591
60921
|
return handler2 ? handler2(listLevel, lvlText, customFormat) : null;
|
|
@@ -67871,6 +69201,30 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67871
69201
|
};
|
|
67872
69202
|
}
|
|
67873
69203
|
});
|
|
69204
|
+
function createCascadeToggleCommands({
|
|
69205
|
+
markName,
|
|
69206
|
+
setCommand,
|
|
69207
|
+
unsetCommand,
|
|
69208
|
+
toggleCommand,
|
|
69209
|
+
negationAttrs,
|
|
69210
|
+
isNegation,
|
|
69211
|
+
extendEmptyMarkRange
|
|
69212
|
+
} = {}) {
|
|
69213
|
+
if (!markName) throw new Error("createCascadeToggleCommands requires a markName");
|
|
69214
|
+
const capitalized = markName.charAt(0).toUpperCase() + markName.slice(1);
|
|
69215
|
+
const setName = setCommand ?? `set${capitalized}`;
|
|
69216
|
+
const unsetName = unsetCommand ?? `unset${capitalized}`;
|
|
69217
|
+
const toggleName = toggleCommand ?? `toggle${capitalized}`;
|
|
69218
|
+
const cascadeOptions = {};
|
|
69219
|
+
if (negationAttrs) cascadeOptions.negationAttrs = negationAttrs;
|
|
69220
|
+
if (typeof isNegation === "function") cascadeOptions.isNegation = isNegation;
|
|
69221
|
+
if (extendEmptyMarkRange !== void 0) cascadeOptions.extendEmptyMarkRange = extendEmptyMarkRange;
|
|
69222
|
+
return {
|
|
69223
|
+
[setName]: () => ({ commands: commands2 }) => commands2.setMark(markName),
|
|
69224
|
+
[unsetName]: () => ({ commands: commands2 }) => commands2.unsetMark(markName),
|
|
69225
|
+
[toggleName]: () => ({ commands: commands2 }) => commands2.toggleMarkCascade(markName, cascadeOptions)
|
|
69226
|
+
};
|
|
69227
|
+
}
|
|
67874
69228
|
const Bold = Mark.create({
|
|
67875
69229
|
name: "bold",
|
|
67876
69230
|
addOptions() {
|
|
@@ -67905,9 +69259,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67905
69259
|
];
|
|
67906
69260
|
},
|
|
67907
69261
|
renderDOM({ htmlAttributes }) {
|
|
67908
|
-
|
|
69262
|
+
const merged = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
69263
|
+
const { value, ...rest } = merged || {};
|
|
69264
|
+
if (value === "0") {
|
|
69265
|
+
return ["span", rest, 0];
|
|
69266
|
+
}
|
|
69267
|
+
return ["strong", rest, 0];
|
|
67909
69268
|
},
|
|
67910
69269
|
addCommands() {
|
|
69270
|
+
const { setBold, unsetBold, toggleBold } = createCascadeToggleCommands({
|
|
69271
|
+
markName: this.name,
|
|
69272
|
+
negationAttrs: { value: "0" }
|
|
69273
|
+
});
|
|
67911
69274
|
return {
|
|
67912
69275
|
/**
|
|
67913
69276
|
* Apply bold formatting
|
|
@@ -67917,7 +69280,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67917
69280
|
* setBold()
|
|
67918
69281
|
* @note '0' renders as normal weight
|
|
67919
69282
|
*/
|
|
67920
|
-
setBold
|
|
69283
|
+
setBold,
|
|
67921
69284
|
/**
|
|
67922
69285
|
* Remove bold formatting
|
|
67923
69286
|
* @category Command
|
|
@@ -67925,7 +69288,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67925
69288
|
* @example
|
|
67926
69289
|
* unsetBold()
|
|
67927
69290
|
*/
|
|
67928
|
-
unsetBold
|
|
69291
|
+
unsetBold,
|
|
67929
69292
|
/**
|
|
67930
69293
|
* Toggle bold formatting
|
|
67931
69294
|
* @category Command
|
|
@@ -67933,7 +69296,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67933
69296
|
* @example
|
|
67934
69297
|
* toggleBold()
|
|
67935
69298
|
*/
|
|
67936
|
-
toggleBold
|
|
69299
|
+
toggleBold
|
|
67937
69300
|
};
|
|
67938
69301
|
},
|
|
67939
69302
|
addShortcuts() {
|
|
@@ -67950,6 +69313,22 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67950
69313
|
htmlAttributes: {}
|
|
67951
69314
|
};
|
|
67952
69315
|
},
|
|
69316
|
+
addAttributes() {
|
|
69317
|
+
return {
|
|
69318
|
+
/**
|
|
69319
|
+
* @category Attribute
|
|
69320
|
+
* @param {string} [value] - Italic toggle value ('0' renders as normal)
|
|
69321
|
+
*/
|
|
69322
|
+
value: {
|
|
69323
|
+
default: null,
|
|
69324
|
+
renderDOM: (attrs) => {
|
|
69325
|
+
if (!attrs.value) return {};
|
|
69326
|
+
if (attrs.value === "0") return { style: "font-style: normal" };
|
|
69327
|
+
return {};
|
|
69328
|
+
}
|
|
69329
|
+
}
|
|
69330
|
+
};
|
|
69331
|
+
},
|
|
67953
69332
|
parseDOM() {
|
|
67954
69333
|
return [
|
|
67955
69334
|
{ tag: "i" },
|
|
@@ -67959,9 +69338,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67959
69338
|
];
|
|
67960
69339
|
},
|
|
67961
69340
|
renderDOM({ htmlAttributes }) {
|
|
67962
|
-
|
|
69341
|
+
const merged = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
69342
|
+
const { value, ...rest } = merged || {};
|
|
69343
|
+
if (value === "0") {
|
|
69344
|
+
return ["span", rest, 0];
|
|
69345
|
+
}
|
|
69346
|
+
return ["em", rest, 0];
|
|
67963
69347
|
},
|
|
67964
69348
|
addCommands() {
|
|
69349
|
+
const { setItalic, unsetItalic, toggleItalic } = createCascadeToggleCommands({
|
|
69350
|
+
markName: this.name,
|
|
69351
|
+
negationAttrs: { value: "0" }
|
|
69352
|
+
});
|
|
67965
69353
|
return {
|
|
67966
69354
|
/**
|
|
67967
69355
|
* Apply italic formatting
|
|
@@ -67970,7 +69358,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67970
69358
|
* @example
|
|
67971
69359
|
* setItalic()
|
|
67972
69360
|
*/
|
|
67973
|
-
setItalic
|
|
69361
|
+
setItalic,
|
|
67974
69362
|
/**
|
|
67975
69363
|
* Remove italic formatting
|
|
67976
69364
|
* @category Command
|
|
@@ -67978,7 +69366,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67978
69366
|
* @example
|
|
67979
69367
|
* unsetItalic()
|
|
67980
69368
|
*/
|
|
67981
|
-
unsetItalic
|
|
69369
|
+
unsetItalic,
|
|
67982
69370
|
/**
|
|
67983
69371
|
* Toggle italic formatting
|
|
67984
69372
|
* @category Command
|
|
@@ -67986,7 +69374,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
67986
69374
|
* @example
|
|
67987
69375
|
* toggleItalic()
|
|
67988
69376
|
*/
|
|
67989
|
-
toggleItalic
|
|
69377
|
+
toggleItalic
|
|
67990
69378
|
};
|
|
67991
69379
|
},
|
|
67992
69380
|
addShortcuts() {
|
|
@@ -68011,7 +69399,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68011
69399
|
];
|
|
68012
69400
|
},
|
|
68013
69401
|
renderDOM({ htmlAttributes }) {
|
|
68014
|
-
|
|
69402
|
+
const merged = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
69403
|
+
const type2 = merged?.underlineType;
|
|
69404
|
+
const color = merged?.underlineColor;
|
|
69405
|
+
const css = getUnderlineCssString({ type: type2, color });
|
|
69406
|
+
const { style: style2, ...rest } = merged || {};
|
|
69407
|
+
const styleString = [style2, css].filter(Boolean).join("; ");
|
|
69408
|
+
if (type2 === "none") {
|
|
69409
|
+
return ["span", { ...rest, ...styleString ? { style: styleString } : {} }, 0];
|
|
69410
|
+
}
|
|
69411
|
+
return ["u", { ...rest, ...styleString ? { style: styleString } : {} }, 0];
|
|
68015
69412
|
},
|
|
68016
69413
|
addAttributes() {
|
|
68017
69414
|
return {
|
|
@@ -68021,10 +69418,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68021
69418
|
*/
|
|
68022
69419
|
underlineType: {
|
|
68023
69420
|
default: "single"
|
|
69421
|
+
},
|
|
69422
|
+
underlineColor: {
|
|
69423
|
+
default: null
|
|
68024
69424
|
}
|
|
68025
69425
|
};
|
|
68026
69426
|
},
|
|
68027
69427
|
addCommands() {
|
|
69428
|
+
const { setUnderline, unsetUnderline, toggleUnderline } = createCascadeToggleCommands({
|
|
69429
|
+
markName: this.name,
|
|
69430
|
+
negationAttrs: { underlineType: "none" },
|
|
69431
|
+
isNegation: (attrs) => attrs?.underlineType === "none"
|
|
69432
|
+
});
|
|
68028
69433
|
return {
|
|
68029
69434
|
/**
|
|
68030
69435
|
* Apply underline formatting
|
|
@@ -68033,7 +69438,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68033
69438
|
* @example
|
|
68034
69439
|
* setUnderline()
|
|
68035
69440
|
*/
|
|
68036
|
-
setUnderline
|
|
69441
|
+
setUnderline,
|
|
68037
69442
|
/**
|
|
68038
69443
|
* Remove underline formatting
|
|
68039
69444
|
* @category Command
|
|
@@ -68041,7 +69446,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68041
69446
|
* @example
|
|
68042
69447
|
* unsetUnderline()
|
|
68043
69448
|
*/
|
|
68044
|
-
unsetUnderline
|
|
69449
|
+
unsetUnderline,
|
|
68045
69450
|
/**
|
|
68046
69451
|
* Toggle underline formatting
|
|
68047
69452
|
* @category Command
|
|
@@ -68049,7 +69454,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68049
69454
|
* @example
|
|
68050
69455
|
* toggleUnderline()
|
|
68051
69456
|
*/
|
|
68052
|
-
toggleUnderline
|
|
69457
|
+
toggleUnderline
|
|
68053
69458
|
};
|
|
68054
69459
|
},
|
|
68055
69460
|
addShortcuts() {
|
|
@@ -68144,9 +69549,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68144
69549
|
];
|
|
68145
69550
|
},
|
|
68146
69551
|
renderDOM({ htmlAttributes }) {
|
|
68147
|
-
|
|
69552
|
+
const merged = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
69553
|
+
const { value, ...rest } = merged || {};
|
|
69554
|
+
if (value === "0") {
|
|
69555
|
+
return ["span", rest, 0];
|
|
69556
|
+
}
|
|
69557
|
+
return ["s", rest, 0];
|
|
68148
69558
|
},
|
|
68149
69559
|
addCommands() {
|
|
69560
|
+
const { setStrike, unsetStrike, toggleStrike } = createCascadeToggleCommands({
|
|
69561
|
+
markName: this.name,
|
|
69562
|
+
negationAttrs: { value: "0" }
|
|
69563
|
+
});
|
|
68150
69564
|
return {
|
|
68151
69565
|
/**
|
|
68152
69566
|
* Apply strikethrough formatting
|
|
@@ -68155,9 +69569,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68155
69569
|
* @example
|
|
68156
69570
|
* setStrike()
|
|
68157
69571
|
*/
|
|
68158
|
-
setStrike
|
|
68159
|
-
return commands2.setMark(this.name);
|
|
68160
|
-
},
|
|
69572
|
+
setStrike,
|
|
68161
69573
|
/**
|
|
68162
69574
|
* Remove strikethrough formatting
|
|
68163
69575
|
* @category Command
|
|
@@ -68165,9 +69577,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68165
69577
|
* @example
|
|
68166
69578
|
* unsetStrike()
|
|
68167
69579
|
*/
|
|
68168
|
-
unsetStrike
|
|
68169
|
-
return commands2.unsetMark(this.name);
|
|
68170
|
-
},
|
|
69580
|
+
unsetStrike,
|
|
68171
69581
|
/**
|
|
68172
69582
|
* Toggle strikethrough formatting
|
|
68173
69583
|
* @category Command
|
|
@@ -68175,8 +69585,24 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
68175
69585
|
* @example
|
|
68176
69586
|
* toggleStrike()
|
|
68177
69587
|
*/
|
|
68178
|
-
toggleStrike
|
|
68179
|
-
|
|
69588
|
+
toggleStrike
|
|
69589
|
+
};
|
|
69590
|
+
},
|
|
69591
|
+
addAttributes() {
|
|
69592
|
+
return {
|
|
69593
|
+
/**
|
|
69594
|
+
* @category Attribute
|
|
69595
|
+
* @param {string} [value] - Strike toggle value ('0' renders as normal)
|
|
69596
|
+
*/
|
|
69597
|
+
value: {
|
|
69598
|
+
default: null,
|
|
69599
|
+
renderDOM: (attrs) => {
|
|
69600
|
+
if (!attrs.value) return {};
|
|
69601
|
+
if (attrs.value === "0") {
|
|
69602
|
+
return { style: "text-decoration: none" };
|
|
69603
|
+
}
|
|
69604
|
+
return {};
|
|
69605
|
+
}
|
|
68180
69606
|
}
|
|
68181
69607
|
};
|
|
68182
69608
|
},
|
|
@@ -74331,7 +75757,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
74331
75757
|
Paragraph,
|
|
74332
75758
|
LineBreak,
|
|
74333
75759
|
HardBreak,
|
|
74334
|
-
|
|
75760
|
+
Run,
|
|
74335
75761
|
SlashMenu,
|
|
74336
75762
|
Strike,
|
|
74337
75763
|
TabNode,
|
|
@@ -76862,7 +78288,7 @@ ${style2}
|
|
|
76862
78288
|
if (typeof selector === "string") {
|
|
76863
78289
|
return document.querySelector(selector);
|
|
76864
78290
|
}
|
|
76865
|
-
return selector()
|
|
78291
|
+
return selector();
|
|
76866
78292
|
}
|
|
76867
78293
|
const LazyTeleport$1 = /* @__PURE__ */ defineComponent({
|
|
76868
78294
|
name: "LazyTeleport",
|
|
@@ -76950,11 +78376,8 @@ ${style2}
|
|
|
76950
78376
|
};
|
|
76951
78377
|
const keepOffsetDirection$1 = {
|
|
76952
78378
|
top: true,
|
|
76953
|
-
// top++
|
|
76954
78379
|
bottom: false,
|
|
76955
|
-
// top--
|
|
76956
78380
|
left: true,
|
|
76957
|
-
// left++
|
|
76958
78381
|
right: false
|
|
76959
78382
|
// left--
|
|
76960
78383
|
};
|
|
@@ -78071,6 +79494,7 @@ ${style2}
|
|
|
78071
79494
|
return !!element.href && element.rel !== "ignore";
|
|
78072
79495
|
case "INPUT":
|
|
78073
79496
|
return element.type !== "hidden" && element.type !== "file";
|
|
79497
|
+
case "BUTTON":
|
|
78074
79498
|
case "SELECT":
|
|
78075
79499
|
case "TEXTAREA":
|
|
78076
79500
|
return true;
|
|
@@ -78089,8 +79513,8 @@ ${style2}
|
|
|
78089
79513
|
default: true
|
|
78090
79514
|
},
|
|
78091
79515
|
onEsc: Function,
|
|
78092
|
-
initialFocusTo:
|
|
78093
|
-
finalFocusTo:
|
|
79516
|
+
initialFocusTo: String,
|
|
79517
|
+
finalFocusTo: String,
|
|
78094
79518
|
returnFocusOnDeactivated: {
|
|
78095
79519
|
type: Boolean,
|
|
78096
79520
|
default: true
|
|
@@ -80188,7 +81612,6 @@ ${style2}
|
|
|
80188
81612
|
});
|
|
80189
81613
|
}
|
|
80190
81614
|
const scrollbarLight$1 = {
|
|
80191
|
-
name: "Scrollbar",
|
|
80192
81615
|
common: derived$1,
|
|
80193
81616
|
self: self$6$1
|
|
80194
81617
|
};
|
|
@@ -81704,14 +83127,11 @@ ${style2}
|
|
|
81704
83127
|
boxShadow: boxShadow2
|
|
81705
83128
|
});
|
|
81706
83129
|
}
|
|
81707
|
-
const popoverLight$1 =
|
|
83130
|
+
const popoverLight$1 = {
|
|
81708
83131
|
name: "Popover",
|
|
81709
83132
|
common: derived$1,
|
|
81710
|
-
peers: {
|
|
81711
|
-
Scrollbar: scrollbarLight$1
|
|
81712
|
-
},
|
|
81713
83133
|
self: self$5$1
|
|
81714
|
-
}
|
|
83134
|
+
};
|
|
81715
83135
|
const oppositePlacement$1 = {
|
|
81716
83136
|
top: "bottom",
|
|
81717
83137
|
bottom: "top",
|
|
@@ -81931,11 +83351,9 @@ ${style2}
|
|
|
81931
83351
|
const {
|
|
81932
83352
|
namespaceRef,
|
|
81933
83353
|
mergedClsPrefixRef,
|
|
81934
|
-
inlineThemeDisabled
|
|
81935
|
-
mergedRtlRef
|
|
83354
|
+
inlineThemeDisabled
|
|
81936
83355
|
} = useConfig$1(props);
|
|
81937
83356
|
const themeRef = useTheme$1("Popover", "-popover", style$3$1, popoverLight$1, props, mergedClsPrefixRef);
|
|
81938
|
-
const rtlEnabledRef = useRtl$1("Popover", mergedRtlRef, mergedClsPrefixRef);
|
|
81939
83357
|
const followerRef = ref$1(null);
|
|
81940
83358
|
const NPopover2 = inject("NPopover");
|
|
81941
83359
|
const bodyRef = ref$1(null);
|
|
@@ -82133,8 +83551,6 @@ ${style2}
|
|
|
82133
83551
|
style: props.contentStyle
|
|
82134
83552
|
}, slots);
|
|
82135
83553
|
const maybeScrollableBody = props.scrollable ? h$1(XScrollbar$1, {
|
|
82136
|
-
themeOverrides: themeRef.value.peerOverrides.Scrollbar,
|
|
82137
|
-
theme: themeRef.value.peers.Scrollbar,
|
|
82138
83554
|
contentClass: hasHeaderOrFooter ? void 0 : `${mergedClsPrefix}-popover__content ${(_b = props.contentClass) !== null && _b !== void 0 ? _b : ""}`,
|
|
82139
83555
|
contentStyle: hasHeaderOrFooter ? void 0 : props.contentStyle
|
|
82140
83556
|
}, {
|
|
@@ -82150,7 +83566,7 @@ ${style2}
|
|
|
82150
83566
|
return [maybeScrollableBody, arrow2];
|
|
82151
83567
|
};
|
|
82152
83568
|
contentNode = h$1("div", mergeProps({
|
|
82153
|
-
class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`,
|
|
83569
|
+
class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, extraClass.map((v2) => `${mergedClsPrefix}-${v2}`), {
|
|
82154
83570
|
[`${mergedClsPrefix}-popover--scrollable`]: props.scrollable,
|
|
82155
83571
|
[`${mergedClsPrefix}-popover--show-header-or-footer`]: hasHeaderOrFooter,
|
|
82156
83572
|
[`${mergedClsPrefix}-popover--raw`]: props.raw,
|
|
@@ -82174,7 +83590,7 @@ ${style2}
|
|
|
82174
83590
|
// The popover class and overlap class must exists, they will be used
|
|
82175
83591
|
// to place the body & transition animation.
|
|
82176
83592
|
// Shadow class exists for reuse box-shadow.
|
|
82177
|
-
[`${mergedClsPrefix}-popover-shared`,
|
|
83593
|
+
[`${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`],
|
|
82178
83594
|
bodyRef,
|
|
82179
83595
|
styleRef.value,
|
|
82180
83596
|
handleMouseEnter,
|
|
@@ -87651,10 +89067,14 @@ ${style2}
|
|
|
87651
89067
|
* @param {string} params.argument - The color to set
|
|
87652
89068
|
* @returns {void}
|
|
87653
89069
|
*/
|
|
87654
|
-
setColor: ({
|
|
87655
|
-
|
|
87656
|
-
|
|
87657
|
-
|
|
89070
|
+
setColor: ({ argument }) => {
|
|
89071
|
+
if (!argument || !this.activeEditor) return;
|
|
89072
|
+
const isNone = argument === "none";
|
|
89073
|
+
const value = isNone ? "inherit" : argument;
|
|
89074
|
+
if (this.activeEditor?.commands?.setColor) this.activeEditor.commands.setColor(value);
|
|
89075
|
+
const argValue = isNone ? null : argument;
|
|
89076
|
+
this.activeEditor?.commands.setFieldAnnotationsTextColor(argValue, true);
|
|
89077
|
+
this.updateToolbarState();
|
|
87658
89078
|
},
|
|
87659
89079
|
/**
|
|
87660
89080
|
* Sets the highlight color for text
|
|
@@ -87663,12 +89083,14 @@ ${style2}
|
|
|
87663
89083
|
* @param {string} params.argument - The highlight color to set
|
|
87664
89084
|
* @returns {void}
|
|
87665
89085
|
*/
|
|
87666
|
-
setHighlight: ({
|
|
87667
|
-
|
|
87668
|
-
|
|
87669
|
-
|
|
87670
|
-
|
|
87671
|
-
|
|
89086
|
+
setHighlight: ({ argument }) => {
|
|
89087
|
+
if (!argument || !this.activeEditor) return;
|
|
89088
|
+
const inlineColor = argument !== "none" ? argument : "transparent";
|
|
89089
|
+
if (this.activeEditor?.commands?.setHighlight) this.activeEditor.commands.setHighlight(inlineColor);
|
|
89090
|
+
const argValue = argument !== "none" ? argument : null;
|
|
89091
|
+
this.activeEditor?.commands.setFieldAnnotationsTextHighlight(argValue, true);
|
|
89092
|
+
this.activeEditor?.commands.setCellBackground(argValue);
|
|
89093
|
+
this.updateToolbarState();
|
|
87672
89094
|
},
|
|
87673
89095
|
/**
|
|
87674
89096
|
* Toggles the ruler visibility
|
|
@@ -88035,7 +89457,6 @@ ${style2}
|
|
|
88035
89457
|
if (!command2) {
|
|
88036
89458
|
return;
|
|
88037
89459
|
}
|
|
88038
|
-
this.log("(emmitCommand) Command:", command2, "\n item:", item, "\n argument:", argument, "\n option:", option);
|
|
88039
89460
|
if (command2 in __privateGet(this, _interceptedCommands)) {
|
|
88040
89461
|
return __privateGet(this, _interceptedCommands)[command2]({ item, argument });
|
|
88041
89462
|
}
|
|
@@ -89598,11 +91019,32 @@ ${style2}
|
|
|
89598
91019
|
}
|
|
89599
91020
|
};
|
|
89600
91021
|
const SuperInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-4d5cff52"]]);
|
|
89601
|
-
const
|
|
89602
|
-
|
|
89603
|
-
"w:
|
|
89604
|
-
"w:
|
|
89605
|
-
|
|
91022
|
+
const baseHandlers = {
|
|
91023
|
+
...runPropertyTranslators,
|
|
91024
|
+
"w:br": translator$v,
|
|
91025
|
+
"w:cantSplit": translator$r,
|
|
91026
|
+
"w:cnfStyle": translator$q,
|
|
91027
|
+
"w:divId": translator$p,
|
|
91028
|
+
"w:gridAfter": translator$o,
|
|
91029
|
+
"w:gridBefore": translator$n,
|
|
91030
|
+
"w:hidden": translator$m,
|
|
91031
|
+
"w:hyperlink": translator$c,
|
|
91032
|
+
"w:jc": translator$l,
|
|
91033
|
+
"w:p": translator$s,
|
|
91034
|
+
"w:r": translator,
|
|
91035
|
+
"w:rPr": translator$1,
|
|
91036
|
+
"w:sdt": translator$b,
|
|
91037
|
+
"w:tab": translator$t,
|
|
91038
|
+
"w:tblCellSpacing": translator$k,
|
|
91039
|
+
"w:tblHeader": translator$j,
|
|
91040
|
+
"w:tc": translator$d,
|
|
91041
|
+
"w:tr": translator$e,
|
|
91042
|
+
"w:trHeight": translator$i,
|
|
91043
|
+
"w:trPr": translator$f,
|
|
91044
|
+
"w:wAfter": translator$h,
|
|
91045
|
+
"w:wBefore": translator$g
|
|
91046
|
+
};
|
|
91047
|
+
const registeredHandlers = Object.freeze(baseHandlers);
|
|
89606
91048
|
const Extensions = {
|
|
89607
91049
|
Node: Node$1,
|
|
89608
91050
|
Attribute,
|
|
@@ -92991,7 +94433,6 @@ ${reason}`);
|
|
|
92991
94433
|
}
|
|
92992
94434
|
debounceTimers[commentId] = setTimeout(() => {
|
|
92993
94435
|
if (superdoc2) {
|
|
92994
|
-
if (__IS_DEBUG__) console.debug("[debounceEmit] tracked change update emitting...", event);
|
|
92995
94436
|
superdoc2.emit("comments-update", event);
|
|
92996
94437
|
}
|
|
92997
94438
|
delete debounceTimers[commentId];
|
|
@@ -92999,7 +94440,6 @@ ${reason}`);
|
|
|
92999
94440
|
};
|
|
93000
94441
|
const showAddComment = (superdoc2) => {
|
|
93001
94442
|
const event = { type: COMMENT_EVENTS.PENDING };
|
|
93002
|
-
if (__IS_DEBUG__) console.debug("[showAddComment] emitting...", event);
|
|
93003
94443
|
superdoc2.emit("comments-update", event);
|
|
93004
94444
|
const selection = { ...superdocStore.activeSelection };
|
|
93005
94445
|
selection.selectionBounds = { ...selection.selectionBounds };
|
|
@@ -93100,7 +94540,6 @@ ${reason}`);
|
|
|
93100
94540
|
}
|
|
93101
94541
|
const event = { type: COMMENT_EVENTS.ADD, comment: newComment.getValues() };
|
|
93102
94542
|
syncCommentsToClients(superdoc2, event);
|
|
93103
|
-
if (__IS_DEBUG__) console.debug("[addComment] emitting...", event);
|
|
93104
94543
|
superdoc2.emit("comments-update", event);
|
|
93105
94544
|
};
|
|
93106
94545
|
const deleteComment = ({ commentId: commentIdToDelete, superdoc: superdoc2 }) => {
|
|
@@ -93117,7 +94556,6 @@ ${reason}`);
|
|
|
93117
94556
|
comment: comment.getValues(),
|
|
93118
94557
|
changes: [{ key: "deleted", commentId, fileId }]
|
|
93119
94558
|
};
|
|
93120
|
-
if (__IS_DEBUG__) console.debug("[deleteComment] emitting...", event);
|
|
93121
94559
|
superdoc2.emit("comments-update", event);
|
|
93122
94560
|
syncCommentsToClients(superdoc2, event);
|
|
93123
94561
|
};
|
|
@@ -93126,7 +94564,6 @@ ${reason}`);
|
|
|
93126
94564
|
};
|
|
93127
94565
|
const processLoadedDocxComments = async ({ superdoc: superdoc2, editor, comments, documentId }) => {
|
|
93128
94566
|
const document2 = superdocStore.getDocument(documentId);
|
|
93129
|
-
if (__IS_DEBUG__) console.debug("[processLoadedDocxComments] processing comments...", comments);
|
|
93130
94567
|
comments.forEach((comment) => {
|
|
93131
94568
|
const htmlContent = getHTmlFromComment(comment.textJson);
|
|
93132
94569
|
if (!htmlContent && !comment.trackedChange) {
|
|
@@ -95300,7 +96737,7 @@ ${style2}
|
|
|
95300
96737
|
if (typeof selector === "string") {
|
|
95301
96738
|
return document.querySelector(selector);
|
|
95302
96739
|
}
|
|
95303
|
-
return selector()
|
|
96740
|
+
return selector();
|
|
95304
96741
|
}
|
|
95305
96742
|
const LazyTeleport = /* @__PURE__ */ defineComponent({
|
|
95306
96743
|
name: "LazyTeleport",
|
|
@@ -95388,11 +96825,8 @@ ${style2}
|
|
|
95388
96825
|
};
|
|
95389
96826
|
const keepOffsetDirection = {
|
|
95390
96827
|
top: true,
|
|
95391
|
-
// top++
|
|
95392
96828
|
bottom: false,
|
|
95393
|
-
// top--
|
|
95394
96829
|
left: true,
|
|
95395
|
-
// left++
|
|
95396
96830
|
right: false
|
|
95397
96831
|
// left--
|
|
95398
96832
|
};
|
|
@@ -96509,6 +97943,7 @@ ${style2}
|
|
|
96509
97943
|
return !!element.href && element.rel !== "ignore";
|
|
96510
97944
|
case "INPUT":
|
|
96511
97945
|
return element.type !== "hidden" && element.type !== "file";
|
|
97946
|
+
case "BUTTON":
|
|
96512
97947
|
case "SELECT":
|
|
96513
97948
|
case "TEXTAREA":
|
|
96514
97949
|
return true;
|
|
@@ -96527,8 +97962,8 @@ ${style2}
|
|
|
96527
97962
|
default: true
|
|
96528
97963
|
},
|
|
96529
97964
|
onEsc: Function,
|
|
96530
|
-
initialFocusTo:
|
|
96531
|
-
finalFocusTo:
|
|
97965
|
+
initialFocusTo: String,
|
|
97966
|
+
finalFocusTo: String,
|
|
96532
97967
|
returnFocusOnDeactivated: {
|
|
96533
97968
|
type: Boolean,
|
|
96534
97969
|
default: true
|
|
@@ -99303,7 +100738,6 @@ ${style2}
|
|
|
99303
100738
|
});
|
|
99304
100739
|
}
|
|
99305
100740
|
const scrollbarLight = {
|
|
99306
|
-
name: "Scrollbar",
|
|
99307
100741
|
common: derived,
|
|
99308
100742
|
self: self$7
|
|
99309
100743
|
};
|
|
@@ -100808,14 +102242,11 @@ ${style2}
|
|
|
100808
102242
|
boxShadow: boxShadow2
|
|
100809
102243
|
});
|
|
100810
102244
|
}
|
|
100811
|
-
const popoverLight =
|
|
102245
|
+
const popoverLight = {
|
|
100812
102246
|
name: "Popover",
|
|
100813
102247
|
common: derived,
|
|
100814
|
-
peers: {
|
|
100815
|
-
Scrollbar: scrollbarLight
|
|
100816
|
-
},
|
|
100817
102248
|
self: self$6
|
|
100818
|
-
}
|
|
102249
|
+
};
|
|
100819
102250
|
const oppositePlacement = {
|
|
100820
102251
|
top: "bottom",
|
|
100821
102252
|
bottom: "top",
|
|
@@ -101035,11 +102466,9 @@ ${style2}
|
|
|
101035
102466
|
const {
|
|
101036
102467
|
namespaceRef,
|
|
101037
102468
|
mergedClsPrefixRef,
|
|
101038
|
-
inlineThemeDisabled
|
|
101039
|
-
mergedRtlRef
|
|
102469
|
+
inlineThemeDisabled
|
|
101040
102470
|
} = useConfig(props);
|
|
101041
102471
|
const themeRef = useTheme("Popover", "-popover", style$5, popoverLight, props, mergedClsPrefixRef);
|
|
101042
|
-
const rtlEnabledRef = useRtl("Popover", mergedRtlRef, mergedClsPrefixRef);
|
|
101043
102472
|
const followerRef = ref$1(null);
|
|
101044
102473
|
const NPopover2 = inject("NPopover");
|
|
101045
102474
|
const bodyRef = ref$1(null);
|
|
@@ -101237,8 +102666,6 @@ ${style2}
|
|
|
101237
102666
|
style: props.contentStyle
|
|
101238
102667
|
}, slots);
|
|
101239
102668
|
const maybeScrollableBody = props.scrollable ? h$1(XScrollbar, {
|
|
101240
|
-
themeOverrides: themeRef.value.peerOverrides.Scrollbar,
|
|
101241
|
-
theme: themeRef.value.peers.Scrollbar,
|
|
101242
102669
|
contentClass: hasHeaderOrFooter ? void 0 : `${mergedClsPrefix}-popover__content ${(_b = props.contentClass) !== null && _b !== void 0 ? _b : ""}`,
|
|
101243
102670
|
contentStyle: hasHeaderOrFooter ? void 0 : props.contentStyle
|
|
101244
102671
|
}, {
|
|
@@ -101254,7 +102681,7 @@ ${style2}
|
|
|
101254
102681
|
return [maybeScrollableBody, arrow2];
|
|
101255
102682
|
};
|
|
101256
102683
|
contentNode = h$1("div", mergeProps({
|
|
101257
|
-
class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`,
|
|
102684
|
+
class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, extraClass.map((v2) => `${mergedClsPrefix}-${v2}`), {
|
|
101258
102685
|
[`${mergedClsPrefix}-popover--scrollable`]: props.scrollable,
|
|
101259
102686
|
[`${mergedClsPrefix}-popover--show-header-or-footer`]: hasHeaderOrFooter,
|
|
101260
102687
|
[`${mergedClsPrefix}-popover--raw`]: props.raw,
|
|
@@ -101278,7 +102705,7 @@ ${style2}
|
|
|
101278
102705
|
// The popover class and overlap class must exists, they will be used
|
|
101279
102706
|
// to place the body & transition animation.
|
|
101280
102707
|
// Shadow class exists for reuse box-shadow.
|
|
101281
|
-
[`${mergedClsPrefix}-popover-shared`,
|
|
102708
|
+
[`${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`],
|
|
101282
102709
|
bodyRef,
|
|
101283
102710
|
styleRef.value,
|
|
101284
102711
|
handleMouseEnter,
|
|
@@ -103703,8 +105130,7 @@ ${style2}
|
|
|
103703
105130
|
closeIconColorPressedLoading: closeIconColorPressed,
|
|
103704
105131
|
loadingColor: primaryColor,
|
|
103705
105132
|
lineHeight: lineHeight2,
|
|
103706
|
-
borderRadius
|
|
103707
|
-
border: "0"
|
|
105133
|
+
borderRadius
|
|
103708
105134
|
});
|
|
103709
105135
|
}
|
|
103710
105136
|
const messageLight = {
|
|
@@ -103755,7 +105181,6 @@ ${style2}
|
|
|
103755
105181
|
margin-bottom .3s var(--n-bezier);
|
|
103756
105182
|
padding: var(--n-padding);
|
|
103757
105183
|
border-radius: var(--n-border-radius);
|
|
103758
|
-
border: var(--n-border);
|
|
103759
105184
|
flex-wrap: nowrap;
|
|
103760
105185
|
overflow: hidden;
|
|
103761
105186
|
max-width: var(--n-max-width);
|
|
@@ -103874,7 +105299,6 @@ ${style2}
|
|
|
103874
105299
|
fontSize: fontSize2,
|
|
103875
105300
|
lineHeight: lineHeight2,
|
|
103876
105301
|
borderRadius,
|
|
103877
|
-
border,
|
|
103878
105302
|
iconColorInfo,
|
|
103879
105303
|
iconColorSuccess,
|
|
103880
105304
|
iconColorWarning,
|
|
@@ -103918,8 +105342,7 @@ ${style2}
|
|
|
103918
105342
|
"--n-close-icon-color-pressed": closeIconColorPressed,
|
|
103919
105343
|
"--n-close-icon-color-hover": closeIconColorHover,
|
|
103920
105344
|
"--n-line-height": lineHeight2,
|
|
103921
|
-
"--n-border-radius": borderRadius
|
|
103922
|
-
"--n-border": border
|
|
105345
|
+
"--n-border-radius": borderRadius
|
|
103923
105346
|
};
|
|
103924
105347
|
});
|
|
103925
105348
|
const themeClassHandle = inlineThemeDisabled ? useThemeClass("message", computed(() => props.type[0]), cssVarsRef, {}) : void 0;
|
|
@@ -106880,7 +108303,7 @@ ${style2}
|
|
|
106880
108303
|
this.config.colors = shuffleArray(this.config.colors);
|
|
106881
108304
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
106882
108305
|
this.colorIndex = 0;
|
|
106883
|
-
this.version = "0.
|
|
108306
|
+
this.version = "0.21.0-RC1";
|
|
106884
108307
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
106885
108308
|
this.superdocId = config2.superdocId || v4();
|
|
106886
108309
|
this.colors = this.config.colors;
|