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