@harbour-enterprises/superdoc 1.5.0-next.6 → 1.5.0-next.8
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/README.md +2 -2
- package/dist/chunks/{PdfViewer-DICnVjkl.es.js → PdfViewer-ChE3uW6-.es.js} +2 -2
- package/dist/chunks/{PdfViewer-Bm3aYkue.cjs → PdfViewer-DKfNDdEk.cjs} +2 -2
- package/dist/chunks/{SuperConverter-q49H1rID.es.js → SuperConverter-CXmwt666.es.js} +1088 -470
- package/dist/chunks/{SuperConverter-Cih2T-NE.cjs → SuperConverter-iLb7JzYI.cjs} +1088 -470
- package/dist/chunks/{index-BhJCVQFg.es.js → index-BpblHOoK.es.js} +4 -4
- package/dist/chunks/{index-224wdSXe.cjs → index-CJcGqc_k.cjs} +410 -25
- package/dist/chunks/{index-RKdc-5FM.cjs → index-Cv7KI1Ex.cjs} +4 -4
- package/dist/chunks/{index-BgZnM0Uj.es.js → index-DIb368iJ.es.js} +410 -25
- package/dist/style.css +7 -0
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc.cjs +3 -3
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +1496 -493
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -3
|
@@ -3642,6 +3642,11 @@ const DEFAULT_DOCX_DEFS = {
|
|
|
3642
3642
|
"xmlns:v": "urn:schemas-microsoft-com:vml",
|
|
3643
3643
|
"xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
|
|
3644
3644
|
"xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
|
|
3645
|
+
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
3646
|
+
"xmlns:pic": "http://schemas.openxmlformats.org/drawingml/2006/picture",
|
|
3647
|
+
"xmlns:c": "http://schemas.openxmlformats.org/drawingml/2006/chart",
|
|
3648
|
+
"xmlns:dgm": "http://schemas.openxmlformats.org/drawingml/2006/diagram",
|
|
3649
|
+
"xmlns:lc": "http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas",
|
|
3645
3650
|
"xmlns:w10": "urn:schemas-microsoft-com:office:word",
|
|
3646
3651
|
"xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
3647
3652
|
"xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
|
|
@@ -6299,7 +6304,7 @@ const config$r = {
|
|
|
6299
6304
|
decode: decode$_,
|
|
6300
6305
|
attributes: validXmlAttributes$j
|
|
6301
6306
|
};
|
|
6302
|
-
const translator$
|
|
6307
|
+
const translator$2s = NodeTranslator.from(config$r);
|
|
6303
6308
|
const encode$X = (attributes) => attributes?.["w:val"];
|
|
6304
6309
|
const decode$Z = (attrs) => attrs?.highlight;
|
|
6305
6310
|
const attrConfig$x = Object.freeze({
|
|
@@ -6361,7 +6366,7 @@ const config$q = {
|
|
|
6361
6366
|
decode: decode$Y,
|
|
6362
6367
|
attributes: validXmlAttributes$i
|
|
6363
6368
|
};
|
|
6364
|
-
const translator$
|
|
6369
|
+
const translator$2r = NodeTranslator.from(config$q);
|
|
6365
6370
|
const encode$V = (attributes) => {
|
|
6366
6371
|
return attributes["w:val"];
|
|
6367
6372
|
};
|
|
@@ -6440,7 +6445,7 @@ const config$p = {
|
|
|
6440
6445
|
decode: decode$U,
|
|
6441
6446
|
attributes: validXmlAttributes$h
|
|
6442
6447
|
};
|
|
6443
|
-
const translator$
|
|
6448
|
+
const translator$2q = NodeTranslator.from(config$p);
|
|
6444
6449
|
const carbonCopy = (obj) => {
|
|
6445
6450
|
if (!obj) return void 0;
|
|
6446
6451
|
try {
|
|
@@ -6766,10 +6771,10 @@ const integerToString = (value) => {
|
|
|
6766
6771
|
const intValue = parseInteger(value);
|
|
6767
6772
|
return intValue != void 0 ? String(intValue) : void 0;
|
|
6768
6773
|
};
|
|
6769
|
-
const translator$
|
|
6770
|
-
const translator$
|
|
6771
|
-
const translator$
|
|
6772
|
-
const translator$
|
|
6774
|
+
const translator$2p = NodeTranslator.from(createSingleBooleanPropertyHandler("w:b", "bold"));
|
|
6775
|
+
const translator$2o = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bCs", "boldCs"));
|
|
6776
|
+
const translator$2n = NodeTranslator.from(createBorderPropertyHandler("w:bdr", "borders"));
|
|
6777
|
+
const translator$2m = NodeTranslator.from(createSingleBooleanPropertyHandler("w:i", "italic"));
|
|
6773
6778
|
const encode$R = (attributes) => attributes?.["w:val"];
|
|
6774
6779
|
const decode$T = (attrs) => attrs?.underline;
|
|
6775
6780
|
const attrConfig$t = Object.freeze({
|
|
@@ -6864,10 +6869,10 @@ const config$o = {
|
|
|
6864
6869
|
decode: decode$O,
|
|
6865
6870
|
attributes: validXmlAttributes$g
|
|
6866
6871
|
};
|
|
6867
|
-
const translator$
|
|
6868
|
-
const translator$
|
|
6869
|
-
const translator$
|
|
6870
|
-
const translator$
|
|
6872
|
+
const translator$2l = NodeTranslator.from(config$o);
|
|
6873
|
+
const translator$2k = NodeTranslator.from(createSingleBooleanPropertyHandler("w:strike"));
|
|
6874
|
+
const translator$2j = NodeTranslator.from(createSingleBooleanPropertyHandler("w:dstrike"));
|
|
6875
|
+
const translator$2i = NodeTranslator.from({
|
|
6871
6876
|
xmlName: "w:color",
|
|
6872
6877
|
sdNodeOrKeyName: "color",
|
|
6873
6878
|
attributes: [
|
|
@@ -6884,7 +6889,7 @@ const translator$2h = NodeTranslator.from({
|
|
|
6884
6889
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
6885
6890
|
}
|
|
6886
6891
|
});
|
|
6887
|
-
const translator$
|
|
6892
|
+
const translator$2h = NodeTranslator.from({
|
|
6888
6893
|
xmlName: "w:rFonts",
|
|
6889
6894
|
sdNodeOrKeyName: "fontFamily",
|
|
6890
6895
|
attributes: [
|
|
@@ -6915,16 +6920,16 @@ const translator$2g = NodeTranslator.from({
|
|
|
6915
6920
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
6916
6921
|
}
|
|
6917
6922
|
});
|
|
6918
|
-
const translator$
|
|
6919
|
-
const translator$
|
|
6920
|
-
const translator$
|
|
6921
|
-
const translator$
|
|
6923
|
+
const translator$2g = NodeTranslator.from(createSingleAttrPropertyHandler("w:rStyle", "styleId"));
|
|
6924
|
+
const translator$2f = NodeTranslator.from(createSingleIntegerPropertyHandler("w:sz", "fontSize"));
|
|
6925
|
+
const translator$2e = NodeTranslator.from(createSingleIntegerPropertyHandler("w:szCs", "fontSizeCs"));
|
|
6926
|
+
const translator$2d = NodeTranslator.from({
|
|
6922
6927
|
xmlName: "w:caps",
|
|
6923
6928
|
sdNodeOrKeyName: "textTransform",
|
|
6924
6929
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1") ? "uppercase" : "none",
|
|
6925
6930
|
decode: ({ node }) => node.attrs["textTransform"] != null ? { name: "w:caps", attributes: { "w:val": booleanToString(node.attrs["textTransform"] === "uppercase") } } : void 0
|
|
6926
6931
|
});
|
|
6927
|
-
const translator$
|
|
6932
|
+
const translator$2c = NodeTranslator.from({
|
|
6928
6933
|
xmlName: "w:shd",
|
|
6929
6934
|
sdNodeOrKeyName: "shading",
|
|
6930
6935
|
attributes: [
|
|
@@ -6946,7 +6951,7 @@ const translator$2b = NodeTranslator.from({
|
|
|
6946
6951
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
6947
6952
|
}
|
|
6948
6953
|
});
|
|
6949
|
-
const translator$
|
|
6954
|
+
const translator$2b = NodeTranslator.from({
|
|
6950
6955
|
xmlName: "w:lang",
|
|
6951
6956
|
sdNodeOrKeyName: "lang",
|
|
6952
6957
|
attributes: [createAttributeHandler("w:val"), createAttributeHandler("w:eastAsia"), createAttributeHandler("w:bidi")],
|
|
@@ -6958,24 +6963,24 @@ const translator$2a = NodeTranslator.from({
|
|
|
6958
6963
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
6959
6964
|
}
|
|
6960
6965
|
});
|
|
6961
|
-
const translator$
|
|
6962
|
-
const translator$
|
|
6963
|
-
const translator$
|
|
6964
|
-
const translator$
|
|
6965
|
-
const translator$
|
|
6966
|
-
const translator$
|
|
6967
|
-
const translator$
|
|
6968
|
-
const translator$
|
|
6969
|
-
const translator$
|
|
6970
|
-
const translator$
|
|
6971
|
-
const translator$
|
|
6972
|
-
const translator$
|
|
6973
|
-
const translator$
|
|
6974
|
-
const translator$
|
|
6975
|
-
const translator$
|
|
6976
|
-
const translator$
|
|
6977
|
-
const translator$
|
|
6978
|
-
const translator$
|
|
6966
|
+
const translator$2a = NodeTranslator.from(createSingleIntegerPropertyHandler("w:spacing", "letterSpacing"));
|
|
6967
|
+
const translator$29 = NodeTranslator.from(createSingleAttrPropertyHandler("w:vertAlign"));
|
|
6968
|
+
const translator$28 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:smallCaps"));
|
|
6969
|
+
const translator$27 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:snapToGrid"));
|
|
6970
|
+
const translator$26 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:emboss"));
|
|
6971
|
+
const translator$25 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:imprint"));
|
|
6972
|
+
const translator$24 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:noProof"));
|
|
6973
|
+
const translator$23 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:oMath"));
|
|
6974
|
+
const translator$22 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:outline"));
|
|
6975
|
+
const translator$21 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:shadow"));
|
|
6976
|
+
const translator$20 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:vanish"));
|
|
6977
|
+
const translator$1$ = NodeTranslator.from(createSingleBooleanPropertyHandler("w:specVanish"));
|
|
6978
|
+
const translator$1_ = NodeTranslator.from(createSingleAttrPropertyHandler("w:effect"));
|
|
6979
|
+
const translator$1Z = NodeTranslator.from(createSingleAttrPropertyHandler("w:em"));
|
|
6980
|
+
const translator$1Y = NodeTranslator.from(createSingleAttrPropertyHandler("w:w"));
|
|
6981
|
+
const translator$1X = NodeTranslator.from(createSingleIntegerPropertyHandler("w:kern"));
|
|
6982
|
+
const translator$1W = NodeTranslator.from(createSingleIntegerPropertyHandler("w:position"));
|
|
6983
|
+
const translator$1V = NodeTranslator.from({
|
|
6979
6984
|
xmlName: "w:fitText",
|
|
6980
6985
|
sdNodeOrKeyName: "fitText",
|
|
6981
6986
|
attributes: [createIntegerAttributeHandler("w:val"), createIntegerAttributeHandler("w:id")],
|
|
@@ -6987,7 +6992,7 @@ const translator$1U = NodeTranslator.from({
|
|
|
6987
6992
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
6988
6993
|
}
|
|
6989
6994
|
});
|
|
6990
|
-
const translator$
|
|
6995
|
+
const translator$1U = NodeTranslator.from({
|
|
6991
6996
|
xmlName: "w:eastAsianLayout",
|
|
6992
6997
|
sdNodeOrKeyName: "eastAsianLayout",
|
|
6993
6998
|
attributes: [
|
|
@@ -7005,53 +7010,53 @@ const translator$1T = NodeTranslator.from({
|
|
|
7005
7010
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
7006
7011
|
}
|
|
7007
7012
|
});
|
|
7008
|
-
const translator$
|
|
7009
|
-
const translator$
|
|
7010
|
-
const translator$
|
|
7011
|
-
const translator$
|
|
7012
|
-
const propertyTranslators$
|
|
7013
|
-
translator$2n,
|
|
7013
|
+
const translator$1T = NodeTranslator.from(createSingleBooleanPropertyHandler("w:rtl"));
|
|
7014
|
+
const translator$1S = NodeTranslator.from(createSingleBooleanPropertyHandler("w:cs"));
|
|
7015
|
+
const translator$1R = NodeTranslator.from(createSingleBooleanPropertyHandler("w:iCs"));
|
|
7016
|
+
const translator$1Q = NodeTranslator.from(createSingleBooleanPropertyHandler("w:webHidden"));
|
|
7017
|
+
const propertyTranslators$c = [
|
|
7014
7018
|
translator$2o,
|
|
7015
|
-
translator$
|
|
7016
|
-
translator$
|
|
7017
|
-
translator$
|
|
7018
|
-
translator$1R,
|
|
7019
|
+
translator$2p,
|
|
7020
|
+
translator$2n,
|
|
7021
|
+
translator$2d,
|
|
7019
7022
|
translator$2i,
|
|
7020
|
-
translator$
|
|
7021
|
-
translator$
|
|
7022
|
-
translator$1Y,
|
|
7023
|
-
translator$25,
|
|
7023
|
+
translator$1S,
|
|
7024
|
+
translator$2j,
|
|
7024
7025
|
translator$1U,
|
|
7025
|
-
translator$
|
|
7026
|
-
translator$
|
|
7026
|
+
translator$1_,
|
|
7027
|
+
translator$1Z,
|
|
7028
|
+
translator$26,
|
|
7029
|
+
translator$1V,
|
|
7030
|
+
translator$2h,
|
|
7027
7031
|
translator$2e,
|
|
7028
|
-
translator$
|
|
7029
|
-
translator$
|
|
7030
|
-
translator$
|
|
7031
|
-
translator$
|
|
7032
|
-
translator$
|
|
7032
|
+
translator$2f,
|
|
7033
|
+
translator$2r,
|
|
7034
|
+
translator$25,
|
|
7035
|
+
translator$2m,
|
|
7036
|
+
translator$1R,
|
|
7037
|
+
translator$1X,
|
|
7038
|
+
translator$2b,
|
|
7033
7039
|
translator$2a,
|
|
7034
|
-
translator$
|
|
7040
|
+
translator$24,
|
|
7035
7041
|
translator$23,
|
|
7036
7042
|
translator$22,
|
|
7043
|
+
translator$1W,
|
|
7044
|
+
translator$1T,
|
|
7045
|
+
translator$2g,
|
|
7037
7046
|
translator$21,
|
|
7038
|
-
translator$
|
|
7039
|
-
translator$
|
|
7040
|
-
translator$2f,
|
|
7041
|
-
translator$20,
|
|
7042
|
-
translator$2b,
|
|
7047
|
+
translator$2c,
|
|
7048
|
+
translator$28,
|
|
7043
7049
|
translator$27,
|
|
7044
|
-
translator$26,
|
|
7045
|
-
translator$1_,
|
|
7046
|
-
translator$2j,
|
|
7047
|
-
translator$2k,
|
|
7048
7050
|
translator$1$,
|
|
7049
|
-
translator$
|
|
7050
|
-
translator$
|
|
7051
|
-
translator$
|
|
7051
|
+
translator$2k,
|
|
7052
|
+
translator$2l,
|
|
7053
|
+
translator$20,
|
|
7054
|
+
translator$29,
|
|
7055
|
+
translator$1Q,
|
|
7056
|
+
translator$1Y
|
|
7052
7057
|
];
|
|
7053
|
-
const translator$
|
|
7054
|
-
createNestedPropertiesTranslator("w:rPr", "runProperties", propertyTranslators$
|
|
7058
|
+
const translator$1P = NodeTranslator.from(
|
|
7059
|
+
createNestedPropertiesTranslator("w:rPr", "runProperties", propertyTranslators$c)
|
|
7055
7060
|
);
|
|
7056
7061
|
const SUPPORTED_ALTERNATE_CONTENT_REQUIRES = /* @__PURE__ */ new Set([
|
|
7057
7062
|
"wps",
|
|
@@ -7132,18 +7137,18 @@ function selectAlternateContentElements(node) {
|
|
|
7132
7137
|
elements: carbonCopy(selectedElements)
|
|
7133
7138
|
};
|
|
7134
7139
|
}
|
|
7135
|
-
const translator$
|
|
7140
|
+
const translator$1O = NodeTranslator.from(config$n);
|
|
7136
7141
|
function buildPath(existingPath = [], node, branch) {
|
|
7137
7142
|
const path = [...existingPath];
|
|
7138
7143
|
if (node) path.push(node);
|
|
7139
7144
|
if (branch) path.push(branch);
|
|
7140
7145
|
return path;
|
|
7141
7146
|
}
|
|
7142
|
-
const translator$
|
|
7143
|
-
const translator$
|
|
7144
|
-
const translator$
|
|
7145
|
-
const translator$
|
|
7146
|
-
const translator$
|
|
7147
|
+
const translator$1N = NodeTranslator.from(createSingleBooleanPropertyHandler("w:adjustRightInd"));
|
|
7148
|
+
const translator$1M = NodeTranslator.from(createSingleBooleanPropertyHandler("w:autoSpaceDE"));
|
|
7149
|
+
const translator$1L = NodeTranslator.from(createSingleBooleanPropertyHandler("w:autoSpaceDN"));
|
|
7150
|
+
const translator$1K = NodeTranslator.from(createSingleBooleanPropertyHandler("w:bidi", "rightToLeft"));
|
|
7151
|
+
const translator$1J = NodeTranslator.from({
|
|
7147
7152
|
xmlName: "w:cnfStyle",
|
|
7148
7153
|
sdNodeOrKeyName: "cnfStyle",
|
|
7149
7154
|
attributes: [
|
|
@@ -7169,9 +7174,9 @@ const translator$1I = NodeTranslator.from({
|
|
|
7169
7174
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
7170
7175
|
}
|
|
7171
7176
|
});
|
|
7172
|
-
const translator$
|
|
7173
|
-
const translator$
|
|
7174
|
-
const translator$
|
|
7177
|
+
const translator$1I = NodeTranslator.from(createSingleBooleanPropertyHandler("w:contextualSpacing"));
|
|
7178
|
+
const translator$1H = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
7179
|
+
const translator$1G = NodeTranslator.from({
|
|
7175
7180
|
xmlName: "w:framePr",
|
|
7176
7181
|
sdNodeOrKeyName: "framePr",
|
|
7177
7182
|
attributes: [
|
|
@@ -7199,7 +7204,7 @@ const translator$1F = NodeTranslator.from({
|
|
|
7199
7204
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
7200
7205
|
}
|
|
7201
7206
|
});
|
|
7202
|
-
const translator$
|
|
7207
|
+
const translator$1F = NodeTranslator.from({
|
|
7203
7208
|
xmlName: "w:ind",
|
|
7204
7209
|
sdNodeOrKeyName: "indent",
|
|
7205
7210
|
attributes: [
|
|
@@ -7224,12 +7229,12 @@ const translator$1E = NodeTranslator.from({
|
|
|
7224
7229
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
7225
7230
|
}
|
|
7226
7231
|
});
|
|
7227
|
-
const translator$
|
|
7228
|
-
const translator$
|
|
7229
|
-
const translator$
|
|
7230
|
-
const translator$
|
|
7231
|
-
const translator$
|
|
7232
|
-
const translator$
|
|
7232
|
+
const translator$1E = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
7233
|
+
const translator$1D = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepLines"));
|
|
7234
|
+
const translator$1C = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepNext"));
|
|
7235
|
+
const translator$1B = NodeTranslator.from(createSingleBooleanPropertyHandler("w:kinsoku"));
|
|
7236
|
+
const translator$1A = NodeTranslator.from(createSingleBooleanPropertyHandler("w:mirrorIndents"));
|
|
7237
|
+
const translator$1z = NodeTranslator.from(createSingleIntegerPropertyHandler("w:ilvl"));
|
|
7233
7238
|
const createTrackStyleMark = (marks) => {
|
|
7234
7239
|
const trackStyleMark = marks.find((mark) => mark.type === "trackFormat");
|
|
7235
7240
|
if (trackStyleMark) {
|
|
@@ -7317,41 +7322,41 @@ const config$m = {
|
|
|
7317
7322
|
decode: decode$M,
|
|
7318
7323
|
attributes: validXmlAttributes$e
|
|
7319
7324
|
};
|
|
7320
|
-
const translator$
|
|
7321
|
-
const translator$
|
|
7322
|
-
const propertyTranslators$
|
|
7323
|
-
const translator$
|
|
7324
|
-
createNestedPropertiesTranslator("w:numPr", "numberingProperties", propertyTranslators$
|
|
7325
|
+
const translator$1y = NodeTranslator.from(config$m);
|
|
7326
|
+
const translator$1x = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numId"));
|
|
7327
|
+
const propertyTranslators$b = [translator$1O, translator$1z, translator$1y, translator$1x];
|
|
7328
|
+
const translator$1w = NodeTranslator.from(
|
|
7329
|
+
createNestedPropertiesTranslator("w:numPr", "numberingProperties", propertyTranslators$b)
|
|
7325
7330
|
);
|
|
7326
|
-
const translator$
|
|
7331
|
+
const translator$1v = NodeTranslator.from(
|
|
7327
7332
|
createSingleAttrPropertyHandler("w:outlineLvl", "outlineLvl", "w:val", parseInteger, integerToString)
|
|
7328
7333
|
);
|
|
7329
|
-
const translator$
|
|
7330
|
-
const translator$
|
|
7331
|
-
const translator$
|
|
7332
|
-
const translator$
|
|
7333
|
-
const translator$
|
|
7334
|
-
const translator$
|
|
7335
|
-
const translator$
|
|
7336
|
-
const translator$
|
|
7337
|
-
const translator$
|
|
7338
|
-
const translator$
|
|
7339
|
-
const translator$
|
|
7340
|
-
const propertyTranslators$
|
|
7341
|
-
translator$
|
|
7334
|
+
const translator$1u = NodeTranslator.from(createSingleBooleanPropertyHandler("w:overflowPunct"));
|
|
7335
|
+
const translator$1t = NodeTranslator.from(createBorderPropertyHandler("w:bar"));
|
|
7336
|
+
const translator$1s = NodeTranslator.from(createBorderPropertyHandler("w:between"));
|
|
7337
|
+
const translator$1r = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
7338
|
+
const translator$1q = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
7339
|
+
const translator$1p = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
7340
|
+
const translator$1o = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
7341
|
+
const translator$1n = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
7342
|
+
const translator$1m = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
7343
|
+
const translator$1l = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
7344
|
+
const translator$1k = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
7345
|
+
const propertyTranslators$a = [
|
|
7346
|
+
translator$1O,
|
|
7347
|
+
translator$1t,
|
|
7342
7348
|
translator$1s,
|
|
7343
7349
|
translator$1r,
|
|
7344
|
-
translator$
|
|
7345
|
-
translator$
|
|
7346
|
-
translator$
|
|
7347
|
-
translator$1k
|
|
7350
|
+
translator$1p,
|
|
7351
|
+
translator$1n,
|
|
7352
|
+
translator$1l
|
|
7348
7353
|
];
|
|
7349
|
-
const translator$
|
|
7350
|
-
createNestedPropertiesTranslator("w:pBdr", "borders", propertyTranslators$
|
|
7354
|
+
const translator$1j = NodeTranslator.from(
|
|
7355
|
+
createNestedPropertiesTranslator("w:pBdr", "borders", propertyTranslators$a)
|
|
7351
7356
|
);
|
|
7352
|
-
const translator$
|
|
7353
|
-
const translator$
|
|
7354
|
-
const translator$
|
|
7357
|
+
const translator$1i = NodeTranslator.from(createSingleAttrPropertyHandler("w:pStyle", "styleId"));
|
|
7358
|
+
const translator$1h = NodeTranslator.from(createSingleBooleanPropertyHandler("w:pageBreakBefore"));
|
|
7359
|
+
const translator$1g = NodeTranslator.from({
|
|
7355
7360
|
xmlName: "w:spacing",
|
|
7356
7361
|
sdNodeOrKeyName: "spacing",
|
|
7357
7362
|
attributes: [
|
|
@@ -7372,20 +7377,21 @@ const translator$1f = NodeTranslator.from({
|
|
|
7372
7377
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
7373
7378
|
}
|
|
7374
7379
|
});
|
|
7375
|
-
const translator$
|
|
7376
|
-
const translator$
|
|
7377
|
-
const translator$
|
|
7378
|
-
const propertyTranslators$
|
|
7379
|
-
const translator$
|
|
7380
|
-
createNestedArrayPropertyHandler("w:tabs", "tabStops", propertyTranslators$
|
|
7380
|
+
const translator$1f = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressAutoHyphens"));
|
|
7381
|
+
const translator$1e = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressLineNumbers"));
|
|
7382
|
+
const translator$1d = NodeTranslator.from(createSingleBooleanPropertyHandler("w:suppressOverlap"));
|
|
7383
|
+
const propertyTranslators$9 = [translator$1O, translator$2q];
|
|
7384
|
+
const translator$1c = NodeTranslator.from(
|
|
7385
|
+
createNestedArrayPropertyHandler("w:tabs", "tabStops", propertyTranslators$9, { skipRun: true })
|
|
7381
7386
|
);
|
|
7382
|
-
const translator$
|
|
7383
|
-
const translator$
|
|
7384
|
-
const translator$
|
|
7385
|
-
const translator$
|
|
7386
|
-
const translator$
|
|
7387
|
-
const translator$
|
|
7388
|
-
const propertyTranslators$
|
|
7387
|
+
const translator$1b = NodeTranslator.from(createSingleAttrPropertyHandler("w:textAlignment"));
|
|
7388
|
+
const translator$1a = NodeTranslator.from(createSingleAttrPropertyHandler("w:textDirection"));
|
|
7389
|
+
const translator$19 = NodeTranslator.from(createSingleAttrPropertyHandler("w:textboxTightWrap"));
|
|
7390
|
+
const translator$18 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:topLinePunct"));
|
|
7391
|
+
const translator$17 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:widowControl"));
|
|
7392
|
+
const translator$16 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:wordWrap"));
|
|
7393
|
+
const propertyTranslators$8 = [
|
|
7394
|
+
translator$1O,
|
|
7389
7395
|
translator$1N,
|
|
7390
7396
|
translator$1M,
|
|
7391
7397
|
translator$1L,
|
|
@@ -7400,15 +7406,15 @@ const propertyTranslators$7 = [
|
|
|
7400
7406
|
translator$1C,
|
|
7401
7407
|
translator$1B,
|
|
7402
7408
|
translator$1A,
|
|
7403
|
-
translator$
|
|
7409
|
+
translator$1w,
|
|
7404
7410
|
translator$1v,
|
|
7405
7411
|
translator$1u,
|
|
7406
|
-
translator$
|
|
7412
|
+
translator$1j,
|
|
7407
7413
|
translator$1i,
|
|
7408
7414
|
translator$1h,
|
|
7415
|
+
translator$2c,
|
|
7416
|
+
translator$27,
|
|
7409
7417
|
translator$1g,
|
|
7410
|
-
translator$2b,
|
|
7411
|
-
translator$26,
|
|
7412
7418
|
translator$1f,
|
|
7413
7419
|
translator$1e,
|
|
7414
7420
|
translator$1d,
|
|
@@ -7419,11 +7425,10 @@ const propertyTranslators$7 = [
|
|
|
7419
7425
|
translator$18,
|
|
7420
7426
|
translator$17,
|
|
7421
7427
|
translator$16,
|
|
7422
|
-
translator$
|
|
7423
|
-
translator$1O
|
|
7428
|
+
translator$1P
|
|
7424
7429
|
];
|
|
7425
|
-
const translator$
|
|
7426
|
-
createNestedPropertiesTranslator("w:pPr", "paragraphProperties", propertyTranslators$
|
|
7430
|
+
const translator$15 = NodeTranslator.from(
|
|
7431
|
+
createNestedPropertiesTranslator("w:pPr", "paragraphProperties", propertyTranslators$8)
|
|
7427
7432
|
);
|
|
7428
7433
|
function getUnderlineCssString({ type = "single", color = null, thickness = null, approximate = true } = {}) {
|
|
7429
7434
|
const parts = [];
|
|
@@ -7837,7 +7842,7 @@ function resolveDocxFontFamily(attributes, docx, toCssFontFamily) {
|
|
|
7837
7842
|
}
|
|
7838
7843
|
return resolved;
|
|
7839
7844
|
}
|
|
7840
|
-
const ooxmlResolver = createOoxmlResolver({ pPr: translator$
|
|
7845
|
+
const ooxmlResolver = createOoxmlResolver({ pPr: translator$15, rPr: translator$1P });
|
|
7841
7846
|
const getToCssFontFamily = () => {
|
|
7842
7847
|
return SuperConverter.toCssFontFamily;
|
|
7843
7848
|
};
|
|
@@ -8531,7 +8536,7 @@ function handleStyleChangeMarksV2(rPrChange, currentMarks, params) {
|
|
|
8531
8536
|
let submarks = [];
|
|
8532
8537
|
const rPr = rPrChange.elements?.find((el) => el.name === "w:rPr");
|
|
8533
8538
|
if (rPr) {
|
|
8534
|
-
const runProperties = translator$
|
|
8539
|
+
const runProperties = translator$1P.encode({ ...params, nodes: [rPr] });
|
|
8535
8540
|
submarks = encodeMarksFromRPr(runProperties, params?.docx);
|
|
8536
8541
|
}
|
|
8537
8542
|
return [{ type: TrackFormatMarkName, attrs: { ...mappedAttributes, before: submarks, after: [...currentMarks] } }];
|
|
@@ -8700,7 +8705,7 @@ const handleParagraphNode$1 = (params) => {
|
|
|
8700
8705
|
const pPr = node.elements?.find((el) => el.name === "w:pPr");
|
|
8701
8706
|
let inlineParagraphProperties = {};
|
|
8702
8707
|
if (pPr) {
|
|
8703
|
-
inlineParagraphProperties = translator$
|
|
8708
|
+
inlineParagraphProperties = translator$15.encode({ ...params, nodes: [pPr] }) || {};
|
|
8704
8709
|
}
|
|
8705
8710
|
const insideTable = (params.path || []).some((ancestor) => ancestor.name === "w:tc");
|
|
8706
8711
|
const tableStyleId = getTableStyleId(params.path || []);
|
|
@@ -8755,7 +8760,7 @@ function generateParagraphProperties(params) {
|
|
|
8755
8760
|
const { node } = params;
|
|
8756
8761
|
const { attrs = {} } = node;
|
|
8757
8762
|
const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
|
|
8758
|
-
let pPr = translator$
|
|
8763
|
+
let pPr = translator$15.decode({ node: { ...node, attrs: { paragraphProperties } } });
|
|
8759
8764
|
const sectPr = node.attrs?.paragraphProperties?.sectPr;
|
|
8760
8765
|
if (sectPr) {
|
|
8761
8766
|
if (!pPr) {
|
|
@@ -8907,7 +8912,7 @@ const config$l = {
|
|
|
8907
8912
|
decode: decode$E,
|
|
8908
8913
|
attributes: validXmlAttributes$d
|
|
8909
8914
|
};
|
|
8910
|
-
const translator$
|
|
8915
|
+
const translator$14 = NodeTranslator.from(config$l);
|
|
8911
8916
|
const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
|
|
8912
8917
|
const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
|
|
8913
8918
|
const resolveFontFamily = (textStyleAttrs, text) => {
|
|
@@ -9192,7 +9197,7 @@ const config$k = {
|
|
|
9192
9197
|
decode: decode$D,
|
|
9193
9198
|
attributes: validXmlAttributes$c
|
|
9194
9199
|
};
|
|
9195
|
-
const translator$
|
|
9200
|
+
const translator$13 = NodeTranslator.from(config$k);
|
|
9196
9201
|
const encode$A = (attributes) => {
|
|
9197
9202
|
return attributes["w:rsidR"];
|
|
9198
9203
|
};
|
|
@@ -9249,7 +9254,7 @@ const encode$x = (params, encodedAttrs = {}) => {
|
|
|
9249
9254
|
if (!runNode) return void 0;
|
|
9250
9255
|
const elements = Array.isArray(runNode.elements) ? runNode.elements : [];
|
|
9251
9256
|
const rPrNode = elements.find((child) => child?.name === "w:rPr");
|
|
9252
|
-
const runProperties = rPrNode ? translator$
|
|
9257
|
+
const runProperties = rPrNode ? translator$1P.encode({ ...params, nodes: [rPrNode] }) : {};
|
|
9253
9258
|
const paragraphProperties = params?.extraParams?.paragraphProperties || {};
|
|
9254
9259
|
const resolvedRunProperties = resolveRunProperties(params, runProperties ?? {}, paragraphProperties);
|
|
9255
9260
|
const marksResult = encodeMarksFromRPr(resolvedRunProperties, params?.docx);
|
|
@@ -9321,7 +9326,7 @@ const decode$z = (params, decodedAttrs = {}) => {
|
|
|
9321
9326
|
...params.extraParams,
|
|
9322
9327
|
linkProcessed: true
|
|
9323
9328
|
};
|
|
9324
|
-
return translator$
|
|
9329
|
+
return translator$13.decode({ ...params, extraParams });
|
|
9325
9330
|
}
|
|
9326
9331
|
const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
|
|
9327
9332
|
const runAttrs = runNodeForExport.attrs || {};
|
|
@@ -9335,7 +9340,7 @@ const decode$z = (params, decodedAttrs = {}) => {
|
|
|
9335
9340
|
exportParams.editor = { extensionService: { extensions: [] } };
|
|
9336
9341
|
}
|
|
9337
9342
|
const childElements = translateChildNodes(exportParams) || [];
|
|
9338
|
-
let runPropertiesElement = translator$
|
|
9343
|
+
let runPropertiesElement = translator$1P.decode({
|
|
9339
9344
|
...params,
|
|
9340
9345
|
node: { attrs: { runProperties } }
|
|
9341
9346
|
});
|
|
@@ -9413,9 +9418,9 @@ const config$j = {
|
|
|
9413
9418
|
decode: decode$z,
|
|
9414
9419
|
attributes: validXmlAttributes$b
|
|
9415
9420
|
};
|
|
9416
|
-
const translator$
|
|
9417
|
-
const translator$
|
|
9418
|
-
const translator
|
|
9421
|
+
const translator$12 = NodeTranslator.from(config$j);
|
|
9422
|
+
const translator$11 = NodeTranslator.from(createMeasurementPropertyHandler("w:tcW", "cellWidth"));
|
|
9423
|
+
const translator$10 = NodeTranslator.from(
|
|
9419
9424
|
createSingleAttrPropertyHandler(
|
|
9420
9425
|
"w:gridSpan",
|
|
9421
9426
|
null,
|
|
@@ -9424,33 +9429,33 @@ const translator$$ = NodeTranslator.from(
|
|
|
9424
9429
|
(v2) => integerToString(v2)
|
|
9425
9430
|
)
|
|
9426
9431
|
);
|
|
9427
|
-
const translator
|
|
9432
|
+
const translator$$ = NodeTranslator.from(
|
|
9428
9433
|
createSingleAttrPropertyHandler("w:vMerge", null, "w:val", (val) => !val ? "continue" : val)
|
|
9429
9434
|
);
|
|
9430
|
-
const translator$
|
|
9431
|
-
const translator$
|
|
9432
|
-
const translator$
|
|
9433
|
-
const translator$
|
|
9434
|
-
const translator$
|
|
9435
|
-
const translator$
|
|
9436
|
-
const translator$
|
|
9437
|
-
const translator$
|
|
9438
|
-
const propertyTranslators$
|
|
9439
|
-
translator$
|
|
9440
|
-
translator$V,
|
|
9441
|
-
translator$1o,
|
|
9442
|
-
translator$1q,
|
|
9443
|
-
translator$Z,
|
|
9444
|
-
translator$1m,
|
|
9445
|
-
translator$X,
|
|
9435
|
+
const translator$_ = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
9436
|
+
const translator$Z = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
9437
|
+
const translator$Y = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
9438
|
+
const translator$X = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
9439
|
+
const translator$W = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
9440
|
+
const translator$V = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
9441
|
+
const translator$U = NodeTranslator.from(createBorderPropertyHandler("w:tl2br"));
|
|
9442
|
+
const translator$T = NodeTranslator.from(createBorderPropertyHandler("w:tr2bl"));
|
|
9443
|
+
const propertyTranslators$7 = [
|
|
9444
|
+
translator$1l,
|
|
9446
9445
|
translator$W,
|
|
9447
|
-
translator$
|
|
9448
|
-
translator$
|
|
9446
|
+
translator$1p,
|
|
9447
|
+
translator$1r,
|
|
9448
|
+
translator$_,
|
|
9449
|
+
translator$1n,
|
|
9450
|
+
translator$Y,
|
|
9451
|
+
translator$X,
|
|
9452
|
+
translator$U,
|
|
9453
|
+
translator$T
|
|
9449
9454
|
];
|
|
9450
|
-
const translator$
|
|
9451
|
-
createNestedPropertiesTranslator("w:tcBorders", "borders", propertyTranslators$
|
|
9455
|
+
const translator$S = NodeTranslator.from(
|
|
9456
|
+
createNestedPropertiesTranslator("w:tcBorders", "borders", propertyTranslators$7)
|
|
9452
9457
|
);
|
|
9453
|
-
const translator$
|
|
9458
|
+
const translator$R = NodeTranslator.from(
|
|
9454
9459
|
createSingleAttrPropertyHandler(
|
|
9455
9460
|
"w:noWrap",
|
|
9456
9461
|
null,
|
|
@@ -9459,18 +9464,18 @@ const translator$Q = NodeTranslator.from(
|
|
|
9459
9464
|
(v2) => booleanToString(v2)
|
|
9460
9465
|
)
|
|
9461
9466
|
);
|
|
9462
|
-
const propertyTranslators$
|
|
9463
|
-
translator$
|
|
9464
|
-
translator$
|
|
9465
|
-
translator$
|
|
9466
|
-
translator$
|
|
9467
|
-
translator$
|
|
9468
|
-
translator$
|
|
9467
|
+
const propertyTranslators$6 = [
|
|
9468
|
+
translator$1q,
|
|
9469
|
+
translator$Z,
|
|
9470
|
+
translator$1o,
|
|
9471
|
+
translator$1m,
|
|
9472
|
+
translator$V,
|
|
9473
|
+
translator$1k
|
|
9469
9474
|
];
|
|
9470
|
-
const translator$
|
|
9471
|
-
createNestedPropertiesTranslator("w:tcMar", "cellMargins", propertyTranslators$
|
|
9475
|
+
const translator$Q = NodeTranslator.from(
|
|
9476
|
+
createNestedPropertiesTranslator("w:tcMar", "cellMargins", propertyTranslators$6)
|
|
9472
9477
|
);
|
|
9473
|
-
const translator$
|
|
9478
|
+
const translator$P = NodeTranslator.from(
|
|
9474
9479
|
createSingleAttrPropertyHandler(
|
|
9475
9480
|
"w:tcFitText",
|
|
9476
9481
|
null,
|
|
@@ -9479,8 +9484,8 @@ const translator$O = NodeTranslator.from(
|
|
|
9479
9484
|
(v2) => booleanToString(v2)
|
|
9480
9485
|
)
|
|
9481
9486
|
);
|
|
9482
|
-
const translator$
|
|
9483
|
-
const translator$
|
|
9487
|
+
const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:vAlign"));
|
|
9488
|
+
const translator$N = NodeTranslator.from(
|
|
9484
9489
|
createSingleAttrPropertyHandler(
|
|
9485
9490
|
"w:hideMark",
|
|
9486
9491
|
null,
|
|
@@ -9489,27 +9494,27 @@ const translator$M = NodeTranslator.from(
|
|
|
9489
9494
|
(v2) => booleanToString(v2)
|
|
9490
9495
|
)
|
|
9491
9496
|
);
|
|
9492
|
-
const translator$
|
|
9493
|
-
const translator$
|
|
9494
|
-
createNestedArrayPropertyHandler("w:headers", "headers", [translator$
|
|
9497
|
+
const translator$M = NodeTranslator.from(createSingleAttrPropertyHandler("w:header"));
|
|
9498
|
+
const translator$L = NodeTranslator.from(
|
|
9499
|
+
createNestedArrayPropertyHandler("w:headers", "headers", [translator$M])
|
|
9495
9500
|
);
|
|
9496
|
-
const propertyTranslators$
|
|
9497
|
-
translator$
|
|
9501
|
+
const propertyTranslators$5 = [
|
|
9502
|
+
translator$1J,
|
|
9503
|
+
translator$11,
|
|
9498
9504
|
translator$10,
|
|
9499
9505
|
translator$$,
|
|
9500
|
-
translator$
|
|
9506
|
+
translator$S,
|
|
9507
|
+
translator$2c,
|
|
9501
9508
|
translator$R,
|
|
9502
|
-
translator$2b,
|
|
9503
9509
|
translator$Q,
|
|
9510
|
+
translator$1a,
|
|
9504
9511
|
translator$P,
|
|
9505
|
-
translator$19,
|
|
9506
9512
|
translator$O,
|
|
9507
9513
|
translator$N,
|
|
9508
|
-
translator$
|
|
9509
|
-
translator$K
|
|
9514
|
+
translator$L
|
|
9510
9515
|
];
|
|
9511
|
-
const translator$
|
|
9512
|
-
createNestedPropertiesTranslator("w:tcPr", "tableCellProperties", propertyTranslators$
|
|
9516
|
+
const translator$K = NodeTranslator.from(
|
|
9517
|
+
createNestedPropertiesTranslator("w:tcPr", "tableCellProperties", propertyTranslators$5)
|
|
9513
9518
|
);
|
|
9514
9519
|
function handleTableCellNode({
|
|
9515
9520
|
params,
|
|
@@ -9517,6 +9522,9 @@ function handleTableCellNode({
|
|
|
9517
9522
|
table,
|
|
9518
9523
|
row,
|
|
9519
9524
|
rowBorders,
|
|
9525
|
+
baseTableBorders,
|
|
9526
|
+
tableLook,
|
|
9527
|
+
rowCnfStyle,
|
|
9520
9528
|
columnIndex,
|
|
9521
9529
|
columnWidth = null,
|
|
9522
9530
|
allColumnWidths = [],
|
|
@@ -9529,7 +9537,7 @@ function handleTableCellNode({
|
|
|
9529
9537
|
const attributes = {};
|
|
9530
9538
|
const referencedStyles = _referencedStyles ?? { fontSize: null, fonts: {}, cellMargins: {} };
|
|
9531
9539
|
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
9532
|
-
const tableCellProperties = tcPr ? translator$
|
|
9540
|
+
const tableCellProperties = tcPr ? translator$K.encode({ ...params, nodes: [tcPr] }) ?? {} : {};
|
|
9533
9541
|
attributes["tableCellProperties"] = tableCellProperties;
|
|
9534
9542
|
const effectiveTotalColumns = totalColumns ?? (allColumnWidths.length || 1);
|
|
9535
9543
|
const effectiveTotalRows = totalRows ?? (table?.elements?.filter((el) => el.name === "w:tr").length || 1);
|
|
@@ -9538,38 +9546,32 @@ function handleTableCellNode({
|
|
|
9538
9546
|
const isLastRow = rowIndex === effectiveTotalRows - 1;
|
|
9539
9547
|
const isFirstColumn = columnIndex === 0;
|
|
9540
9548
|
const isLastColumn = columnIndex + colspan >= effectiveTotalColumns;
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
if (!isLastColumn && rowBorders.insideV) {
|
|
9567
|
-
cellBorders.right = rowBorders.insideV;
|
|
9568
|
-
}
|
|
9549
|
+
attributes["borders"] = processCellBorders({
|
|
9550
|
+
baseTableBorders,
|
|
9551
|
+
rowBorders,
|
|
9552
|
+
tableLook,
|
|
9553
|
+
rowCnfStyle,
|
|
9554
|
+
isFirstRow,
|
|
9555
|
+
isLastRow,
|
|
9556
|
+
isFirstColumn,
|
|
9557
|
+
isLastColumn,
|
|
9558
|
+
tableCellProperties,
|
|
9559
|
+
referencedStyles
|
|
9560
|
+
});
|
|
9561
|
+
const hasRowOverrideNone = rowBorders && ["top", "left", "bottom", "right", "insideH", "insideV"].some((side) => rowBorders?.[side]?.val === "none");
|
|
9562
|
+
if (hasRowOverrideNone && isFirstColumn) {
|
|
9563
|
+
console.info(
|
|
9564
|
+
"[sd-table-borders] cell borders",
|
|
9565
|
+
JSON.stringify({
|
|
9566
|
+
rowIndex,
|
|
9567
|
+
columnIndex,
|
|
9568
|
+
totalColumns: effectiveTotalColumns,
|
|
9569
|
+
baseTableBorders,
|
|
9570
|
+
rowBorders,
|
|
9571
|
+
cellBorders: attributes["borders"]
|
|
9572
|
+
})
|
|
9573
|
+
);
|
|
9569
9574
|
}
|
|
9570
|
-
attributes["borders"] = cellBorders;
|
|
9571
|
-
const inlineBorders = processInlineCellBorders(tableCellProperties.borders, cellBorders);
|
|
9572
|
-
if (inlineBorders) attributes["borders"] = Object.assign(attributes["borders"], inlineBorders);
|
|
9573
9575
|
if (colspan > 1) attributes["colspan"] = colspan;
|
|
9574
9576
|
let width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
|
|
9575
9577
|
const widthType = tableCellProperties.cellWidth?.type;
|
|
@@ -9748,6 +9750,81 @@ const processInlineCellBorders = (borders, rowBorders) => {
|
|
|
9748
9750
|
return acc;
|
|
9749
9751
|
}, {});
|
|
9750
9752
|
};
|
|
9753
|
+
const processCellBorders = ({
|
|
9754
|
+
baseTableBorders,
|
|
9755
|
+
rowBorders,
|
|
9756
|
+
tableLook,
|
|
9757
|
+
rowCnfStyle,
|
|
9758
|
+
isFirstRow,
|
|
9759
|
+
isLastRow,
|
|
9760
|
+
isFirstColumn,
|
|
9761
|
+
isLastColumn,
|
|
9762
|
+
tableCellProperties,
|
|
9763
|
+
referencedStyles
|
|
9764
|
+
}) => {
|
|
9765
|
+
let cellBorders = {};
|
|
9766
|
+
if (baseTableBorders) {
|
|
9767
|
+
if (isFirstRow && baseTableBorders.top) {
|
|
9768
|
+
cellBorders.top = baseTableBorders.top;
|
|
9769
|
+
}
|
|
9770
|
+
if (isLastRow && baseTableBorders.bottom) {
|
|
9771
|
+
cellBorders.bottom = baseTableBorders.bottom;
|
|
9772
|
+
}
|
|
9773
|
+
if (isFirstColumn && baseTableBorders.left) {
|
|
9774
|
+
cellBorders.left = baseTableBorders.left;
|
|
9775
|
+
}
|
|
9776
|
+
if (isLastColumn && baseTableBorders.right) {
|
|
9777
|
+
cellBorders.right = baseTableBorders.right;
|
|
9778
|
+
}
|
|
9779
|
+
}
|
|
9780
|
+
if (rowBorders) {
|
|
9781
|
+
if (rowBorders.top?.val) {
|
|
9782
|
+
cellBorders.top = rowBorders.top;
|
|
9783
|
+
}
|
|
9784
|
+
if (rowBorders.bottom?.val) {
|
|
9785
|
+
cellBorders.bottom = rowBorders.bottom;
|
|
9786
|
+
}
|
|
9787
|
+
if (rowBorders.left?.val) {
|
|
9788
|
+
const applyLeftToAll = rowBorders.left.val === "none";
|
|
9789
|
+
if (applyLeftToAll || isFirstColumn) {
|
|
9790
|
+
cellBorders.left = rowBorders.left;
|
|
9791
|
+
}
|
|
9792
|
+
}
|
|
9793
|
+
if (rowBorders.right?.val) {
|
|
9794
|
+
const applyRightToAll = rowBorders.right.val === "none";
|
|
9795
|
+
if (applyRightToAll || isLastColumn) {
|
|
9796
|
+
cellBorders.right = rowBorders.right;
|
|
9797
|
+
}
|
|
9798
|
+
}
|
|
9799
|
+
if (!isLastRow && rowBorders.insideH) {
|
|
9800
|
+
cellBorders.bottom = rowBorders.insideH;
|
|
9801
|
+
}
|
|
9802
|
+
if (!isLastColumn && rowBorders.insideV) {
|
|
9803
|
+
cellBorders.right = rowBorders.insideV;
|
|
9804
|
+
}
|
|
9805
|
+
}
|
|
9806
|
+
const getStyleTableCellBorders = (styleVariant) => styleVariant?.tableCellProperties?.borders ?? null;
|
|
9807
|
+
const cellCnfStyle = tableCellProperties?.cnfStyle;
|
|
9808
|
+
const getFlag = (source, flag) => source && Object.prototype.hasOwnProperty.call(source, flag) ? source[flag] : void 0;
|
|
9809
|
+
const isStyleEnabled = (flag) => getFlag(cellCnfStyle, flag) ?? getFlag(rowCnfStyle, flag) ?? getFlag(tableLook, flag) ?? true;
|
|
9810
|
+
const applyStyleBorders = (styleVariant, allowedDirections) => {
|
|
9811
|
+
const styleBorders = getStyleTableCellBorders(styleVariant);
|
|
9812
|
+
if (!styleBorders) return;
|
|
9813
|
+
const filteredBorders = allowedDirections.reduce((acc, direction) => {
|
|
9814
|
+
if (styleBorders[direction]) acc[direction] = styleBorders[direction];
|
|
9815
|
+
return acc;
|
|
9816
|
+
}, {});
|
|
9817
|
+
const styleOverrides = processInlineCellBorders(filteredBorders, cellBorders);
|
|
9818
|
+
if (styleOverrides) cellBorders = Object.assign(cellBorders, styleOverrides);
|
|
9819
|
+
};
|
|
9820
|
+
if (isFirstRow && isStyleEnabled("firstRow")) applyStyleBorders(referencedStyles?.firstRow, ["top", "bottom"]);
|
|
9821
|
+
if (isLastRow && isStyleEnabled("lastRow")) applyStyleBorders(referencedStyles?.lastRow, ["top", "bottom"]);
|
|
9822
|
+
if (isFirstColumn && isStyleEnabled("firstColumn")) applyStyleBorders(referencedStyles?.firstCol, ["left", "right"]);
|
|
9823
|
+
if (isLastColumn && isStyleEnabled("lastColumn")) applyStyleBorders(referencedStyles?.lastCol, ["left", "right"]);
|
|
9824
|
+
const inlineBorders = processInlineCellBorders(tableCellProperties.borders, cellBorders);
|
|
9825
|
+
if (inlineBorders) cellBorders = Object.assign(cellBorders, inlineBorders);
|
|
9826
|
+
return cellBorders;
|
|
9827
|
+
};
|
|
9751
9828
|
const getTableCellVMerge = (node) => {
|
|
9752
9829
|
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
9753
9830
|
const vMerge = tcPr?.elements?.find((el) => el.name === "w:vMerge");
|
|
@@ -9864,7 +9941,7 @@ function generateTableCellProperties(node) {
|
|
|
9864
9941
|
} else if (tableCellProperties?.borders) {
|
|
9865
9942
|
delete tableCellProperties.borders;
|
|
9866
9943
|
}
|
|
9867
|
-
const result = translator$
|
|
9944
|
+
const result = translator$K.decode({ node: { ...node, attrs: { ...node.attrs, tableCellProperties } } });
|
|
9868
9945
|
return result;
|
|
9869
9946
|
}
|
|
9870
9947
|
const XML_NODE_NAME$j = "w:tc";
|
|
@@ -9876,6 +9953,9 @@ function encode$w(params, encodedAttrs) {
|
|
|
9876
9953
|
table,
|
|
9877
9954
|
row,
|
|
9878
9955
|
rowBorders,
|
|
9956
|
+
baseTableBorders,
|
|
9957
|
+
tableLook,
|
|
9958
|
+
rowCnfStyle,
|
|
9879
9959
|
columnIndex,
|
|
9880
9960
|
columnWidth,
|
|
9881
9961
|
columnWidths: allColumnWidths,
|
|
@@ -9890,6 +9970,9 @@ function encode$w(params, encodedAttrs) {
|
|
|
9890
9970
|
table,
|
|
9891
9971
|
row,
|
|
9892
9972
|
rowBorders,
|
|
9973
|
+
baseTableBorders,
|
|
9974
|
+
tableLook,
|
|
9975
|
+
rowCnfStyle,
|
|
9893
9976
|
columnIndex,
|
|
9894
9977
|
columnWidth,
|
|
9895
9978
|
allColumnWidths,
|
|
@@ -9918,27 +10001,27 @@ const config$i = {
|
|
|
9918
10001
|
decode: decode$y,
|
|
9919
10002
|
attributes: validXmlAttributes$a
|
|
9920
10003
|
};
|
|
9921
|
-
const translator$
|
|
9922
|
-
const propertyTranslators$
|
|
9923
|
-
translator$
|
|
9924
|
-
translator$
|
|
10004
|
+
const translator$J = NodeTranslator.from(config$i);
|
|
10005
|
+
const propertyTranslators$4 = [
|
|
10006
|
+
translator$1r,
|
|
10007
|
+
translator$_,
|
|
10008
|
+
translator$Y,
|
|
9925
10009
|
translator$X,
|
|
10010
|
+
translator$1p,
|
|
10011
|
+
translator$1n,
|
|
9926
10012
|
translator$W,
|
|
9927
|
-
translator$
|
|
9928
|
-
translator$1m,
|
|
9929
|
-
translator$V,
|
|
9930
|
-
translator$1k
|
|
10013
|
+
translator$1l
|
|
9931
10014
|
];
|
|
9932
|
-
const translator$
|
|
9933
|
-
createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$
|
|
10015
|
+
const translator$I = NodeTranslator.from(
|
|
10016
|
+
createNestedPropertiesTranslator("w:tblBorders", "borders", propertyTranslators$4)
|
|
9934
10017
|
);
|
|
9935
|
-
const translator$
|
|
10018
|
+
const translator$H = NodeTranslator.from({
|
|
9936
10019
|
xmlName: "w:cantSplit",
|
|
9937
10020
|
sdNodeOrKeyName: "cantSplit",
|
|
9938
10021
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
9939
10022
|
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
9940
10023
|
});
|
|
9941
|
-
const translator$
|
|
10024
|
+
const translator$G = NodeTranslator.from(
|
|
9942
10025
|
createSingleAttrPropertyHandler(
|
|
9943
10026
|
"w:gridAfter",
|
|
9944
10027
|
null,
|
|
@@ -9947,7 +10030,7 @@ const translator$F = NodeTranslator.from(
|
|
|
9947
10030
|
(v2) => integerToString(v2)
|
|
9948
10031
|
)
|
|
9949
10032
|
);
|
|
9950
|
-
const translator$
|
|
10033
|
+
const translator$F = NodeTranslator.from(
|
|
9951
10034
|
createSingleAttrPropertyHandler(
|
|
9952
10035
|
"w:gridBefore",
|
|
9953
10036
|
null,
|
|
@@ -9956,20 +10039,20 @@ const translator$E = NodeTranslator.from(
|
|
|
9956
10039
|
(v2) => integerToString(v2)
|
|
9957
10040
|
)
|
|
9958
10041
|
);
|
|
9959
|
-
const translator$
|
|
10042
|
+
const translator$E = NodeTranslator.from({
|
|
9960
10043
|
xmlName: "w:hidden",
|
|
9961
10044
|
sdNodeOrKeyName: "hidden",
|
|
9962
10045
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
9963
10046
|
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
9964
10047
|
});
|
|
9965
|
-
const translator$
|
|
9966
|
-
const translator$
|
|
10048
|
+
const translator$D = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
10049
|
+
const translator$C = NodeTranslator.from({
|
|
9967
10050
|
xmlName: "w:tblHeader",
|
|
9968
10051
|
sdNodeOrKeyName: "repeatHeader",
|
|
9969
10052
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
9970
10053
|
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
9971
10054
|
});
|
|
9972
|
-
const translator$
|
|
10055
|
+
const translator$B = NodeTranslator.from({
|
|
9973
10056
|
xmlName: "w:trHeight",
|
|
9974
10057
|
sdNodeOrKeyName: "rowHeight",
|
|
9975
10058
|
encode: ({ nodes }) => {
|
|
@@ -9996,24 +10079,24 @@ const translator$A = NodeTranslator.from({
|
|
|
9996
10079
|
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
9997
10080
|
}
|
|
9998
10081
|
});
|
|
9999
|
-
const translator$
|
|
10000
|
-
const translator$
|
|
10001
|
-
const propertyTranslators$
|
|
10082
|
+
const translator$A = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
10083
|
+
const translator$z = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
10084
|
+
const propertyTranslators$3 = [
|
|
10085
|
+
translator$H,
|
|
10086
|
+
translator$1J,
|
|
10087
|
+
translator$1H,
|
|
10002
10088
|
translator$G,
|
|
10003
|
-
translator$1I,
|
|
10004
|
-
translator$1G,
|
|
10005
10089
|
translator$F,
|
|
10006
10090
|
translator$E,
|
|
10091
|
+
translator$1E,
|
|
10007
10092
|
translator$D,
|
|
10008
|
-
translator$1D,
|
|
10009
10093
|
translator$C,
|
|
10010
10094
|
translator$B,
|
|
10011
10095
|
translator$A,
|
|
10012
|
-
translator$z
|
|
10013
|
-
translator$y
|
|
10096
|
+
translator$z
|
|
10014
10097
|
];
|
|
10015
|
-
const translator$
|
|
10016
|
-
createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$
|
|
10098
|
+
const translator$y = NodeTranslator.from(
|
|
10099
|
+
createNestedPropertiesTranslator("w:trPr", "tableRowProperties", propertyTranslators$3, {
|
|
10017
10100
|
cantSplit: false,
|
|
10018
10101
|
hidden: false,
|
|
10019
10102
|
repeatHeader: false
|
|
@@ -10092,11 +10175,11 @@ const getColspan$1 = (cell) => {
|
|
|
10092
10175
|
return Number.isFinite(numericColspan) && numericColspan > 0 ? numericColspan : 1;
|
|
10093
10176
|
};
|
|
10094
10177
|
const encode$v = (params, encodedAttrs) => {
|
|
10095
|
-
const { row } = params.extraParams;
|
|
10178
|
+
const { row, tableLook } = params.extraParams;
|
|
10096
10179
|
let tableRowProperties = {};
|
|
10097
10180
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
10098
10181
|
if (tPr) {
|
|
10099
|
-
tableRowProperties = translator$
|
|
10182
|
+
tableRowProperties = translator$y.encode({
|
|
10100
10183
|
...params,
|
|
10101
10184
|
nodes: [tPr]
|
|
10102
10185
|
});
|
|
@@ -10106,8 +10189,9 @@ const encode$v = (params, encodedAttrs) => {
|
|
|
10106
10189
|
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
10107
10190
|
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
10108
10191
|
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
10109
|
-
const
|
|
10110
|
-
const
|
|
10192
|
+
const rowCnfStyle = tableRowProperties?.cnfStyle;
|
|
10193
|
+
const baseBorders = params.extraParams?.tableBorders;
|
|
10194
|
+
const rowBorders = getRowBorders({
|
|
10111
10195
|
params,
|
|
10112
10196
|
row,
|
|
10113
10197
|
baseBorders
|
|
@@ -10139,15 +10223,15 @@ const encode$v = (params, encodedAttrs) => {
|
|
|
10139
10223
|
skipOccupiedColumns();
|
|
10140
10224
|
const startColumn = currentColumnIndex;
|
|
10141
10225
|
const columnWidth = gridColumnWidths?.[startColumn] || null;
|
|
10142
|
-
const result = translator$
|
|
10226
|
+
const result = translator$J.encode({
|
|
10143
10227
|
...params,
|
|
10144
10228
|
path: [...params.path || [], node],
|
|
10145
10229
|
extraParams: {
|
|
10146
10230
|
...params.extraParams,
|
|
10147
|
-
rowBorders
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10231
|
+
rowBorders,
|
|
10232
|
+
baseTableBorders: baseBorders,
|
|
10233
|
+
tableLook,
|
|
10234
|
+
rowCnfStyle,
|
|
10151
10235
|
node,
|
|
10152
10236
|
columnIndex: startColumn,
|
|
10153
10237
|
columnWidth
|
|
@@ -10177,18 +10261,35 @@ const encode$v = (params, encodedAttrs) => {
|
|
|
10177
10261
|
};
|
|
10178
10262
|
return newNode;
|
|
10179
10263
|
};
|
|
10180
|
-
function
|
|
10264
|
+
function getRowBorders({ params, row, baseBorders }) {
|
|
10265
|
+
const rowIndex = params?.extraParams?.rowIndex;
|
|
10181
10266
|
const tblPrEx = row?.elements?.find?.((el) => el.name === "w:tblPrEx");
|
|
10182
10267
|
const tblBorders = tblPrEx?.elements?.find?.((el) => el.name === "w:tblBorders");
|
|
10268
|
+
const rowBaseBorders = {};
|
|
10269
|
+
if (baseBorders?.insideV) {
|
|
10270
|
+
rowBaseBorders.insideV = baseBorders?.insideV;
|
|
10271
|
+
}
|
|
10272
|
+
if (baseBorders?.insideH) {
|
|
10273
|
+
rowBaseBorders.insideH = baseBorders?.insideH;
|
|
10274
|
+
}
|
|
10183
10275
|
if (!tblBorders) {
|
|
10184
|
-
return
|
|
10276
|
+
return rowBaseBorders;
|
|
10185
10277
|
}
|
|
10186
|
-
const rawOverrides = translator$
|
|
10278
|
+
const rawOverrides = translator$I.encode({ ...params, nodes: [tblBorders] }) || {};
|
|
10187
10279
|
const overrides = processRawTableBorders(rawOverrides);
|
|
10188
10280
|
if (!Object.keys(overrides).length) {
|
|
10189
|
-
|
|
10281
|
+
console.info(
|
|
10282
|
+
"[sd-table-borders] row tblPrEx overrides empty",
|
|
10283
|
+
JSON.stringify({ rowIndex, baseBorders: rowBaseBorders, rawOverrides })
|
|
10284
|
+
);
|
|
10285
|
+
return rowBaseBorders;
|
|
10190
10286
|
}
|
|
10191
|
-
|
|
10287
|
+
const rowBorders = { ...rowBaseBorders, ...overrides };
|
|
10288
|
+
console.info(
|
|
10289
|
+
"[sd-table-borders] row tblPrEx overrides",
|
|
10290
|
+
JSON.stringify({ rowIndex, baseBorders: rowBaseBorders, rawOverrides, overrides, rowBorders })
|
|
10291
|
+
);
|
|
10292
|
+
return rowBorders;
|
|
10192
10293
|
}
|
|
10193
10294
|
function processRawTableBorders(rawBorders) {
|
|
10194
10295
|
const borders = {};
|
|
@@ -10264,7 +10365,7 @@ const decode$x = (params, decodedAttrs) => {
|
|
|
10264
10365
|
}
|
|
10265
10366
|
}
|
|
10266
10367
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
10267
|
-
const trPr = translator$
|
|
10368
|
+
const trPr = translator$y.decode({
|
|
10268
10369
|
...params,
|
|
10269
10370
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
10270
10371
|
});
|
|
@@ -10284,7 +10385,7 @@ const config$h = {
|
|
|
10284
10385
|
decode: decode$x,
|
|
10285
10386
|
attributes: validXmlAttributes$9
|
|
10286
10387
|
};
|
|
10287
|
-
const translator$
|
|
10388
|
+
const translator$x = NodeTranslator.from(config$h);
|
|
10288
10389
|
function parseTagValueJSON(json) {
|
|
10289
10390
|
if (typeof json !== "string") {
|
|
10290
10391
|
return {};
|
|
@@ -19265,9 +19366,9 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
19265
19366
|
if (!blip) {
|
|
19266
19367
|
return null;
|
|
19267
19368
|
}
|
|
19268
|
-
const stretch = blipFill?.elements
|
|
19269
|
-
const fillRect = stretch?.elements
|
|
19270
|
-
const srcRect = blipFill?.elements
|
|
19369
|
+
const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
|
|
19370
|
+
const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
|
|
19371
|
+
const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
|
|
19271
19372
|
const srcRectAttrs = srcRect?.attributes || {};
|
|
19272
19373
|
const srcRectHasNegativeValues = ["l", "t", "r", "b"].some((attr) => {
|
|
19273
19374
|
const val = srcRectAttrs[attr];
|
|
@@ -25013,7 +25114,7 @@ const config$g = {
|
|
|
25013
25114
|
decode: decode$w,
|
|
25014
25115
|
attributes: validXmlAttributes$8
|
|
25015
25116
|
};
|
|
25016
|
-
const translator$
|
|
25117
|
+
const translator$w = NodeTranslator.from(config$g);
|
|
25017
25118
|
function handleInlineNode(params) {
|
|
25018
25119
|
const { node } = params.extraParams;
|
|
25019
25120
|
if (node.name !== "wp:inline") {
|
|
@@ -25067,7 +25168,7 @@ const config$f = {
|
|
|
25067
25168
|
decode: decode$v,
|
|
25068
25169
|
attributes: validXmlAttributes$7
|
|
25069
25170
|
};
|
|
25070
|
-
const translator$
|
|
25171
|
+
const translator$v = NodeTranslator.from(config$f);
|
|
25071
25172
|
const XML_NODE_NAME$f = "w:drawing";
|
|
25072
25173
|
const SD_NODE_NAME$d = [];
|
|
25073
25174
|
const validXmlAttributes$6 = [];
|
|
@@ -25075,8 +25176,8 @@ function encode$s(params) {
|
|
|
25075
25176
|
const nodes = params.nodes;
|
|
25076
25177
|
const node = nodes[0];
|
|
25077
25178
|
const translatorByChildName = {
|
|
25078
|
-
"wp:anchor": translator$
|
|
25079
|
-
"wp:inline": translator$
|
|
25179
|
+
"wp:anchor": translator$w,
|
|
25180
|
+
"wp:inline": translator$v
|
|
25080
25181
|
};
|
|
25081
25182
|
const result = (node.elements || []).reduce((acc, child) => {
|
|
25082
25183
|
if (acc) return acc;
|
|
@@ -25099,7 +25200,7 @@ function decode$u(params) {
|
|
|
25099
25200
|
if (!node || !node.type) {
|
|
25100
25201
|
return null;
|
|
25101
25202
|
}
|
|
25102
|
-
const childTranslator = node.attrs.isAnchor ? translator$
|
|
25203
|
+
const childTranslator = node.attrs.isAnchor ? translator$w : translator$v;
|
|
25103
25204
|
const resultNode = childTranslator.decode(params);
|
|
25104
25205
|
return wrapTextInRun(
|
|
25105
25206
|
{
|
|
@@ -25117,7 +25218,7 @@ const config$e = {
|
|
|
25117
25218
|
decode: decode$u,
|
|
25118
25219
|
attributes: validXmlAttributes$6
|
|
25119
25220
|
};
|
|
25120
|
-
const translator$
|
|
25221
|
+
const translator$u = NodeTranslator.from(config$e);
|
|
25121
25222
|
function getTextNodeForExport(text, marks, params) {
|
|
25122
25223
|
const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
|
|
25123
25224
|
const space = hasLeadingOrTrailingSpace ? "preserve" : null;
|
|
@@ -25126,7 +25227,7 @@ function getTextNodeForExport(text, marks, params) {
|
|
|
25126
25227
|
const textRunProperties = decodeRPrFromMarks(marks || []);
|
|
25127
25228
|
const parentRunProperties = params.extraParams?.runProperties || {};
|
|
25128
25229
|
const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
|
|
25129
|
-
const rPrNode = translator$
|
|
25230
|
+
const rPrNode = translator$1P.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
|
|
25130
25231
|
textNodes.push({
|
|
25131
25232
|
name: "w:t",
|
|
25132
25233
|
elements: [{ text, type: "text" }],
|
|
@@ -25525,7 +25626,7 @@ function prepareTextAnnotation(params) {
|
|
|
25525
25626
|
return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params);
|
|
25526
25627
|
}
|
|
25527
25628
|
function prepareImageAnnotation(params, imageSize) {
|
|
25528
|
-
return translator$
|
|
25629
|
+
return translator$u.decode({
|
|
25529
25630
|
...params,
|
|
25530
25631
|
imageSize
|
|
25531
25632
|
});
|
|
@@ -25610,7 +25711,7 @@ function prepareUrlAnnotation(params) {
|
|
|
25610
25711
|
}
|
|
25611
25712
|
]
|
|
25612
25713
|
};
|
|
25613
|
-
return translator$
|
|
25714
|
+
return translator$13.decode({
|
|
25614
25715
|
...params,
|
|
25615
25716
|
node: linkTextNode
|
|
25616
25717
|
});
|
|
@@ -25987,7 +26088,7 @@ const config$d = {
|
|
|
25987
26088
|
decode: decode$t,
|
|
25988
26089
|
attributes: validXmlAttributes$5
|
|
25989
26090
|
};
|
|
25990
|
-
const translator$
|
|
26091
|
+
const translator$t = NodeTranslator.from(config$d);
|
|
25991
26092
|
const getColspan = (cell) => {
|
|
25992
26093
|
const rawColspan = cell?.attrs?.colspan;
|
|
25993
26094
|
const numericColspan = typeof rawColspan === "string" ? parseInt(rawColspan, 10) : rawColspan;
|
|
@@ -26078,21 +26179,47 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
|
26078
26179
|
}
|
|
26079
26180
|
return table;
|
|
26080
26181
|
}
|
|
26081
|
-
const translator$
|
|
26182
|
+
const translator$s = NodeTranslator.from({
|
|
26082
26183
|
xmlName: "w:bidiVisual",
|
|
26083
26184
|
sdNodeOrKeyName: "rightToLeft",
|
|
26084
26185
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
26085
26186
|
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
26086
26187
|
});
|
|
26087
|
-
const translator$
|
|
26088
|
-
const translator$
|
|
26089
|
-
const translator$
|
|
26090
|
-
const translator$
|
|
26091
|
-
const
|
|
26188
|
+
const translator$r = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
26189
|
+
const translator$q = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
26190
|
+
const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
26191
|
+
const translator$o = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
26192
|
+
const tblLookBitmask = Object.freeze({
|
|
26193
|
+
firstRow: 32,
|
|
26194
|
+
lastRow: 64,
|
|
26195
|
+
firstColumn: 128,
|
|
26196
|
+
lastColumn: 256,
|
|
26197
|
+
noHBand: 512,
|
|
26198
|
+
noVBand: 1024
|
|
26199
|
+
});
|
|
26200
|
+
const decodeTblLookVal = (val) => {
|
|
26201
|
+
if (!val) return null;
|
|
26202
|
+
const raw = typeof val === "string" ? val.trim() : String(val);
|
|
26203
|
+
let numeric = Number.parseInt(raw, 16);
|
|
26204
|
+
if (!Number.isFinite(numeric)) {
|
|
26205
|
+
numeric = Number.parseInt(raw, 10);
|
|
26206
|
+
}
|
|
26207
|
+
if (!Number.isFinite(numeric)) return null;
|
|
26208
|
+
return Object.fromEntries(Object.entries(tblLookBitmask).map(([key, mask]) => [key, (numeric & mask) === mask]));
|
|
26209
|
+
};
|
|
26210
|
+
const translator$n = NodeTranslator.from({
|
|
26092
26211
|
xmlName: "w:tblLook",
|
|
26093
26212
|
sdNodeOrKeyName: "tblLook",
|
|
26094
26213
|
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
26095
26214
|
encode: (params, encodedAttrs) => {
|
|
26215
|
+
const decoded = decodeTblLookVal(encodedAttrs.val);
|
|
26216
|
+
if (decoded) {
|
|
26217
|
+
Object.entries(decoded).forEach(([key, value]) => {
|
|
26218
|
+
if (!Object.prototype.hasOwnProperty.call(encodedAttrs, key)) {
|
|
26219
|
+
encodedAttrs[key] = value;
|
|
26220
|
+
}
|
|
26221
|
+
});
|
|
26222
|
+
}
|
|
26096
26223
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
26097
26224
|
},
|
|
26098
26225
|
decode: function({ node }, context) {
|
|
@@ -26100,16 +26227,16 @@ const translator$m = NodeTranslator.from({
|
|
|
26100
26227
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26101
26228
|
}
|
|
26102
26229
|
});
|
|
26103
|
-
const translator$
|
|
26104
|
-
const translator$
|
|
26105
|
-
const translator$
|
|
26230
|
+
const translator$m = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
26231
|
+
const translator$l = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
26232
|
+
const translator$k = NodeTranslator.from(
|
|
26106
26233
|
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
26107
26234
|
);
|
|
26108
|
-
const translator$
|
|
26235
|
+
const translator$j = NodeTranslator.from(
|
|
26109
26236
|
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
26110
26237
|
);
|
|
26111
|
-
const translator$
|
|
26112
|
-
const translator$
|
|
26238
|
+
const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
26239
|
+
const translator$h = NodeTranslator.from({
|
|
26113
26240
|
xmlName: "w:tblpPr",
|
|
26114
26241
|
sdNodeOrKeyName: "floatingTableProperties",
|
|
26115
26242
|
attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
|
|
@@ -26121,23 +26248,24 @@ const translator$g = NodeTranslator.from({
|
|
|
26121
26248
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
26122
26249
|
}
|
|
26123
26250
|
});
|
|
26124
|
-
const propertyTranslators$
|
|
26125
|
-
translator$
|
|
26126
|
-
translator$
|
|
26127
|
-
translator$
|
|
26128
|
-
translator$
|
|
26129
|
-
translator$
|
|
26130
|
-
translator$
|
|
26251
|
+
const propertyTranslators$2 = [
|
|
26252
|
+
translator$1q,
|
|
26253
|
+
translator$Z,
|
|
26254
|
+
translator$1o,
|
|
26255
|
+
translator$1m,
|
|
26256
|
+
translator$V,
|
|
26257
|
+
translator$1k
|
|
26131
26258
|
];
|
|
26132
|
-
const translator$
|
|
26133
|
-
createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$
|
|
26259
|
+
const translator$g = NodeTranslator.from(
|
|
26260
|
+
createNestedPropertiesTranslator("w:tblCellMar", "cellMargins", propertyTranslators$2)
|
|
26134
26261
|
);
|
|
26135
|
-
const propertyTranslators = [
|
|
26262
|
+
const propertyTranslators$1 = [
|
|
26263
|
+
translator$s,
|
|
26264
|
+
translator$1E,
|
|
26265
|
+
translator$2c,
|
|
26136
26266
|
translator$r,
|
|
26137
|
-
translator$
|
|
26138
|
-
translator$2b,
|
|
26267
|
+
translator$D,
|
|
26139
26268
|
translator$q,
|
|
26140
|
-
translator$C,
|
|
26141
26269
|
translator$p,
|
|
26142
26270
|
translator$o,
|
|
26143
26271
|
translator$n,
|
|
@@ -26147,14 +26275,13 @@ const propertyTranslators = [
|
|
|
26147
26275
|
translator$j,
|
|
26148
26276
|
translator$i,
|
|
26149
26277
|
translator$h,
|
|
26150
|
-
translator$
|
|
26151
|
-
translator$
|
|
26152
|
-
translator$f
|
|
26278
|
+
translator$I,
|
|
26279
|
+
translator$g
|
|
26153
26280
|
];
|
|
26154
|
-
const translator$
|
|
26155
|
-
createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators)
|
|
26281
|
+
const translator$f = NodeTranslator.from(
|
|
26282
|
+
createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators$1)
|
|
26156
26283
|
);
|
|
26157
|
-
const translator$
|
|
26284
|
+
const translator$e = NodeTranslator.from(
|
|
26158
26285
|
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
26159
26286
|
);
|
|
26160
26287
|
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
@@ -26212,7 +26339,7 @@ const encode$q = (params) => {
|
|
|
26212
26339
|
const node = nodes[0];
|
|
26213
26340
|
const attributes = encodeProperties(
|
|
26214
26341
|
{ ...params, nodes: [node] },
|
|
26215
|
-
{ [translator$
|
|
26342
|
+
{ [translator$e.xmlName]: translator$e },
|
|
26216
26343
|
true
|
|
26217
26344
|
);
|
|
26218
26345
|
return {
|
|
@@ -26254,10 +26381,10 @@ const decode$s = (params) => {
|
|
|
26254
26381
|
const roundedWidth = Math.round(numericWidth);
|
|
26255
26382
|
const minimumWidth = shouldEnforceMinimum ? cellMinWidth : 1;
|
|
26256
26383
|
const safeWidth = Math.max(roundedWidth, minimumWidth);
|
|
26257
|
-
const decoded = translator$
|
|
26384
|
+
const decoded = translator$e.decode({
|
|
26258
26385
|
node: { type: (
|
|
26259
26386
|
/** @type {string} */
|
|
26260
|
-
translator$
|
|
26387
|
+
translator$e.sdNodeOrKeyName
|
|
26261
26388
|
), attrs: { col: safeWidth } }
|
|
26262
26389
|
});
|
|
26263
26390
|
if (decoded) elements.push(decoded);
|
|
@@ -26299,7 +26426,11 @@ const config$c = {
|
|
|
26299
26426
|
encode: encode$q,
|
|
26300
26427
|
decode: decode$s
|
|
26301
26428
|
};
|
|
26302
|
-
const translator$
|
|
26429
|
+
const translator$d = NodeTranslator.from(config$c);
|
|
26430
|
+
const propertyTranslators = [translator$f, translator$K];
|
|
26431
|
+
const translator$c = NodeTranslator.from(
|
|
26432
|
+
createNestedPropertiesTranslator("w:tblStylePr", "tableStyleProperties", propertyTranslators)
|
|
26433
|
+
);
|
|
26303
26434
|
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
26304
26435
|
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
26305
26436
|
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
@@ -26369,14 +26500,14 @@ const encode$p = (params, encodedAttrs) => {
|
|
|
26369
26500
|
const node = nodes[0];
|
|
26370
26501
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
26371
26502
|
if (tblPr) {
|
|
26372
|
-
const encodedProperties = translator$
|
|
26503
|
+
const encodedProperties = translator$f.encode({ ...params, nodes: [tblPr] });
|
|
26373
26504
|
encodedAttrs["tableProperties"] = encodedProperties || {};
|
|
26374
26505
|
} else {
|
|
26375
26506
|
encodedAttrs["tableProperties"] ||= {};
|
|
26376
26507
|
}
|
|
26377
26508
|
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
26378
26509
|
if (tblGrid) {
|
|
26379
|
-
encodedAttrs["grid"] = translator$
|
|
26510
|
+
encodedAttrs["grid"] = translator$d.encode({ ...params, nodes: [tblGrid] }).attributes;
|
|
26380
26511
|
}
|
|
26381
26512
|
[
|
|
26382
26513
|
"tableStyleId",
|
|
@@ -26415,6 +26546,7 @@ const encode$p = (params, encodedAttrs) => {
|
|
|
26415
26546
|
};
|
|
26416
26547
|
}
|
|
26417
26548
|
}
|
|
26549
|
+
const tableLook = encodedAttrs.tableProperties.tblLook;
|
|
26418
26550
|
const borderProps = _processTableBorders(encodedAttrs.tableProperties.borders || {});
|
|
26419
26551
|
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params) || {};
|
|
26420
26552
|
encodedAttrs.borders = { ...referencedStyles.borders, ...borderProps };
|
|
@@ -26441,14 +26573,15 @@ const encode$p = (params, encodedAttrs) => {
|
|
|
26441
26573
|
const totalRows = rows.length;
|
|
26442
26574
|
const activeRowSpans = totalColumns > 0 ? new Array(totalColumns).fill(0) : [];
|
|
26443
26575
|
rows.forEach((row, rowIndex) => {
|
|
26444
|
-
const result = translator$
|
|
26576
|
+
const result = translator$x.encode({
|
|
26445
26577
|
...params,
|
|
26446
26578
|
path: [...params.path || [], node],
|
|
26447
26579
|
nodes: [row],
|
|
26448
26580
|
extraParams: {
|
|
26449
26581
|
row,
|
|
26450
26582
|
table: node,
|
|
26451
|
-
|
|
26583
|
+
tableBorders: encodedAttrs.borders,
|
|
26584
|
+
tableLook,
|
|
26452
26585
|
columnWidths,
|
|
26453
26586
|
activeRowSpans: activeRowSpans.slice(),
|
|
26454
26587
|
rowIndex,
|
|
@@ -26512,7 +26645,7 @@ const decode$r = (params, decodedAttrs) => {
|
|
|
26512
26645
|
};
|
|
26513
26646
|
const elements = translateChildNodes({ ...params, extraParams });
|
|
26514
26647
|
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
26515
|
-
const element = translator$
|
|
26648
|
+
const element = translator$d.decode({
|
|
26516
26649
|
...params,
|
|
26517
26650
|
node: { ...node, attrs: { ...node.attrs, grid } },
|
|
26518
26651
|
extraParams: {
|
|
@@ -26523,7 +26656,7 @@ const decode$r = (params, decodedAttrs) => {
|
|
|
26523
26656
|
if (element) elements.unshift(element);
|
|
26524
26657
|
if (node.attrs?.tableProperties) {
|
|
26525
26658
|
const properties = { ...node.attrs.tableProperties };
|
|
26526
|
-
const element2 = translator$
|
|
26659
|
+
const element2 = translator$f.decode({
|
|
26527
26660
|
...params,
|
|
26528
26661
|
node: { ...node, attrs: { ...node.attrs, tableProperties: properties } }
|
|
26529
26662
|
});
|
|
@@ -26585,7 +26718,7 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
26585
26718
|
if (baseTblPr && baseTblPr.elements) {
|
|
26586
26719
|
tblPr.elements = [...baseTblPr.elements, ...tblPr.elements];
|
|
26587
26720
|
}
|
|
26588
|
-
const tableProperties = translator$
|
|
26721
|
+
const tableProperties = translator$f.encode({ ...params, nodes: [tblPr] });
|
|
26589
26722
|
if (tableProperties) {
|
|
26590
26723
|
const borders = _processTableBorders(tableProperties.borders || {});
|
|
26591
26724
|
if (borders || Object.keys(borders).length) stylesToReturn.borders = borders;
|
|
@@ -26601,7 +26734,18 @@ function _getReferencedTableStyles(tableStyleReference, params) {
|
|
|
26601
26734
|
if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
|
|
26602
26735
|
}
|
|
26603
26736
|
}
|
|
26604
|
-
|
|
26737
|
+
const tblStylePr = styleTag.elements.filter((el) => el.name === "w:tblStylePr");
|
|
26738
|
+
let styleProps = {};
|
|
26739
|
+
if (tblStylePr) {
|
|
26740
|
+
styleProps = tblStylePr.reduce((acc, el) => {
|
|
26741
|
+
acc[el.attributes["w:type"]] = translator$c.encode({ ...params, nodes: [el] });
|
|
26742
|
+
return acc;
|
|
26743
|
+
}, {});
|
|
26744
|
+
}
|
|
26745
|
+
return {
|
|
26746
|
+
...stylesToReturn,
|
|
26747
|
+
...styleProps
|
|
26748
|
+
};
|
|
26605
26749
|
}
|
|
26606
26750
|
const config$b = {
|
|
26607
26751
|
xmlName: XML_NODE_NAME$c,
|
|
@@ -27377,7 +27521,7 @@ function handleVRectImport({ pNode, pict, params }) {
|
|
|
27377
27521
|
if (isHorizontalRule) {
|
|
27378
27522
|
schemaAttrs.horizontalRule = true;
|
|
27379
27523
|
}
|
|
27380
|
-
const pElement = translator$
|
|
27524
|
+
const pElement = translator$14.encode({
|
|
27381
27525
|
...params,
|
|
27382
27526
|
nodes: [{ ...pNode, elements: pNode.elements.filter((el) => el.name !== "w:r") }]
|
|
27383
27527
|
});
|
|
@@ -27437,7 +27581,7 @@ const handleDrawingNode = (params) => {
|
|
|
27437
27581
|
return { nodes: [], consumed: 0 };
|
|
27438
27582
|
}
|
|
27439
27583
|
const translatorParams = { ...params, nodes: [node] };
|
|
27440
|
-
const schemaNode = translator$
|
|
27584
|
+
const schemaNode = translator$u.encode(translatorParams);
|
|
27441
27585
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
27442
27586
|
return { nodes: newNodes, consumed: 1 };
|
|
27443
27587
|
};
|
|
@@ -27565,7 +27709,7 @@ const handleTrackChangeNode = (params) => {
|
|
|
27565
27709
|
});
|
|
27566
27710
|
break;
|
|
27567
27711
|
case "w:ins":
|
|
27568
|
-
result = translator$
|
|
27712
|
+
result = translator$1y.encode({
|
|
27569
27713
|
...translatorParams,
|
|
27570
27714
|
extraParams: {
|
|
27571
27715
|
...translatorParams.extraParams,
|
|
@@ -27580,8 +27724,8 @@ const trackChangeNodeHandlerEntity = {
|
|
|
27580
27724
|
handlerName: "trackChangeNodeHandler",
|
|
27581
27725
|
handler: handleTrackChangeNode
|
|
27582
27726
|
};
|
|
27583
|
-
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$
|
|
27584
|
-
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$
|
|
27727
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$13);
|
|
27728
|
+
const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$12);
|
|
27585
27729
|
const XML_NODE_NAME$1 = "w:t";
|
|
27586
27730
|
const SD_NODE_NAME$1 = "text";
|
|
27587
27731
|
const validXmlAttributes$1 = [createAttributeHandler("xml:space", "xmlSpace")];
|
|
@@ -27626,12 +27770,12 @@ const decode$1 = (params) => {
|
|
|
27626
27770
|
case "trackDelete":
|
|
27627
27771
|
return translator$2.decode(params);
|
|
27628
27772
|
case "trackInsert":
|
|
27629
|
-
return translator$
|
|
27773
|
+
return translator$1y.decode(params);
|
|
27630
27774
|
}
|
|
27631
27775
|
}
|
|
27632
27776
|
const isLinkNode = node.marks?.some((m2) => m2.type === "link");
|
|
27633
27777
|
if (isLinkNode && !extraParams?.linkProcessed) {
|
|
27634
|
-
return translator$
|
|
27778
|
+
return translator$13.decode(params);
|
|
27635
27779
|
}
|
|
27636
27780
|
const { text, marks = [] } = node;
|
|
27637
27781
|
return getTextNodeForExport(text, marks, params);
|
|
@@ -27673,7 +27817,7 @@ const handleParagraphNode = (params) => {
|
|
|
27673
27817
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
27674
27818
|
return { nodes: [], consumed: 0 };
|
|
27675
27819
|
}
|
|
27676
|
-
const schemaNode = translator$
|
|
27820
|
+
const schemaNode = translator$14.encode(params);
|
|
27677
27821
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
27678
27822
|
return { nodes: newNodes, consumed: 1 };
|
|
27679
27823
|
};
|
|
@@ -27686,7 +27830,7 @@ const handleSdtNode = (params) => {
|
|
|
27686
27830
|
if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
|
|
27687
27831
|
return { nodes: [], consumed: 0 };
|
|
27688
27832
|
}
|
|
27689
|
-
const result = translator$
|
|
27833
|
+
const result = translator$t.encode(params);
|
|
27690
27834
|
if (!result) {
|
|
27691
27835
|
return { nodes: [], consumed: 0 };
|
|
27692
27836
|
}
|
|
@@ -27702,152 +27846,152 @@ const sdtNodeHandlerEntity = {
|
|
|
27702
27846
|
};
|
|
27703
27847
|
const translatorList = Array.from(
|
|
27704
27848
|
/* @__PURE__ */ new Set([
|
|
27705
|
-
translator$
|
|
27849
|
+
translator$1O,
|
|
27706
27850
|
translator$6,
|
|
27707
27851
|
translator$5,
|
|
27708
27852
|
translator$4,
|
|
27709
27853
|
translator$3,
|
|
27854
|
+
translator$1N,
|
|
27710
27855
|
translator$1M,
|
|
27711
27856
|
translator$1L,
|
|
27712
|
-
translator$
|
|
27857
|
+
translator$2p,
|
|
27858
|
+
translator$1t,
|
|
27713
27859
|
translator$2o,
|
|
27714
|
-
translator$1s,
|
|
27715
27860
|
translator$2n,
|
|
27716
|
-
translator$
|
|
27717
|
-
translator$r,
|
|
27861
|
+
translator$s,
|
|
27718
27862
|
translator$9,
|
|
27719
27863
|
translator$a,
|
|
27720
|
-
translator$
|
|
27721
|
-
translator$
|
|
27722
|
-
translator$
|
|
27723
|
-
translator$
|
|
27864
|
+
translator$1r,
|
|
27865
|
+
translator$2s,
|
|
27866
|
+
translator$H,
|
|
27867
|
+
translator$2d,
|
|
27868
|
+
translator$1J,
|
|
27869
|
+
translator$2i,
|
|
27724
27870
|
translator$1I,
|
|
27725
|
-
translator$
|
|
27726
|
-
translator$1H,
|
|
27727
|
-
translator$1R,
|
|
27871
|
+
translator$1S,
|
|
27728
27872
|
translator$2,
|
|
27729
|
-
translator$
|
|
27730
|
-
translator$
|
|
27731
|
-
translator$
|
|
27732
|
-
translator$1T,
|
|
27733
|
-
translator$1Z,
|
|
27734
|
-
translator$1Y,
|
|
27735
|
-
translator$25,
|
|
27736
|
-
translator$Z,
|
|
27873
|
+
translator$1H,
|
|
27874
|
+
translator$u,
|
|
27875
|
+
translator$2j,
|
|
27737
27876
|
translator$1U,
|
|
27738
|
-
translator$
|
|
27877
|
+
translator$1_,
|
|
27878
|
+
translator$1Z,
|
|
27879
|
+
translator$26,
|
|
27880
|
+
translator$_,
|
|
27881
|
+
translator$1V,
|
|
27882
|
+
translator$1G,
|
|
27883
|
+
translator$G,
|
|
27739
27884
|
translator$F,
|
|
27740
|
-
translator$
|
|
27741
|
-
translator$
|
|
27742
|
-
translator$$,
|
|
27743
|
-
translator$L,
|
|
27744
|
-
translator$K,
|
|
27745
|
-
translator$D,
|
|
27885
|
+
translator$e,
|
|
27886
|
+
translator$10,
|
|
27746
27887
|
translator$M,
|
|
27747
|
-
translator$
|
|
27748
|
-
translator$
|
|
27749
|
-
translator$
|
|
27750
|
-
translator$
|
|
27888
|
+
translator$L,
|
|
27889
|
+
translator$E,
|
|
27890
|
+
translator$N,
|
|
27891
|
+
translator$2r,
|
|
27892
|
+
translator$13,
|
|
27893
|
+
translator$2m,
|
|
27894
|
+
translator$1R,
|
|
27895
|
+
translator$1z,
|
|
27896
|
+
translator$1F,
|
|
27897
|
+
translator$25,
|
|
27751
27898
|
translator$1y,
|
|
27752
|
-
translator$
|
|
27753
|
-
translator$24,
|
|
27754
|
-
translator$1x,
|
|
27899
|
+
translator$Y,
|
|
27755
27900
|
translator$X,
|
|
27756
|
-
translator$
|
|
27901
|
+
translator$1E,
|
|
27757
27902
|
translator$1D,
|
|
27758
27903
|
translator$1C,
|
|
27904
|
+
translator$1X,
|
|
27759
27905
|
translator$1B,
|
|
27760
|
-
translator$
|
|
27906
|
+
translator$2b,
|
|
27907
|
+
translator$1p,
|
|
27761
27908
|
translator$1A,
|
|
27762
|
-
translator$
|
|
27763
|
-
translator$
|
|
27764
|
-
translator$
|
|
27765
|
-
translator$23,
|
|
27766
|
-
translator$Q,
|
|
27909
|
+
translator$24,
|
|
27910
|
+
translator$R,
|
|
27911
|
+
translator$1x,
|
|
27767
27912
|
translator$1w,
|
|
27913
|
+
translator$22,
|
|
27768
27914
|
translator$1v,
|
|
27769
|
-
translator$21,
|
|
27770
27915
|
translator$1u,
|
|
27771
|
-
translator$
|
|
27772
|
-
translator$22,
|
|
27773
|
-
translator$13,
|
|
27774
|
-
translator$1g,
|
|
27775
|
-
translator$1i,
|
|
27776
|
-
translator$1V,
|
|
27916
|
+
translator$23,
|
|
27777
27917
|
translator$14,
|
|
27778
27918
|
translator$1h,
|
|
27919
|
+
translator$1j,
|
|
27920
|
+
translator$1W,
|
|
27921
|
+
translator$15,
|
|
27922
|
+
translator$1i,
|
|
27779
27923
|
translator$8,
|
|
27780
27924
|
translator$7,
|
|
27781
|
-
translator$
|
|
27925
|
+
translator$12,
|
|
27926
|
+
translator$2h,
|
|
27927
|
+
translator$1P,
|
|
27782
27928
|
translator$2g,
|
|
27783
|
-
translator$
|
|
27784
|
-
translator$
|
|
27785
|
-
translator$
|
|
27786
|
-
translator$
|
|
27787
|
-
translator$
|
|
27788
|
-
translator$
|
|
27789
|
-
translator$2b,
|
|
27929
|
+
translator$1T,
|
|
27930
|
+
translator$1n,
|
|
27931
|
+
translator$t,
|
|
27932
|
+
translator$21,
|
|
27933
|
+
translator$2c,
|
|
27934
|
+
translator$28,
|
|
27790
27935
|
translator$27,
|
|
27791
|
-
translator$
|
|
27936
|
+
translator$1g,
|
|
27792
27937
|
translator$1f,
|
|
27793
27938
|
translator$1e,
|
|
27794
27939
|
translator$1d,
|
|
27795
|
-
translator$
|
|
27796
|
-
translator$
|
|
27797
|
-
translator$
|
|
27798
|
-
translator$
|
|
27940
|
+
translator$1$,
|
|
27941
|
+
translator$W,
|
|
27942
|
+
translator$2k,
|
|
27943
|
+
translator$2f,
|
|
27799
27944
|
translator$2e,
|
|
27800
|
-
translator$2d,
|
|
27801
27945
|
translator$1,
|
|
27802
|
-
translator$
|
|
27803
|
-
translator$
|
|
27946
|
+
translator$2q,
|
|
27947
|
+
translator$1c,
|
|
27804
27948
|
translator$b,
|
|
27805
|
-
translator$
|
|
27949
|
+
translator$I,
|
|
27950
|
+
translator$r,
|
|
27951
|
+
translator$g,
|
|
27952
|
+
translator$D,
|
|
27806
27953
|
translator$q,
|
|
27807
|
-
translator$
|
|
27954
|
+
translator$d,
|
|
27808
27955
|
translator$C,
|
|
27809
27956
|
translator$p,
|
|
27810
|
-
translator$c,
|
|
27811
|
-
translator$B,
|
|
27812
27957
|
translator$o,
|
|
27813
27958
|
translator$n,
|
|
27814
27959
|
translator$m,
|
|
27960
|
+
translator$f,
|
|
27815
27961
|
translator$l,
|
|
27816
|
-
translator$e,
|
|
27817
27962
|
translator$k,
|
|
27818
27963
|
translator$j,
|
|
27819
27964
|
translator$i,
|
|
27820
27965
|
translator$h,
|
|
27821
|
-
translator$g,
|
|
27822
|
-
translator$I,
|
|
27823
|
-
translator$R,
|
|
27824
|
-
translator$O,
|
|
27825
|
-
translator$P,
|
|
27826
27966
|
translator$J,
|
|
27827
|
-
translator$10,
|
|
27828
|
-
translator$19,
|
|
27829
|
-
translator$T,
|
|
27830
|
-
translator$w,
|
|
27831
27967
|
translator$S,
|
|
27832
|
-
translator$
|
|
27833
|
-
translator$
|
|
27968
|
+
translator$P,
|
|
27969
|
+
translator$Q,
|
|
27970
|
+
translator$K,
|
|
27971
|
+
translator$11,
|
|
27834
27972
|
translator$1a,
|
|
27973
|
+
translator$U,
|
|
27974
|
+
translator$x,
|
|
27975
|
+
translator$T,
|
|
27976
|
+
translator$B,
|
|
27977
|
+
translator$y,
|
|
27978
|
+
translator$1b,
|
|
27979
|
+
translator$19,
|
|
27835
27980
|
translator$18,
|
|
27836
|
-
translator$
|
|
27837
|
-
translator$
|
|
27838
|
-
translator$
|
|
27839
|
-
translator$
|
|
27840
|
-
translator$
|
|
27841
|
-
translator
|
|
27842
|
-
translator$
|
|
27843
|
-
translator$
|
|
27981
|
+
translator$1l,
|
|
27982
|
+
translator$2l,
|
|
27983
|
+
translator$O,
|
|
27984
|
+
translator$20,
|
|
27985
|
+
translator$29,
|
|
27986
|
+
translator$$,
|
|
27987
|
+
translator$1Y,
|
|
27988
|
+
translator$A,
|
|
27844
27989
|
translator$z,
|
|
27845
|
-
translator$
|
|
27846
|
-
translator$
|
|
27990
|
+
translator$1Q,
|
|
27991
|
+
translator$17,
|
|
27847
27992
|
translator$16,
|
|
27848
|
-
translator$
|
|
27993
|
+
translator$w,
|
|
27849
27994
|
translator$v,
|
|
27850
|
-
translator$u,
|
|
27851
27995
|
commentRangeStartTranslator,
|
|
27852
27996
|
commentRangeEndTranslator
|
|
27853
27997
|
])
|
|
@@ -27952,7 +28096,7 @@ const handler = (params) => {
|
|
|
27952
28096
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
27953
28097
|
return { nodes: [], consumed: 0 };
|
|
27954
28098
|
}
|
|
27955
|
-
const result = translator$
|
|
28099
|
+
const result = translator$2s.encode(params);
|
|
27956
28100
|
if (!result) return { nodes: [], consumed: 0 };
|
|
27957
28101
|
return {
|
|
27958
28102
|
nodes: [result],
|
|
@@ -28096,7 +28240,7 @@ const handleAlternateChoice = (params) => {
|
|
|
28096
28240
|
...currentNode,
|
|
28097
28241
|
type: "element"
|
|
28098
28242
|
};
|
|
28099
|
-
const translated = translator$
|
|
28243
|
+
const translated = translator$1O.encode({
|
|
28100
28244
|
...params,
|
|
28101
28245
|
nodes: [nodeForTranslator],
|
|
28102
28246
|
extraParams: { ...params.extraParams || {}, node: nodeForTranslator }
|
|
@@ -29023,7 +29167,7 @@ const handleTabNode = (params) => {
|
|
|
29023
29167
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
29024
29168
|
return { nodes: [], consumed: 0 };
|
|
29025
29169
|
}
|
|
29026
|
-
const node = translator$
|
|
29170
|
+
const node = translator$2q.encode(params);
|
|
29027
29171
|
return { nodes: [node], consumed: 1 };
|
|
29028
29172
|
};
|
|
29029
29173
|
const tabNodeEntityHandler = {
|
|
@@ -30126,7 +30270,7 @@ function buildStyles(styleObject) {
|
|
|
30126
30270
|
}
|
|
30127
30271
|
return style;
|
|
30128
30272
|
}
|
|
30129
|
-
function
|
|
30273
|
+
function handleShapeImageWatermarkImport({ params, pict }) {
|
|
30130
30274
|
const shape = pict.elements?.find((el) => el.name === "v:shape");
|
|
30131
30275
|
if (!shape) return null;
|
|
30132
30276
|
const imagedata = shape.elements?.find((el) => el.name === "v:imagedata");
|
|
@@ -30152,7 +30296,7 @@ function handleShapeImageImport({ params, pict }) {
|
|
|
30152
30296
|
const targetPath = rel.attributes["Target"];
|
|
30153
30297
|
const normalizedPath = normalizeTargetPath(targetPath);
|
|
30154
30298
|
const style = shapeAttrs.style || "";
|
|
30155
|
-
const styleObj = parseVmlStyle(style);
|
|
30299
|
+
const styleObj = parseVmlStyle$1(style);
|
|
30156
30300
|
const width = styleObj.width || "100px";
|
|
30157
30301
|
const height = styleObj.height || "100px";
|
|
30158
30302
|
const position = {
|
|
@@ -30198,12 +30342,12 @@ function handleShapeImageImport({ params, pict }) {
|
|
|
30198
30342
|
},
|
|
30199
30343
|
// Size
|
|
30200
30344
|
size: {
|
|
30201
|
-
width: convertToPixels(width),
|
|
30202
|
-
height: convertToPixels(height)
|
|
30345
|
+
width: convertToPixels$1(width),
|
|
30346
|
+
height: convertToPixels$1(height)
|
|
30203
30347
|
},
|
|
30204
30348
|
marginOffset: {
|
|
30205
|
-
horizontal: convertToPixels(position.marginLeft),
|
|
30206
|
-
top: convertToPixels(position.marginTop)
|
|
30349
|
+
horizontal: convertToPixels$1(position.marginLeft),
|
|
30350
|
+
top: convertToPixels$1(position.marginTop)
|
|
30207
30351
|
},
|
|
30208
30352
|
// Image adjustments
|
|
30209
30353
|
...gain && { gain },
|
|
@@ -30219,7 +30363,7 @@ function normalizeTargetPath(targetPath = "") {
|
|
|
30219
30363
|
if (trimmed.startsWith("media/")) return `word/${trimmed}`;
|
|
30220
30364
|
return `word/${trimmed}`;
|
|
30221
30365
|
}
|
|
30222
|
-
function parseVmlStyle(style) {
|
|
30366
|
+
function parseVmlStyle$1(style) {
|
|
30223
30367
|
const result = {};
|
|
30224
30368
|
if (!style) return result;
|
|
30225
30369
|
const declarations = style.split(";").filter((s) => s.trim());
|
|
@@ -30231,6 +30375,267 @@ function parseVmlStyle(style) {
|
|
|
30231
30375
|
}
|
|
30232
30376
|
return result;
|
|
30233
30377
|
}
|
|
30378
|
+
function convertToPixels$1(value) {
|
|
30379
|
+
if (typeof value === "number") return value;
|
|
30380
|
+
if (!value || typeof value !== "string") return 0;
|
|
30381
|
+
const match = value.match(/^([\d.]+)([a-z%]+)?$/i);
|
|
30382
|
+
if (!match) return 0;
|
|
30383
|
+
const num = parseFloat(match[1]);
|
|
30384
|
+
const unit = match[2] || "px";
|
|
30385
|
+
switch (unit.toLowerCase()) {
|
|
30386
|
+
case "px":
|
|
30387
|
+
return num;
|
|
30388
|
+
case "pt":
|
|
30389
|
+
return num * (96 / 72);
|
|
30390
|
+
// 1pt = 1/72 inch, 96 DPI
|
|
30391
|
+
case "in":
|
|
30392
|
+
return num * 96;
|
|
30393
|
+
case "cm":
|
|
30394
|
+
return num * (96 / 2.54);
|
|
30395
|
+
case "mm":
|
|
30396
|
+
return num * (96 / 25.4);
|
|
30397
|
+
case "pc":
|
|
30398
|
+
return num * 16;
|
|
30399
|
+
// 1pc = 12pt
|
|
30400
|
+
default:
|
|
30401
|
+
return num;
|
|
30402
|
+
}
|
|
30403
|
+
}
|
|
30404
|
+
function handleShapeTextWatermarkImport({ pict }) {
|
|
30405
|
+
const shape = pict.elements?.find((el) => el.name === "v:shape");
|
|
30406
|
+
if (!shape) return null;
|
|
30407
|
+
const textpath = shape.elements?.find((el) => el.name === "v:textpath");
|
|
30408
|
+
if (!textpath) return null;
|
|
30409
|
+
const shapeAttrs = shape.attributes || {};
|
|
30410
|
+
const textpathAttrs = textpath.attributes || {};
|
|
30411
|
+
const watermarkText = textpathAttrs["string"] || "";
|
|
30412
|
+
if (!watermarkText) {
|
|
30413
|
+
console.warn("v:textpath missing string attribute");
|
|
30414
|
+
return null;
|
|
30415
|
+
}
|
|
30416
|
+
const style = shapeAttrs.style || "";
|
|
30417
|
+
const styleObj = parseVmlStyle(style);
|
|
30418
|
+
const width = styleObj.width || "481.8pt";
|
|
30419
|
+
const height = styleObj.height || "82.8pt";
|
|
30420
|
+
const position = {
|
|
30421
|
+
type: styleObj.position || "absolute",
|
|
30422
|
+
marginLeft: styleObj["margin-left"] || "0",
|
|
30423
|
+
marginTop: styleObj["margin-top"] || "0"
|
|
30424
|
+
};
|
|
30425
|
+
const rotation = parseFloat(styleObj.rotation) || 0;
|
|
30426
|
+
const hPosition = styleObj["mso-position-horizontal"] || "center";
|
|
30427
|
+
const vPosition = styleObj["mso-position-vertical"] || "center";
|
|
30428
|
+
const hRelativeTo = styleObj["mso-position-horizontal-relative"] || "margin";
|
|
30429
|
+
const vRelativeTo = styleObj["mso-position-vertical-relative"] || "margin";
|
|
30430
|
+
const textAnchor = styleObj["v-text-anchor"] || "middle";
|
|
30431
|
+
const fill = shape.elements?.find((el) => el.name === "v:fill");
|
|
30432
|
+
const fillAttrs = fill?.attributes || {};
|
|
30433
|
+
const rawFillColor = shapeAttrs.fillcolor || fillAttrs.color || "silver";
|
|
30434
|
+
const rawFillColor2 = fillAttrs.color2 || "#3f3f3f";
|
|
30435
|
+
const fillColor = sanitizeColor(rawFillColor, "silver");
|
|
30436
|
+
const fillColor2 = sanitizeColor(rawFillColor2, "#3f3f3f");
|
|
30437
|
+
const opacity = fillAttrs.opacity || "0.5";
|
|
30438
|
+
const fillType = fillAttrs.type || "solid";
|
|
30439
|
+
const stroke = shape.elements?.find((el) => el.name === "v:stroke");
|
|
30440
|
+
const strokeAttrs = stroke?.attributes || {};
|
|
30441
|
+
const stroked = shapeAttrs.stroked || "f";
|
|
30442
|
+
const strokeColor = strokeAttrs.color || "#3465a4";
|
|
30443
|
+
const strokeJoinstyle = strokeAttrs.joinstyle || "round";
|
|
30444
|
+
const strokeEndcap = strokeAttrs.endcap || "flat";
|
|
30445
|
+
const textpathStyle = textpathAttrs.style || "";
|
|
30446
|
+
const textStyleObj = parseVmlStyle(textpathStyle);
|
|
30447
|
+
const rawFontFamily = textStyleObj["font-family"]?.replace(/['"]/g, "");
|
|
30448
|
+
const fontFamily = sanitizeFontFamily(rawFontFamily);
|
|
30449
|
+
const fontSize = textStyleObj["font-size"] || "1pt";
|
|
30450
|
+
const fitshape = textpathAttrs.fitshape || "t";
|
|
30451
|
+
const trim = textpathAttrs.trim || "t";
|
|
30452
|
+
const textpathOn = textpathAttrs.on || "t";
|
|
30453
|
+
const path = shape.elements?.find((el) => el.name === "v:path");
|
|
30454
|
+
const pathAttrs = path?.attributes || {};
|
|
30455
|
+
const textpathok = pathAttrs.textpathok || "t";
|
|
30456
|
+
const wrap2 = shape.elements?.find((el) => el.name === "w10:wrap");
|
|
30457
|
+
const wrapAttrs = wrap2?.attributes || {};
|
|
30458
|
+
const wrapType = wrapAttrs.type || "none";
|
|
30459
|
+
const widthPx = convertToPixels(width);
|
|
30460
|
+
const heightPx = convertToPixels(height);
|
|
30461
|
+
const sanitizedOpacity = sanitizeNumeric(parseFloat(opacity), 0.5, 0, 1);
|
|
30462
|
+
const sanitizedRotation = sanitizeNumeric(rotation, 0, -360, 360);
|
|
30463
|
+
const svgResult = generateTextWatermarkSVG({
|
|
30464
|
+
text: watermarkText,
|
|
30465
|
+
width: widthPx,
|
|
30466
|
+
height: heightPx,
|
|
30467
|
+
rotation: sanitizedRotation,
|
|
30468
|
+
fill: {
|
|
30469
|
+
color: fillColor,
|
|
30470
|
+
opacity: sanitizedOpacity
|
|
30471
|
+
},
|
|
30472
|
+
textStyle: {
|
|
30473
|
+
fontFamily,
|
|
30474
|
+
fontSize
|
|
30475
|
+
}
|
|
30476
|
+
});
|
|
30477
|
+
const svgDataUri = svgResult.dataUri;
|
|
30478
|
+
const imageWatermarkNode = {
|
|
30479
|
+
type: "image",
|
|
30480
|
+
attrs: {
|
|
30481
|
+
src: svgDataUri,
|
|
30482
|
+
alt: watermarkText,
|
|
30483
|
+
title: watermarkText,
|
|
30484
|
+
extension: "svg",
|
|
30485
|
+
// Mark this as a text watermark for export
|
|
30486
|
+
vmlWatermark: true,
|
|
30487
|
+
vmlTextWatermark: true,
|
|
30488
|
+
// Store VML-specific attributes for round-trip
|
|
30489
|
+
vmlStyle: style,
|
|
30490
|
+
vmlAttributes: shapeAttrs,
|
|
30491
|
+
vmlTextpathAttributes: textpathAttrs,
|
|
30492
|
+
vmlPathAttributes: pathAttrs,
|
|
30493
|
+
vmlFillAttributes: fillAttrs,
|
|
30494
|
+
vmlStrokeAttributes: strokeAttrs,
|
|
30495
|
+
vmlWrapAttributes: wrapAttrs,
|
|
30496
|
+
// Positioning (same as image watermarks)
|
|
30497
|
+
isAnchor: true,
|
|
30498
|
+
inline: false,
|
|
30499
|
+
wrap: {
|
|
30500
|
+
type: wrapType === "none" ? "None" : wrapType,
|
|
30501
|
+
attrs: {
|
|
30502
|
+
behindDoc: true
|
|
30503
|
+
}
|
|
30504
|
+
},
|
|
30505
|
+
anchorData: {
|
|
30506
|
+
hRelativeFrom: hRelativeTo,
|
|
30507
|
+
vRelativeFrom: vRelativeTo,
|
|
30508
|
+
alignH: hPosition,
|
|
30509
|
+
alignV: vPosition
|
|
30510
|
+
},
|
|
30511
|
+
// Size - use rotated bounding box dimensions to prevent clipping
|
|
30512
|
+
size: {
|
|
30513
|
+
width: svgResult.svgWidth,
|
|
30514
|
+
height: svgResult.svgHeight
|
|
30515
|
+
},
|
|
30516
|
+
marginOffset: {
|
|
30517
|
+
horizontal: convertToPixels(position.marginLeft),
|
|
30518
|
+
// For center-aligned watermarks relative to margin, Word's margin-top value
|
|
30519
|
+
// is not suitable for browser rendering. Set to 0 to let center alignment work.
|
|
30520
|
+
top: vPosition === "center" && vRelativeTo === "margin" ? 0 : convertToPixels(position.marginTop)
|
|
30521
|
+
},
|
|
30522
|
+
// Store text watermark specific data for export
|
|
30523
|
+
textWatermarkData: {
|
|
30524
|
+
text: watermarkText,
|
|
30525
|
+
rotation: sanitizedRotation,
|
|
30526
|
+
textStyle: {
|
|
30527
|
+
fontFamily,
|
|
30528
|
+
fontSize,
|
|
30529
|
+
textAnchor
|
|
30530
|
+
},
|
|
30531
|
+
fill: {
|
|
30532
|
+
color: fillColor,
|
|
30533
|
+
color2: fillColor2,
|
|
30534
|
+
opacity: sanitizedOpacity,
|
|
30535
|
+
type: fillType
|
|
30536
|
+
},
|
|
30537
|
+
stroke: {
|
|
30538
|
+
enabled: stroked !== "f",
|
|
30539
|
+
color: strokeColor,
|
|
30540
|
+
joinstyle: strokeJoinstyle,
|
|
30541
|
+
endcap: strokeEndcap
|
|
30542
|
+
},
|
|
30543
|
+
textpath: {
|
|
30544
|
+
on: textpathOn === "t",
|
|
30545
|
+
fitshape: fitshape === "t",
|
|
30546
|
+
trim: trim === "t",
|
|
30547
|
+
textpathok: textpathok === "t"
|
|
30548
|
+
}
|
|
30549
|
+
}
|
|
30550
|
+
}
|
|
30551
|
+
};
|
|
30552
|
+
return imageWatermarkNode;
|
|
30553
|
+
}
|
|
30554
|
+
function sanitizeFontFamily(fontFamily) {
|
|
30555
|
+
if (!fontFamily || typeof fontFamily !== "string") {
|
|
30556
|
+
return "Arial";
|
|
30557
|
+
}
|
|
30558
|
+
const sanitized = fontFamily.replace(/[^a-zA-Z0-9\s,\-]/g, "").trim();
|
|
30559
|
+
return sanitized || "Arial";
|
|
30560
|
+
}
|
|
30561
|
+
function sanitizeColor(color, defaultColor = "silver") {
|
|
30562
|
+
if (!color || typeof color !== "string") {
|
|
30563
|
+
return defaultColor;
|
|
30564
|
+
}
|
|
30565
|
+
const sanitized = color.replace(/[^a-zA-Z0-9#%(),.]/g, "").trim();
|
|
30566
|
+
return sanitized || defaultColor;
|
|
30567
|
+
}
|
|
30568
|
+
function sanitizeNumeric(value, defaultValue, min = -Infinity, max = Infinity) {
|
|
30569
|
+
const num = typeof value === "number" ? value : parseFloat(value);
|
|
30570
|
+
if (isNaN(num) || !isFinite(num)) {
|
|
30571
|
+
return defaultValue;
|
|
30572
|
+
}
|
|
30573
|
+
return Math.max(min, Math.min(max, num));
|
|
30574
|
+
}
|
|
30575
|
+
function generateTextWatermarkSVG({ text, width, height, rotation, fill, textStyle }) {
|
|
30576
|
+
let fontSize = height * 0.9;
|
|
30577
|
+
if (textStyle?.fontSize && textStyle.fontSize.trim() !== "1pt") {
|
|
30578
|
+
const match = textStyle.fontSize.match(/^([\d.]+)(pt|px)?$/);
|
|
30579
|
+
if (match) {
|
|
30580
|
+
const value = parseFloat(match[1]);
|
|
30581
|
+
const unit = match[2] || "pt";
|
|
30582
|
+
fontSize = (unit === "pt" ? value * (96 / 72) : value) * 50;
|
|
30583
|
+
}
|
|
30584
|
+
}
|
|
30585
|
+
fontSize = Math.max(fontSize, 48);
|
|
30586
|
+
const color = sanitizeColor(fill?.color, "silver");
|
|
30587
|
+
const opacity = sanitizeNumeric(fill?.opacity, 0.5, 0, 1);
|
|
30588
|
+
const fontFamily = sanitizeFontFamily(textStyle?.fontFamily);
|
|
30589
|
+
const sanitizedRotation = sanitizeNumeric(rotation, 0, -360, 360);
|
|
30590
|
+
const sanitizedWidth = sanitizeNumeric(width, 100, 1, 1e4);
|
|
30591
|
+
const sanitizedHeight = sanitizeNumeric(height, 100, 1, 1e4);
|
|
30592
|
+
const sanitizedFontSize = sanitizeNumeric(fontSize, 48, 1, 1e3);
|
|
30593
|
+
const radians = sanitizedRotation * Math.PI / 180;
|
|
30594
|
+
const cos = Math.abs(Math.cos(radians));
|
|
30595
|
+
const sin = Math.abs(Math.sin(radians));
|
|
30596
|
+
const rotatedWidth = sanitizedWidth * cos + sanitizedHeight * sin;
|
|
30597
|
+
const rotatedHeight = sanitizedWidth * sin + sanitizedHeight * cos;
|
|
30598
|
+
const svgWidth = Math.max(sanitizedWidth, rotatedWidth);
|
|
30599
|
+
const svgHeight = Math.max(sanitizedHeight, rotatedHeight);
|
|
30600
|
+
const centerX = svgWidth / 2;
|
|
30601
|
+
const centerY = svgHeight / 2;
|
|
30602
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${svgWidth}" height="${svgHeight}" viewBox="0 0 ${svgWidth} ${svgHeight}">
|
|
30603
|
+
<text
|
|
30604
|
+
x="${centerX}"
|
|
30605
|
+
y="${centerY}"
|
|
30606
|
+
text-anchor="middle"
|
|
30607
|
+
dominant-baseline="middle"
|
|
30608
|
+
font-family="${fontFamily}"
|
|
30609
|
+
font-size="${sanitizedFontSize}px"
|
|
30610
|
+
font-weight="bold"
|
|
30611
|
+
fill="${color}"
|
|
30612
|
+
opacity="${opacity}"
|
|
30613
|
+
transform="rotate(${sanitizedRotation} ${centerX} ${centerY})">${escapeXml(text)}</text>
|
|
30614
|
+
</svg>`;
|
|
30615
|
+
return {
|
|
30616
|
+
dataUri: `data:image/svg+xml,${encodeURIComponent(svg)}`,
|
|
30617
|
+
svgWidth,
|
|
30618
|
+
svgHeight
|
|
30619
|
+
};
|
|
30620
|
+
}
|
|
30621
|
+
function escapeXml(text) {
|
|
30622
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
30623
|
+
}
|
|
30624
|
+
function parseVmlStyle(style) {
|
|
30625
|
+
const result = {};
|
|
30626
|
+
if (!style) return result;
|
|
30627
|
+
const declarations = style.split(";").filter((s) => s.trim());
|
|
30628
|
+
for (const decl of declarations) {
|
|
30629
|
+
const colonIndex = decl.indexOf(":");
|
|
30630
|
+
if (colonIndex === -1) continue;
|
|
30631
|
+
const prop = decl.substring(0, colonIndex).trim();
|
|
30632
|
+
const value = decl.substring(colonIndex + 1).trim();
|
|
30633
|
+
if (prop && value) {
|
|
30634
|
+
result[prop] = value;
|
|
30635
|
+
}
|
|
30636
|
+
}
|
|
30637
|
+
return result;
|
|
30638
|
+
}
|
|
30234
30639
|
function convertToPixels(value) {
|
|
30235
30640
|
if (typeof value === "number") return value;
|
|
30236
30641
|
if (!value || typeof value !== "string") return 0;
|
|
@@ -30275,9 +30680,13 @@ function pictNodeTypeStrategy(node) {
|
|
|
30275
30680
|
if (textbox) {
|
|
30276
30681
|
return { type: "shapeContainer", handler: handleShapeTextboxImport };
|
|
30277
30682
|
}
|
|
30683
|
+
const textpath = shape.elements?.find((el) => el.name === "v:textpath");
|
|
30684
|
+
if (textpath) {
|
|
30685
|
+
return { type: "image", handler: handleShapeTextWatermarkImport };
|
|
30686
|
+
}
|
|
30278
30687
|
const imagedata = shape.elements?.find((el) => el.name === "v:imagedata");
|
|
30279
30688
|
if (imagedata) {
|
|
30280
|
-
return { type: "image", handler:
|
|
30689
|
+
return { type: "image", handler: handleShapeImageWatermarkImport };
|
|
30281
30690
|
}
|
|
30282
30691
|
}
|
|
30283
30692
|
return { type: "unknown", handler: null };
|
|
@@ -30336,7 +30745,7 @@ function translateContentBlock(params) {
|
|
|
30336
30745
|
if (vmlAttributes || horizontalRule) {
|
|
30337
30746
|
return translateVRectContentBlock(params);
|
|
30338
30747
|
}
|
|
30339
|
-
const alternateContent = translator$
|
|
30748
|
+
const alternateContent = translator$1O.decode(params);
|
|
30340
30749
|
return wrapTextInRun(alternateContent);
|
|
30341
30750
|
}
|
|
30342
30751
|
function translateVRectContentBlock(params) {
|
|
@@ -30377,7 +30786,7 @@ function translateVRectContentBlock(params) {
|
|
|
30377
30786
|
};
|
|
30378
30787
|
return wrapTextInRun(pict);
|
|
30379
30788
|
}
|
|
30380
|
-
function
|
|
30789
|
+
function translateImageWatermark(params) {
|
|
30381
30790
|
const { node } = params;
|
|
30382
30791
|
const { attrs } = node;
|
|
30383
30792
|
if (attrs.vmlAttributes && attrs.vmlImagedata) {
|
|
@@ -30407,7 +30816,7 @@ function translateVmlWatermark(params) {
|
|
|
30407
30816
|
};
|
|
30408
30817
|
return par2;
|
|
30409
30818
|
}
|
|
30410
|
-
const style = buildVmlStyle(attrs);
|
|
30819
|
+
const style = buildVmlStyle$1(attrs);
|
|
30411
30820
|
const shape = {
|
|
30412
30821
|
name: "v:shape",
|
|
30413
30822
|
attributes: {
|
|
@@ -30442,23 +30851,23 @@ function translateVmlWatermark(params) {
|
|
|
30442
30851
|
};
|
|
30443
30852
|
return par;
|
|
30444
30853
|
}
|
|
30445
|
-
function buildVmlStyle(attrs) {
|
|
30854
|
+
function buildVmlStyle$1(attrs) {
|
|
30446
30855
|
const styles = [];
|
|
30447
30856
|
styles.push("position:absolute");
|
|
30448
30857
|
if (attrs.size) {
|
|
30449
30858
|
if (attrs.size.width) {
|
|
30450
|
-
styles.push(`width:${convertToPt(attrs.size.width)}pt`);
|
|
30859
|
+
styles.push(`width:${convertToPt$1(attrs.size.width)}pt`);
|
|
30451
30860
|
}
|
|
30452
30861
|
if (attrs.size.height) {
|
|
30453
|
-
styles.push(`height:${convertToPt(attrs.size.height)}pt`);
|
|
30862
|
+
styles.push(`height:${convertToPt$1(attrs.size.height)}pt`);
|
|
30454
30863
|
}
|
|
30455
30864
|
}
|
|
30456
30865
|
if (attrs.marginOffset) {
|
|
30457
30866
|
if (attrs.marginOffset.horizontal !== void 0) {
|
|
30458
|
-
styles.push(`margin-left:${convertToPt(attrs.marginOffset.horizontal)}pt`);
|
|
30867
|
+
styles.push(`margin-left:${convertToPt$1(attrs.marginOffset.horizontal)}pt`);
|
|
30459
30868
|
}
|
|
30460
30869
|
if (attrs.marginOffset.top !== void 0) {
|
|
30461
|
-
styles.push(`margin-top:${convertToPt(attrs.marginOffset.top)}pt`);
|
|
30870
|
+
styles.push(`margin-top:${convertToPt$1(attrs.marginOffset.top)}pt`);
|
|
30462
30871
|
}
|
|
30463
30872
|
}
|
|
30464
30873
|
if (attrs.wrap?.attrs?.behindDoc) {
|
|
@@ -30482,9 +30891,215 @@ function buildVmlStyle(attrs) {
|
|
|
30482
30891
|
styles.push("mso-height-percent:0");
|
|
30483
30892
|
return styles.join(";");
|
|
30484
30893
|
}
|
|
30485
|
-
function convertToPt(pixels) {
|
|
30894
|
+
function convertToPt$1(pixels) {
|
|
30486
30895
|
return pixels * 72 / 96;
|
|
30487
30896
|
}
|
|
30897
|
+
function translateTextWatermark(params) {
|
|
30898
|
+
const { node } = params;
|
|
30899
|
+
const { attrs } = node;
|
|
30900
|
+
const text = attrs.textWatermarkData?.text || attrs.vmlTextpathAttributes?.string || "";
|
|
30901
|
+
if (attrs.vmlAttributes && attrs.vmlTextpathAttributes) {
|
|
30902
|
+
const shapeElements2 = [];
|
|
30903
|
+
if (attrs.vmlPathAttributes) {
|
|
30904
|
+
shapeElements2.push({
|
|
30905
|
+
name: "v:path",
|
|
30906
|
+
attributes: attrs.vmlPathAttributes
|
|
30907
|
+
});
|
|
30908
|
+
}
|
|
30909
|
+
shapeElements2.push({
|
|
30910
|
+
name: "v:textpath",
|
|
30911
|
+
attributes: {
|
|
30912
|
+
...attrs.vmlTextpathAttributes,
|
|
30913
|
+
string: text
|
|
30914
|
+
}
|
|
30915
|
+
});
|
|
30916
|
+
if (attrs.vmlFillAttributes && Object.keys(attrs.vmlFillAttributes).length > 0) {
|
|
30917
|
+
shapeElements2.push({
|
|
30918
|
+
name: "v:fill",
|
|
30919
|
+
attributes: attrs.vmlFillAttributes
|
|
30920
|
+
});
|
|
30921
|
+
}
|
|
30922
|
+
if (attrs.vmlStrokeAttributes && Object.keys(attrs.vmlStrokeAttributes).length > 0) {
|
|
30923
|
+
shapeElements2.push({
|
|
30924
|
+
name: "v:stroke",
|
|
30925
|
+
attributes: attrs.vmlStrokeAttributes
|
|
30926
|
+
});
|
|
30927
|
+
}
|
|
30928
|
+
if (attrs.vmlWrapAttributes) {
|
|
30929
|
+
shapeElements2.push({
|
|
30930
|
+
name: "w10:wrap",
|
|
30931
|
+
attributes: attrs.vmlWrapAttributes
|
|
30932
|
+
});
|
|
30933
|
+
}
|
|
30934
|
+
const shape2 = {
|
|
30935
|
+
name: "v:shape",
|
|
30936
|
+
attributes: attrs.vmlAttributes,
|
|
30937
|
+
elements: shapeElements2
|
|
30938
|
+
};
|
|
30939
|
+
const pict2 = {
|
|
30940
|
+
name: "w:pict",
|
|
30941
|
+
elements: [shape2]
|
|
30942
|
+
};
|
|
30943
|
+
const par2 = {
|
|
30944
|
+
name: "w:p",
|
|
30945
|
+
elements: [wrapTextInRun(pict2)]
|
|
30946
|
+
};
|
|
30947
|
+
return par2;
|
|
30948
|
+
}
|
|
30949
|
+
const wmData = attrs.textWatermarkData || {};
|
|
30950
|
+
const style = buildVmlStyle(attrs, wmData);
|
|
30951
|
+
const textpathStyle = buildTextpathStyle(wmData);
|
|
30952
|
+
const shapeElements = [];
|
|
30953
|
+
shapeElements.push({
|
|
30954
|
+
name: "v:path",
|
|
30955
|
+
attributes: {
|
|
30956
|
+
textpathok: "t"
|
|
30957
|
+
}
|
|
30958
|
+
});
|
|
30959
|
+
shapeElements.push({
|
|
30960
|
+
name: "v:textpath",
|
|
30961
|
+
attributes: {
|
|
30962
|
+
on: "t",
|
|
30963
|
+
fitshape: "t",
|
|
30964
|
+
string: text,
|
|
30965
|
+
style: textpathStyle,
|
|
30966
|
+
...wmData.textpath?.trim !== void 0 && { trim: wmData.textpath.trim ? "t" : "f" }
|
|
30967
|
+
}
|
|
30968
|
+
});
|
|
30969
|
+
const fillAttrs = {};
|
|
30970
|
+
const fill = wmData.fill || attrs.fill;
|
|
30971
|
+
if (fill) {
|
|
30972
|
+
if (fill.type) fillAttrs.type = fill.type;
|
|
30973
|
+
if (fill.color2) fillAttrs.color2 = fill.color2;
|
|
30974
|
+
if (fill.opacity !== void 0) fillAttrs.opacity = fill.opacity.toString();
|
|
30975
|
+
if (fill.detectmouseclick !== void 0) {
|
|
30976
|
+
fillAttrs["o:detectmouseclick"] = fill.detectmouseclick ? "t" : "f";
|
|
30977
|
+
}
|
|
30978
|
+
}
|
|
30979
|
+
if (Object.keys(fillAttrs).length > 0) {
|
|
30980
|
+
shapeElements.push({
|
|
30981
|
+
name: "v:fill",
|
|
30982
|
+
attributes: fillAttrs
|
|
30983
|
+
});
|
|
30984
|
+
}
|
|
30985
|
+
const stroke = wmData.stroke || attrs.stroke;
|
|
30986
|
+
if (stroke && stroke.enabled !== false) {
|
|
30987
|
+
const strokeAttrs = {};
|
|
30988
|
+
if (stroke.color) strokeAttrs.color = stroke.color;
|
|
30989
|
+
if (stroke.joinstyle) strokeAttrs.joinstyle = stroke.joinstyle;
|
|
30990
|
+
if (stroke.endcap) strokeAttrs.endcap = stroke.endcap;
|
|
30991
|
+
if (Object.keys(strokeAttrs).length > 0) {
|
|
30992
|
+
shapeElements.push({
|
|
30993
|
+
name: "v:stroke",
|
|
30994
|
+
attributes: strokeAttrs
|
|
30995
|
+
});
|
|
30996
|
+
}
|
|
30997
|
+
}
|
|
30998
|
+
shapeElements.push({
|
|
30999
|
+
name: "w10:wrap",
|
|
31000
|
+
attributes: {
|
|
31001
|
+
type: attrs.wrap?.type?.toLowerCase() || "none"
|
|
31002
|
+
}
|
|
31003
|
+
});
|
|
31004
|
+
const shape = {
|
|
31005
|
+
name: "v:shape",
|
|
31006
|
+
attributes: {
|
|
31007
|
+
id: `PowerPlusWaterMarkObject${generateRandomSigned32BitIntStrId().replace("-", "")}`,
|
|
31008
|
+
"o:spid": `shape_${Math.floor(Math.random() * 1e4)}`,
|
|
31009
|
+
type: "#_x0000_t136",
|
|
31010
|
+
style,
|
|
31011
|
+
fillcolor: fill?.color || "silver",
|
|
31012
|
+
stroked: stroke?.enabled !== false ? "t" : "f",
|
|
31013
|
+
"o:allowincell": "f",
|
|
31014
|
+
...attrs.vmlAttributes?.adj && { adj: attrs.vmlAttributes.adj }
|
|
31015
|
+
},
|
|
31016
|
+
elements: shapeElements
|
|
31017
|
+
};
|
|
31018
|
+
const pict = {
|
|
31019
|
+
name: "w:pict",
|
|
31020
|
+
elements: [shape]
|
|
31021
|
+
};
|
|
31022
|
+
const par = {
|
|
31023
|
+
name: "w:p",
|
|
31024
|
+
elements: [wrapTextInRun(pict)]
|
|
31025
|
+
};
|
|
31026
|
+
return par;
|
|
31027
|
+
}
|
|
31028
|
+
function buildVmlStyle(attrs, wmData) {
|
|
31029
|
+
const styles = [];
|
|
31030
|
+
styles.push("position:absolute");
|
|
31031
|
+
if (attrs.marginOffset) {
|
|
31032
|
+
if (attrs.marginOffset.horizontal !== void 0) {
|
|
31033
|
+
styles.push(`margin-left:${convertToPt(attrs.marginOffset.horizontal)}pt`);
|
|
31034
|
+
}
|
|
31035
|
+
if (attrs.marginOffset.top !== void 0) {
|
|
31036
|
+
styles.push(`margin-top:${convertToPt(attrs.marginOffset.top)}pt`);
|
|
31037
|
+
}
|
|
31038
|
+
} else {
|
|
31039
|
+
styles.push("margin-left:0.05pt");
|
|
31040
|
+
styles.push("margin-top:315.7pt");
|
|
31041
|
+
}
|
|
31042
|
+
if (attrs.size) {
|
|
31043
|
+
if (attrs.size.width) {
|
|
31044
|
+
styles.push(`width:${convertToPt(attrs.size.width)}pt`);
|
|
31045
|
+
}
|
|
31046
|
+
if (attrs.size.height) {
|
|
31047
|
+
styles.push(`height:${convertToPt(attrs.size.height)}pt`);
|
|
31048
|
+
}
|
|
31049
|
+
}
|
|
31050
|
+
const wrapType = attrs.wrap?.type;
|
|
31051
|
+
let msoWrapStyle = "none";
|
|
31052
|
+
if (wrapType) {
|
|
31053
|
+
const wrapTypeLower = wrapType.toLowerCase();
|
|
31054
|
+
if (wrapTypeLower === "topandbottom") {
|
|
31055
|
+
msoWrapStyle = "top-and-bottom";
|
|
31056
|
+
} else if (["square", "tight", "through"].includes(wrapTypeLower)) {
|
|
31057
|
+
msoWrapStyle = wrapTypeLower;
|
|
31058
|
+
}
|
|
31059
|
+
}
|
|
31060
|
+
styles.push(`mso-wrap-style:${msoWrapStyle}`);
|
|
31061
|
+
const textAnchor = wmData.textStyle?.textAnchor || attrs.textStyle?.textAnchor;
|
|
31062
|
+
if (textAnchor) {
|
|
31063
|
+
styles.push(`v-text-anchor:${textAnchor}`);
|
|
31064
|
+
}
|
|
31065
|
+
const rotation = wmData.rotation || attrs.rotation;
|
|
31066
|
+
if (rotation !== void 0 && rotation !== 0) {
|
|
31067
|
+
styles.push(`rotation:${rotation}`);
|
|
31068
|
+
}
|
|
31069
|
+
if (attrs.anchorData) {
|
|
31070
|
+
if (attrs.anchorData.alignH) {
|
|
31071
|
+
styles.push(`mso-position-horizontal:${attrs.anchorData.alignH}`);
|
|
31072
|
+
}
|
|
31073
|
+
if (attrs.anchorData.alignV) {
|
|
31074
|
+
styles.push(`mso-position-vertical:${attrs.anchorData.alignV}`);
|
|
31075
|
+
}
|
|
31076
|
+
if (attrs.anchorData.hRelativeFrom) {
|
|
31077
|
+
styles.push(`mso-position-horizontal-relative:${attrs.anchorData.hRelativeFrom}`);
|
|
31078
|
+
}
|
|
31079
|
+
if (attrs.anchorData.vRelativeFrom) {
|
|
31080
|
+
styles.push(`mso-position-vertical-relative:${attrs.anchorData.vRelativeFrom}`);
|
|
31081
|
+
}
|
|
31082
|
+
}
|
|
31083
|
+
return styles.join(";");
|
|
31084
|
+
}
|
|
31085
|
+
function buildTextpathStyle(wmData) {
|
|
31086
|
+
const styles = [];
|
|
31087
|
+
if (wmData.textStyle) {
|
|
31088
|
+
if (wmData.textStyle.fontFamily) {
|
|
31089
|
+
styles.push(`font-family:"${wmData.textStyle.fontFamily}"`);
|
|
31090
|
+
}
|
|
31091
|
+
if (wmData.textStyle.fontSize) {
|
|
31092
|
+
styles.push(`font-size:${wmData.textStyle.fontSize}`);
|
|
31093
|
+
}
|
|
31094
|
+
}
|
|
31095
|
+
return styles.join(";");
|
|
31096
|
+
}
|
|
31097
|
+
function convertToPt(pixels) {
|
|
31098
|
+
if (typeof pixels === "number") {
|
|
31099
|
+
return pixels * 72 / 96;
|
|
31100
|
+
}
|
|
31101
|
+
return parseFloat(pixels) || 0;
|
|
31102
|
+
}
|
|
30488
31103
|
const XML_NODE_NAME = "w:pict";
|
|
30489
31104
|
const SD_NODE_NAME = ["shapeContainer", "contentBlock", "image"];
|
|
30490
31105
|
const validXmlAttributes = [];
|
|
@@ -30512,7 +31127,10 @@ function decode(params) {
|
|
|
30512
31127
|
contentBlock: () => translateContentBlock(params),
|
|
30513
31128
|
image: () => {
|
|
30514
31129
|
if (node.attrs?.vmlWatermark) {
|
|
30515
|
-
|
|
31130
|
+
if (node.attrs?.vmlTextWatermark) {
|
|
31131
|
+
return translateTextWatermark(params);
|
|
31132
|
+
}
|
|
31133
|
+
return translateImageWatermark(params);
|
|
30516
31134
|
}
|
|
30517
31135
|
return null;
|
|
30518
31136
|
},
|
|
@@ -30594,19 +31212,19 @@ function exportSchemaToJson(params) {
|
|
|
30594
31212
|
doc: translateDocumentNode,
|
|
30595
31213
|
body: translateBodyNode,
|
|
30596
31214
|
heading: translateHeadingNode,
|
|
30597
|
-
paragraph: translator$
|
|
30598
|
-
run: translator$
|
|
31215
|
+
paragraph: translator$14,
|
|
31216
|
+
run: translator$12,
|
|
30599
31217
|
text: translator$1,
|
|
30600
|
-
lineBreak: translator$
|
|
31218
|
+
lineBreak: translator$2s,
|
|
30601
31219
|
table: translator$b,
|
|
30602
|
-
tableRow: translator$
|
|
30603
|
-
tableCell: translator$
|
|
31220
|
+
tableRow: translator$x,
|
|
31221
|
+
tableCell: translator$J,
|
|
30604
31222
|
bookmarkStart: translator$a,
|
|
30605
31223
|
bookmarkEnd: translator$9,
|
|
30606
|
-
fieldAnnotation: translator$
|
|
30607
|
-
tab: translator$
|
|
30608
|
-
image: translator$
|
|
30609
|
-
hardBreak: translator$
|
|
31224
|
+
fieldAnnotation: translator$t,
|
|
31225
|
+
tab: translator$2q,
|
|
31226
|
+
image: translator$u,
|
|
31227
|
+
hardBreak: translator$2s,
|
|
30610
31228
|
commentRangeStart: commentRangeStartTranslator,
|
|
30611
31229
|
commentRangeEnd: commentRangeEndTranslator,
|
|
30612
31230
|
permStart: translator$8,
|
|
@@ -30617,10 +31235,10 @@ function exportSchemaToJson(params) {
|
|
|
30617
31235
|
contentBlock: translator,
|
|
30618
31236
|
vectorShape: translateVectorShape,
|
|
30619
31237
|
shapeGroup: translateShapeGroup,
|
|
30620
|
-
structuredContent: translator$
|
|
30621
|
-
structuredContentBlock: translator$
|
|
30622
|
-
documentPartObject: translator$
|
|
30623
|
-
documentSection: translator$
|
|
31238
|
+
structuredContent: translator$t,
|
|
31239
|
+
structuredContentBlock: translator$t,
|
|
31240
|
+
documentPartObject: translator$t,
|
|
31241
|
+
documentSection: translator$t,
|
|
30624
31242
|
"page-number": translator$4,
|
|
30625
31243
|
"total-page-number": translator$3,
|
|
30626
31244
|
pageReference: translator$6,
|
|
@@ -30705,7 +31323,7 @@ function translateHeadingNode(params) {
|
|
|
30705
31323
|
// Maps to Heading1, Heading2, etc. in Word
|
|
30706
31324
|
}
|
|
30707
31325
|
};
|
|
30708
|
-
return translator$
|
|
31326
|
+
return translator$14.decode({ ...params, node: paragraphNode });
|
|
30709
31327
|
}
|
|
30710
31328
|
function translateDocumentNode(params) {
|
|
30711
31329
|
const bodyNode = {
|
|
@@ -30774,7 +31392,7 @@ function translateMark(mark) {
|
|
|
30774
31392
|
markElement.type = "element";
|
|
30775
31393
|
break;
|
|
30776
31394
|
case "underline": {
|
|
30777
|
-
const translated = translator$
|
|
31395
|
+
const translated = translator$2l.decode({
|
|
30778
31396
|
node: {
|
|
30779
31397
|
attrs: {
|
|
30780
31398
|
underlineType: attrs.underlineType ?? attrs.underline ?? null,
|
|
@@ -30838,7 +31456,7 @@ function translateMark(mark) {
|
|
|
30838
31456
|
break;
|
|
30839
31457
|
case "highlight": {
|
|
30840
31458
|
const highlightValue = attrs.color ?? attrs.highlight ?? null;
|
|
30841
|
-
const translated = translator$
|
|
31459
|
+
const translated = translator$2r.decode({ node: { attrs: { highlight: highlightValue } } });
|
|
30842
31460
|
return translated || {};
|
|
30843
31461
|
}
|
|
30844
31462
|
case "strike":
|
|
@@ -30972,7 +31590,7 @@ const prepareCommentParaIds = (comment) => {
|
|
|
30972
31590
|
return newComment;
|
|
30973
31591
|
};
|
|
30974
31592
|
const getCommentDefinition = (comment, commentId, allComments, editor) => {
|
|
30975
|
-
const translatedText = translator$
|
|
31593
|
+
const translatedText = translator$14.decode({ editor, node: comment.commentJSON });
|
|
30976
31594
|
const attributes = {
|
|
30977
31595
|
"w:id": String(commentId),
|
|
30978
31596
|
"w:author": comment.creatorName || comment.importedAuthor?.name,
|
|
@@ -31657,7 +32275,7 @@ class SuperConverter {
|
|
|
31657
32275
|
static getStoredSuperdocVersion(docx) {
|
|
31658
32276
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
31659
32277
|
}
|
|
31660
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.5.0-next.
|
|
32278
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.5.0-next.8") {
|
|
31661
32279
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
31662
32280
|
}
|
|
31663
32281
|
/**
|
|
@@ -32332,8 +32950,8 @@ export {
|
|
|
32332
32950
|
SelectionRange as Z,
|
|
32333
32951
|
Transform as _,
|
|
32334
32952
|
createDocFromHTML as a,
|
|
32335
|
-
translator$
|
|
32336
|
-
translator$
|
|
32953
|
+
translator$1P as a0,
|
|
32954
|
+
translator$15 as a1,
|
|
32337
32955
|
resolveDocxFontFamily as a2,
|
|
32338
32956
|
combineIndentProperties as a3,
|
|
32339
32957
|
_getReferencedTableStyles as a4,
|