@harbour-enterprises/superdoc 0.19.0-next.3 → 0.19.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-e5Sqf3uK.es.js → PdfViewer-C2898kqZ.es.js} +1 -1
- package/dist/chunks/{PdfViewer-BXpR6HYz.cjs → PdfViewer-DaZtoNpm.cjs} +1 -1
- package/dist/chunks/{index-Bgbca9Qo.es.js → index-CkJ5hnvC.es.js} +107 -7
- package/dist/chunks/{index-Dg8DEGbE.cjs → index-Di9R4Aas.cjs} +107 -7
- package/dist/chunks/{super-editor.es-BbN2QJLe.cjs → super-editor.es-DG-S6GN9.cjs} +503 -208
- package/dist/chunks/{super-editor.es-Dga1v3zZ.es.js → super-editor.es-kuaVTS8t.es.js} +503 -208
- package/dist/core/SuperDoc.d.ts +6 -6
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/helpers/file.d.ts +44 -0
- package/dist/core/helpers/file.d.ts.map +1 -0
- package/dist/stores/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +9 -9
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CMajoq-M.js → converter-CrJvpQ8J.js} +456 -203
- package/dist/super-editor/chunks/{docx-zipper-C5rg6GNf.js → docx-zipper-CHHaFCfj.js} +1 -1
- package/dist/super-editor/chunks/{editor-CH3sE8Fq.js → editor-DlzGbfD-.js} +45 -3
- package/dist/super-editor/chunks/{toolbar-BHnLBr61.js → toolbar-DeKOVf4h.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/Editor.d.ts +3 -3
- package/dist/super-editor/src/core/super-converter/exporter.d.ts +0 -7
- package/dist/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +0 -22
- package/dist/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +37 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/cantSplit/cantSplit-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/cantSplit/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/cnfStyle/cnfStyle-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/cnfStyle/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/divId/divId-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/divId/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridAfter/gridAfter-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridAfter/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridBefore/gridBefore-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridBefore/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/hidden/hidden-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/hidden/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/jc/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/jc/jc-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellSpacing/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellSpacing/tblCellSpacing-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblHeader/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblHeader/tblHeader-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tr/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tr/tr-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/trHeight/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/trHeight/trHeight-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/trPr/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/trPr/trPr-translator.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/wAfter/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/wAfter/wAfter-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/wBefore/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/wBefore/wBefore-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -1
- package/dist/super-editor/src/extensions/table-row/table-row.d.ts +149 -0
- package/dist/super-editor/style.css +6 -6
- package/dist/super-editor/super-editor.es.js +8 -8
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +608 -213
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/superdoc.umd.js
CHANGED
|
@@ -33336,37 +33336,37 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33336
33336
|
};
|
|
33337
33337
|
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
33338
33338
|
let NodeTranslator = _NodeTranslator;
|
|
33339
|
-
const encode$
|
|
33339
|
+
const encode$i = (attributes) => {
|
|
33340
33340
|
return attributes["w:type"];
|
|
33341
33341
|
};
|
|
33342
|
-
const decode$
|
|
33342
|
+
const decode$i = (attrs) => {
|
|
33343
33343
|
const { lineBreakType } = attrs;
|
|
33344
33344
|
return lineBreakType;
|
|
33345
33345
|
};
|
|
33346
33346
|
const attrConfig$b = Object.freeze({
|
|
33347
33347
|
xmlName: "w:type",
|
|
33348
33348
|
sdName: "lineBreakType",
|
|
33349
|
-
encode: encode$
|
|
33350
|
-
decode: decode$
|
|
33349
|
+
encode: encode$i,
|
|
33350
|
+
decode: decode$i
|
|
33351
33351
|
});
|
|
33352
|
-
const encode$
|
|
33352
|
+
const encode$h = (attributes) => {
|
|
33353
33353
|
const xmlAttrValue = attributes["w:clear"];
|
|
33354
33354
|
return xmlAttrValue;
|
|
33355
33355
|
};
|
|
33356
|
-
const decode$
|
|
33356
|
+
const decode$h = (attrs) => {
|
|
33357
33357
|
const { clear } = attrs;
|
|
33358
33358
|
return clear;
|
|
33359
33359
|
};
|
|
33360
33360
|
const attrConfig$a = Object.freeze({
|
|
33361
33361
|
xmlName: "w:clear",
|
|
33362
33362
|
sdName: "clear",
|
|
33363
|
-
encode: encode$
|
|
33364
|
-
decode: decode$
|
|
33363
|
+
encode: encode$h,
|
|
33364
|
+
decode: decode$h
|
|
33365
33365
|
});
|
|
33366
|
-
const validXmlAttributes$
|
|
33367
|
-
const XML_NODE_NAME$
|
|
33368
|
-
const SD_NODE_NAME$
|
|
33369
|
-
const encode$
|
|
33366
|
+
const validXmlAttributes$5 = [attrConfig$b, attrConfig$a];
|
|
33367
|
+
const XML_NODE_NAME$6 = "w:br";
|
|
33368
|
+
const SD_NODE_NAME$5 = "lineBreak";
|
|
33369
|
+
const encode$g = (_2, encodedAttrs) => {
|
|
33370
33370
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
33371
33371
|
const translated = {
|
|
33372
33372
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -33376,7 +33376,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33376
33376
|
}
|
|
33377
33377
|
return translated;
|
|
33378
33378
|
};
|
|
33379
|
-
const decode$
|
|
33379
|
+
const decode$g = (params2, decodedAttrs) => {
|
|
33380
33380
|
const { node: node2 } = params2;
|
|
33381
33381
|
if (!node2) return;
|
|
33382
33382
|
const wBreak = { name: "w:br" };
|
|
@@ -33393,63 +33393,63 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33393
33393
|
};
|
|
33394
33394
|
return translated;
|
|
33395
33395
|
};
|
|
33396
|
-
const config$
|
|
33397
|
-
xmlName: XML_NODE_NAME$
|
|
33398
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
33396
|
+
const config$6 = {
|
|
33397
|
+
xmlName: XML_NODE_NAME$6,
|
|
33398
|
+
sdNodeOrKeyName: SD_NODE_NAME$5,
|
|
33399
33399
|
type: NodeTranslator.translatorTypes.NODE,
|
|
33400
|
-
encode: encode$
|
|
33401
|
-
decode: decode$
|
|
33402
|
-
attributes: validXmlAttributes$
|
|
33400
|
+
encode: encode$g,
|
|
33401
|
+
decode: decode$g,
|
|
33402
|
+
attributes: validXmlAttributes$5
|
|
33403
33403
|
};
|
|
33404
|
-
const translator$
|
|
33405
|
-
const encode$
|
|
33404
|
+
const translator$i = NodeTranslator.from(config$6);
|
|
33405
|
+
const encode$f = (attributes) => {
|
|
33406
33406
|
return attributes["w:val"];
|
|
33407
33407
|
};
|
|
33408
|
-
const decode$
|
|
33408
|
+
const decode$f = (attrs) => {
|
|
33409
33409
|
const { tabSize } = attrs || {};
|
|
33410
33410
|
return tabSize;
|
|
33411
33411
|
};
|
|
33412
33412
|
const attrConfig$9 = Object.freeze({
|
|
33413
33413
|
xmlName: "w:val",
|
|
33414
33414
|
sdName: "tabSize",
|
|
33415
|
-
encode: encode$
|
|
33416
|
-
decode: decode$
|
|
33415
|
+
encode: encode$f,
|
|
33416
|
+
decode: decode$f
|
|
33417
33417
|
});
|
|
33418
|
-
const encode$
|
|
33418
|
+
const encode$e = (attributes) => {
|
|
33419
33419
|
return attributes["w:leader"];
|
|
33420
33420
|
};
|
|
33421
|
-
const decode$
|
|
33421
|
+
const decode$e = (attrs) => {
|
|
33422
33422
|
const { leader } = attrs || {};
|
|
33423
33423
|
return leader;
|
|
33424
33424
|
};
|
|
33425
33425
|
const attrConfig$8 = Object.freeze({
|
|
33426
33426
|
xmlName: "w:leader",
|
|
33427
33427
|
sdName: "leader",
|
|
33428
|
-
encode: encode$
|
|
33429
|
-
decode: decode$
|
|
33428
|
+
encode: encode$e,
|
|
33429
|
+
decode: decode$e
|
|
33430
33430
|
});
|
|
33431
|
-
const encode$
|
|
33431
|
+
const encode$d = (attributes) => {
|
|
33432
33432
|
return attributes["w:pos"];
|
|
33433
33433
|
};
|
|
33434
|
-
const decode$
|
|
33434
|
+
const decode$d = (attrs) => {
|
|
33435
33435
|
const { pos } = attrs || {};
|
|
33436
33436
|
return pos;
|
|
33437
33437
|
};
|
|
33438
33438
|
const attrConfig$7 = Object.freeze({
|
|
33439
33439
|
xmlName: "w:pos",
|
|
33440
33440
|
sdName: "pos",
|
|
33441
|
-
encode: encode$
|
|
33442
|
-
decode: decode$
|
|
33441
|
+
encode: encode$d,
|
|
33442
|
+
decode: decode$d
|
|
33443
33443
|
});
|
|
33444
|
-
const validXmlAttributes$
|
|
33445
|
-
const XML_NODE_NAME$
|
|
33446
|
-
const SD_NODE_NAME$
|
|
33447
|
-
const encode$
|
|
33444
|
+
const validXmlAttributes$4 = [attrConfig$9, attrConfig$7, attrConfig$8];
|
|
33445
|
+
const XML_NODE_NAME$5 = "w:tab";
|
|
33446
|
+
const SD_NODE_NAME$4 = "tab";
|
|
33447
|
+
const encode$c = (_2, encodedAttrs = {}) => {
|
|
33448
33448
|
const translated = { type: "tab" };
|
|
33449
33449
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
33450
33450
|
return translated;
|
|
33451
33451
|
};
|
|
33452
|
-
const decode$
|
|
33452
|
+
const decode$c = (params2, decodedAttrs = {}) => {
|
|
33453
33453
|
const { node: node2 } = params2 || {};
|
|
33454
33454
|
if (!node2) return;
|
|
33455
33455
|
const wTab = { name: "w:tab" };
|
|
@@ -33465,15 +33465,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33465
33465
|
}
|
|
33466
33466
|
return translated;
|
|
33467
33467
|
};
|
|
33468
|
-
const config$
|
|
33469
|
-
xmlName: XML_NODE_NAME$
|
|
33470
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
33468
|
+
const config$5 = {
|
|
33469
|
+
xmlName: XML_NODE_NAME$5,
|
|
33470
|
+
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
33471
33471
|
type: NodeTranslator.translatorTypes.NODE,
|
|
33472
|
-
encode: encode$
|
|
33473
|
-
decode: decode$
|
|
33474
|
-
attributes: validXmlAttributes$
|
|
33472
|
+
encode: encode$c,
|
|
33473
|
+
decode: decode$c,
|
|
33474
|
+
attributes: validXmlAttributes$4
|
|
33475
33475
|
};
|
|
33476
|
-
const translator$
|
|
33476
|
+
const translator$h = NodeTranslator.from(config$5);
|
|
33477
33477
|
const mergeTextNodes = (nodes) => {
|
|
33478
33478
|
if (!nodes || !Array.isArray(nodes)) {
|
|
33479
33479
|
return nodes;
|
|
@@ -34043,91 +34043,91 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34043
34043
|
}
|
|
34044
34044
|
return schemaNode;
|
|
34045
34045
|
};
|
|
34046
|
-
const encode$
|
|
34046
|
+
const encode$b = (attributes) => {
|
|
34047
34047
|
return attributes["w:rsidDel"];
|
|
34048
34048
|
};
|
|
34049
|
-
const decode$
|
|
34049
|
+
const decode$b = (attrs) => {
|
|
34050
34050
|
return attrs.rsidDel;
|
|
34051
34051
|
};
|
|
34052
34052
|
const attrConfig$6 = Object.freeze({
|
|
34053
34053
|
xmlName: "w:rsidDel",
|
|
34054
34054
|
sdName: "rsidDel",
|
|
34055
|
-
encode: encode$
|
|
34056
|
-
decode: decode$
|
|
34055
|
+
encode: encode$b,
|
|
34056
|
+
decode: decode$b
|
|
34057
34057
|
});
|
|
34058
|
-
const encode$
|
|
34058
|
+
const encode$a = (attributes) => {
|
|
34059
34059
|
return attributes["w:rsidP"];
|
|
34060
34060
|
};
|
|
34061
|
-
const decode$
|
|
34061
|
+
const decode$a = (attrs) => {
|
|
34062
34062
|
return attrs.rsidP;
|
|
34063
34063
|
};
|
|
34064
34064
|
const attrConfig$5 = Object.freeze({
|
|
34065
34065
|
xmlName: "w:rsidP",
|
|
34066
34066
|
sdName: "rsidP",
|
|
34067
|
-
encode: encode$
|
|
34068
|
-
decode: decode$
|
|
34067
|
+
encode: encode$a,
|
|
34068
|
+
decode: decode$a
|
|
34069
34069
|
});
|
|
34070
|
-
const encode$
|
|
34070
|
+
const encode$9 = (attributes) => {
|
|
34071
34071
|
return attributes["w:rsidR"];
|
|
34072
34072
|
};
|
|
34073
|
-
const decode$
|
|
34073
|
+
const decode$9 = (attrs) => {
|
|
34074
34074
|
return attrs.rsidR;
|
|
34075
34075
|
};
|
|
34076
34076
|
const attrConfig$4 = Object.freeze({
|
|
34077
34077
|
xmlName: "w:rsidR",
|
|
34078
34078
|
sdName: "rsidR",
|
|
34079
|
-
encode: encode$
|
|
34080
|
-
decode: decode$
|
|
34079
|
+
encode: encode$9,
|
|
34080
|
+
decode: decode$9
|
|
34081
34081
|
});
|
|
34082
|
-
const encode$
|
|
34082
|
+
const encode$8 = (attributes) => {
|
|
34083
34083
|
return attributes["w:rsidRPr"];
|
|
34084
34084
|
};
|
|
34085
|
-
const decode$
|
|
34085
|
+
const decode$8 = (attrs) => {
|
|
34086
34086
|
return attrs.rsidRPr;
|
|
34087
34087
|
};
|
|
34088
34088
|
const attrConfig$3 = Object.freeze({
|
|
34089
34089
|
xmlName: "w:rsidRPr",
|
|
34090
34090
|
sdName: "rsidRPr",
|
|
34091
|
-
encode: encode$
|
|
34092
|
-
decode: decode$
|
|
34091
|
+
encode: encode$8,
|
|
34092
|
+
decode: decode$8
|
|
34093
34093
|
});
|
|
34094
|
-
const encode$
|
|
34094
|
+
const encode$7 = (attributes) => {
|
|
34095
34095
|
return attributes["w:rsidRDefault"];
|
|
34096
34096
|
};
|
|
34097
|
-
const decode$
|
|
34097
|
+
const decode$7 = (attrs) => {
|
|
34098
34098
|
return attrs.rsidRDefault;
|
|
34099
34099
|
};
|
|
34100
34100
|
const attrConfig$2 = Object.freeze({
|
|
34101
34101
|
xmlName: "w:rsidRDefault",
|
|
34102
34102
|
sdName: "rsidRDefault",
|
|
34103
|
-
encode: encode$
|
|
34104
|
-
decode: decode$
|
|
34103
|
+
encode: encode$7,
|
|
34104
|
+
decode: decode$7
|
|
34105
34105
|
});
|
|
34106
|
-
const encode$
|
|
34106
|
+
const encode$6 = (attributes) => {
|
|
34107
34107
|
return attributes["w14:paraId"];
|
|
34108
34108
|
};
|
|
34109
|
-
const decode$
|
|
34109
|
+
const decode$6 = (attrs) => {
|
|
34110
34110
|
return attrs.paraId;
|
|
34111
34111
|
};
|
|
34112
34112
|
const attrConfig$1 = Object.freeze({
|
|
34113
34113
|
xmlName: "w14:paraId",
|
|
34114
34114
|
sdName: "paraId",
|
|
34115
|
-
encode: encode$
|
|
34116
|
-
decode: decode$
|
|
34115
|
+
encode: encode$6,
|
|
34116
|
+
decode: decode$6
|
|
34117
34117
|
});
|
|
34118
|
-
const encode$
|
|
34118
|
+
const encode$5 = (attributes) => {
|
|
34119
34119
|
return attributes["w14:textId"];
|
|
34120
34120
|
};
|
|
34121
|
-
const decode$
|
|
34121
|
+
const decode$5 = (attrs) => {
|
|
34122
34122
|
return attrs.textId;
|
|
34123
34123
|
};
|
|
34124
34124
|
const attrConfig = Object.freeze({
|
|
34125
34125
|
xmlName: "w14:textId",
|
|
34126
34126
|
sdName: "textId",
|
|
34127
|
-
encode: encode$
|
|
34128
|
-
decode: decode$
|
|
34127
|
+
encode: encode$5,
|
|
34128
|
+
decode: decode$5
|
|
34129
34129
|
});
|
|
34130
|
-
const validXmlAttributes$
|
|
34130
|
+
const validXmlAttributes$3 = [
|
|
34131
34131
|
attrConfig$1,
|
|
34132
34132
|
attrConfig,
|
|
34133
34133
|
attrConfig$4,
|
|
@@ -34136,9 +34136,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34136
34136
|
attrConfig$3,
|
|
34137
34137
|
attrConfig$6
|
|
34138
34138
|
];
|
|
34139
|
-
const XML_NODE_NAME$
|
|
34140
|
-
const SD_NODE_NAME$
|
|
34141
|
-
const encode$
|
|
34139
|
+
const XML_NODE_NAME$4 = "w:p";
|
|
34140
|
+
const SD_NODE_NAME$3 = "paragraph";
|
|
34141
|
+
const encode$4 = (params2, encodedAttrs = {}) => {
|
|
34142
34142
|
const node2 = handleParagraphNode$1(params2);
|
|
34143
34143
|
if (!node2) return void 0;
|
|
34144
34144
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -34146,7 +34146,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34146
34146
|
}
|
|
34147
34147
|
return node2;
|
|
34148
34148
|
};
|
|
34149
|
-
const decode$
|
|
34149
|
+
const decode$4 = (params2, decodedAttrs = {}) => {
|
|
34150
34150
|
const translated = translateParagraphNode(params2);
|
|
34151
34151
|
if (!translated) return void 0;
|
|
34152
34152
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -34154,6 +34154,356 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34154
34154
|
}
|
|
34155
34155
|
return translated;
|
|
34156
34156
|
};
|
|
34157
|
+
const config$4 = {
|
|
34158
|
+
xmlName: XML_NODE_NAME$4,
|
|
34159
|
+
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
34160
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
34161
|
+
encode: encode$4,
|
|
34162
|
+
decode: decode$4,
|
|
34163
|
+
attributes: validXmlAttributes$3
|
|
34164
|
+
};
|
|
34165
|
+
const translator$g = NodeTranslator.from(config$4);
|
|
34166
|
+
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
34167
|
+
handlerName,
|
|
34168
|
+
handler: (params2) => {
|
|
34169
|
+
const { nodes } = params2;
|
|
34170
|
+
if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
|
|
34171
|
+
return { nodes: [], consumed: 0 };
|
|
34172
|
+
}
|
|
34173
|
+
const result = translator2.encode(params2);
|
|
34174
|
+
if (!result) return { nodes: [], consumed: 0 };
|
|
34175
|
+
return {
|
|
34176
|
+
nodes: Array.isArray(result) ? result : [result],
|
|
34177
|
+
consumed: 1
|
|
34178
|
+
};
|
|
34179
|
+
}
|
|
34180
|
+
});
|
|
34181
|
+
function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:val", transformEncode = null, transformDecode = null) {
|
|
34182
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
34183
|
+
if (!transformEncode) transformEncode = (v2) => v2;
|
|
34184
|
+
if (!transformDecode) transformDecode = (v2) => v2;
|
|
34185
|
+
return {
|
|
34186
|
+
xmlName,
|
|
34187
|
+
sdNodeOrKeyName: sdName,
|
|
34188
|
+
encode: ({ nodes }) => {
|
|
34189
|
+
return transformEncode(nodes[0].attributes[attrName]) ?? void 0;
|
|
34190
|
+
},
|
|
34191
|
+
decode: ({ node: node2 }) => {
|
|
34192
|
+
const value = node2.attrs?.[sdName] != null ? transformDecode(node2.attrs[sdName]) : void 0;
|
|
34193
|
+
return value != null ? { [attrName]: value } : void 0;
|
|
34194
|
+
}
|
|
34195
|
+
};
|
|
34196
|
+
}
|
|
34197
|
+
function createMeasurementPropertyHandler(xmlName, sdName = null) {
|
|
34198
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
34199
|
+
return {
|
|
34200
|
+
xmlName,
|
|
34201
|
+
sdNodeOrKeyName: sdName,
|
|
34202
|
+
attributes: [
|
|
34203
|
+
createAttributeHandler("w:w", "value", parseInteger, integerToString),
|
|
34204
|
+
createAttributeHandler("w:type")
|
|
34205
|
+
],
|
|
34206
|
+
encode: (_2, encodedAttrs) => {
|
|
34207
|
+
return encodedAttrs["value"] != null ? encodedAttrs : void 0;
|
|
34208
|
+
},
|
|
34209
|
+
decode: function({ node: node2 }, _2) {
|
|
34210
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node2, attrs: node2.attrs[sdName] || {} } });
|
|
34211
|
+
return decodedAttrs["w:w"] != null ? decodedAttrs : void 0;
|
|
34212
|
+
}
|
|
34213
|
+
};
|
|
34214
|
+
}
|
|
34215
|
+
const createAttributeHandler = (xmlName, sdName = null, transformEncode = null, transformDecode = null) => {
|
|
34216
|
+
if (!transformEncode) transformEncode = (v2) => v2;
|
|
34217
|
+
if (!transformDecode) transformDecode = (v2) => v2;
|
|
34218
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
34219
|
+
return {
|
|
34220
|
+
xmlName,
|
|
34221
|
+
sdName,
|
|
34222
|
+
encode: (attributes) => transformEncode(attributes[xmlName]),
|
|
34223
|
+
decode: (attributes) => transformDecode(attributes[sdName])
|
|
34224
|
+
};
|
|
34225
|
+
};
|
|
34226
|
+
function encodeProperties(node2, translatorsByXmlName, asArray = false) {
|
|
34227
|
+
let attributes = asArray ? [] : {};
|
|
34228
|
+
node2.elements.forEach((el) => {
|
|
34229
|
+
const translator2 = translatorsByXmlName[el.name];
|
|
34230
|
+
if (translator2) {
|
|
34231
|
+
const encodedAttr = translator2.encode({ nodes: [el] });
|
|
34232
|
+
if (encodedAttr != null) {
|
|
34233
|
+
if (asArray) {
|
|
34234
|
+
attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
|
|
34235
|
+
} else {
|
|
34236
|
+
attributes[translator2.sdNodeOrKeyName] = encodedAttr;
|
|
34237
|
+
}
|
|
34238
|
+
}
|
|
34239
|
+
}
|
|
34240
|
+
});
|
|
34241
|
+
return attributes;
|
|
34242
|
+
}
|
|
34243
|
+
function decodeProperties(translatorsBySdName, properties) {
|
|
34244
|
+
const elements = [];
|
|
34245
|
+
Object.keys(properties).forEach((key) => {
|
|
34246
|
+
const translator2 = translatorsBySdName[key];
|
|
34247
|
+
if (translator2) {
|
|
34248
|
+
const attributes = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
|
|
34249
|
+
if (attributes != null) {
|
|
34250
|
+
elements.push({ name: translator2.xmlName, attributes });
|
|
34251
|
+
}
|
|
34252
|
+
}
|
|
34253
|
+
});
|
|
34254
|
+
return elements;
|
|
34255
|
+
}
|
|
34256
|
+
const parseBoolean = (value) => ["1", "true"].includes(value);
|
|
34257
|
+
const parseInteger = (value) => {
|
|
34258
|
+
if (value == null) return void 0;
|
|
34259
|
+
const intValue = parseInt(value, 10);
|
|
34260
|
+
return isNaN(intValue) ? void 0 : intValue;
|
|
34261
|
+
};
|
|
34262
|
+
const integerToString = (value) => {
|
|
34263
|
+
const intValue = parseInteger(value);
|
|
34264
|
+
return intValue != void 0 ? String(intValue) : void 0;
|
|
34265
|
+
};
|
|
34266
|
+
const translator$f = NodeTranslator.from({
|
|
34267
|
+
xmlName: "w:cantSplit",
|
|
34268
|
+
sdNodeOrKeyName: "cantSplit",
|
|
34269
|
+
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34270
|
+
decode: ({ node: node2 }) => node2.attrs?.cantSplit ? {} : void 0
|
|
34271
|
+
});
|
|
34272
|
+
const translator$e = NodeTranslator.from({
|
|
34273
|
+
xmlName: "w:cnfStyle",
|
|
34274
|
+
sdNodeOrKeyName: "cnfStyle",
|
|
34275
|
+
attributes: [
|
|
34276
|
+
"w:evenHBand",
|
|
34277
|
+
"w:evenVBand",
|
|
34278
|
+
"w:firstColumn",
|
|
34279
|
+
"w:firstRow",
|
|
34280
|
+
"w:firstRowFirstColumn",
|
|
34281
|
+
"w:firstRowLastColumn",
|
|
34282
|
+
"w:lastColumn",
|
|
34283
|
+
"w:lastRow",
|
|
34284
|
+
"w:lastRowFirstColumn",
|
|
34285
|
+
"w:lastRowLastColumn",
|
|
34286
|
+
"w:oddHBand",
|
|
34287
|
+
"w:oddVBand",
|
|
34288
|
+
"w:val"
|
|
34289
|
+
].map((attr) => createAttributeHandler(attr)),
|
|
34290
|
+
encode: (_2, encodedAttrs) => {
|
|
34291
|
+
Object.keys(encodedAttrs).forEach((key) => {
|
|
34292
|
+
encodedAttrs[key] = ["1", "true"].includes(encodedAttrs[key]);
|
|
34293
|
+
});
|
|
34294
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
34295
|
+
},
|
|
34296
|
+
decode: ({ node: node2 }) => {
|
|
34297
|
+
if (!node2.attrs?.cnfStyle) return;
|
|
34298
|
+
const cnfStyleAttrs = {};
|
|
34299
|
+
Object.entries(node2.attrs.cnfStyle).forEach(([key, value]) => {
|
|
34300
|
+
cnfStyleAttrs[`w:${key}`] = value ? "1" : "0";
|
|
34301
|
+
});
|
|
34302
|
+
return Object.keys(cnfStyleAttrs).length > 0 ? cnfStyleAttrs : void 0;
|
|
34303
|
+
}
|
|
34304
|
+
});
|
|
34305
|
+
const translator$d = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
34306
|
+
const translator$c = NodeTranslator.from(
|
|
34307
|
+
createSingleAttrPropertyHandler(
|
|
34308
|
+
"w:gridAfter",
|
|
34309
|
+
null,
|
|
34310
|
+
"w:val",
|
|
34311
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
34312
|
+
(v2) => integerToString(v2)
|
|
34313
|
+
)
|
|
34314
|
+
);
|
|
34315
|
+
const translator$b = NodeTranslator.from(
|
|
34316
|
+
createSingleAttrPropertyHandler(
|
|
34317
|
+
"w:gridBefore",
|
|
34318
|
+
null,
|
|
34319
|
+
"w:val",
|
|
34320
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
34321
|
+
(v2) => integerToString(v2)
|
|
34322
|
+
)
|
|
34323
|
+
);
|
|
34324
|
+
const translator$a = NodeTranslator.from({
|
|
34325
|
+
xmlName: "w:hidden",
|
|
34326
|
+
sdNodeOrKeyName: "hidden",
|
|
34327
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34328
|
+
decode: ({ node: node2 }) => node2.attrs.hidden ? {} : void 0
|
|
34329
|
+
});
|
|
34330
|
+
const translator$9 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc"));
|
|
34331
|
+
const translator$8 = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "cellSpacing"));
|
|
34332
|
+
const translator$7 = NodeTranslator.from({
|
|
34333
|
+
xmlName: "w:tblHeader",
|
|
34334
|
+
sdNodeOrKeyName: "repeatHeader",
|
|
34335
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34336
|
+
decode: ({ node: node2 }) => node2.attrs.repeatHeader ? {} : void 0
|
|
34337
|
+
});
|
|
34338
|
+
const translator$6 = NodeTranslator.from({
|
|
34339
|
+
xmlName: "w:trHeight",
|
|
34340
|
+
sdNodeOrKeyName: "rowHeight",
|
|
34341
|
+
encode: ({ nodes }) => {
|
|
34342
|
+
const heightAttrs = {};
|
|
34343
|
+
const val = nodes[0].attributes["w:val"];
|
|
34344
|
+
if (val) {
|
|
34345
|
+
heightAttrs["value"] = parseInt(val, 10);
|
|
34346
|
+
}
|
|
34347
|
+
const rule = nodes[0].attributes["w:hRule"];
|
|
34348
|
+
if (rule) {
|
|
34349
|
+
heightAttrs["rule"] = rule;
|
|
34350
|
+
}
|
|
34351
|
+
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
34352
|
+
},
|
|
34353
|
+
decode: ({ node: node2 }) => {
|
|
34354
|
+
if (!node2.attrs?.rowHeight) return;
|
|
34355
|
+
const heightAttrs = {};
|
|
34356
|
+
if (typeof node2.attrs.rowHeight.value === "number" && !isNaN(node2.attrs.rowHeight.value)) {
|
|
34357
|
+
heightAttrs["w:val"] = String(node2.attrs.rowHeight.value);
|
|
34358
|
+
}
|
|
34359
|
+
if (node2.attrs.rowHeight.rule) {
|
|
34360
|
+
heightAttrs["w:hRule"] = node2.attrs.rowHeight.rule;
|
|
34361
|
+
}
|
|
34362
|
+
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
34363
|
+
}
|
|
34364
|
+
});
|
|
34365
|
+
const translator$5 = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
34366
|
+
const translator$4 = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
34367
|
+
const XML_NODE_NAME$3 = "w:trPr";
|
|
34368
|
+
const SD_ATTR_KEY = "tableRowProperties";
|
|
34369
|
+
const encode$3 = (params2) => {
|
|
34370
|
+
const { nodes } = params2;
|
|
34371
|
+
const node2 = nodes[0];
|
|
34372
|
+
let attributes = {
|
|
34373
|
+
cantSplit: false,
|
|
34374
|
+
hidden: false,
|
|
34375
|
+
repeatHeader: false
|
|
34376
|
+
};
|
|
34377
|
+
attributes = {
|
|
34378
|
+
...attributes,
|
|
34379
|
+
...encodeProperties(node2, propertyTranslatorsByXmlName)
|
|
34380
|
+
};
|
|
34381
|
+
return {
|
|
34382
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
34383
|
+
xmlName: XML_NODE_NAME$3,
|
|
34384
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
34385
|
+
attributes
|
|
34386
|
+
};
|
|
34387
|
+
};
|
|
34388
|
+
const decode$3 = (params2) => {
|
|
34389
|
+
const { tableRowProperties = {} } = params2.node.attrs || {};
|
|
34390
|
+
const elements = decodeProperties(propertyTranslatorsBySdName, tableRowProperties);
|
|
34391
|
+
const newNode = {
|
|
34392
|
+
name: "w:trPr",
|
|
34393
|
+
type: "element",
|
|
34394
|
+
attributes: {},
|
|
34395
|
+
elements
|
|
34396
|
+
};
|
|
34397
|
+
return newNode;
|
|
34398
|
+
};
|
|
34399
|
+
const propertyTranslators = [
|
|
34400
|
+
translator$f,
|
|
34401
|
+
translator$e,
|
|
34402
|
+
translator$d,
|
|
34403
|
+
translator$c,
|
|
34404
|
+
translator$b,
|
|
34405
|
+
translator$a,
|
|
34406
|
+
translator$9,
|
|
34407
|
+
translator$8,
|
|
34408
|
+
translator$7,
|
|
34409
|
+
translator$6,
|
|
34410
|
+
translator$5,
|
|
34411
|
+
translator$4
|
|
34412
|
+
];
|
|
34413
|
+
const propertyTranslatorsByXmlName = {};
|
|
34414
|
+
propertyTranslators.forEach((translator2) => {
|
|
34415
|
+
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
34416
|
+
});
|
|
34417
|
+
const propertyTranslatorsBySdName = {};
|
|
34418
|
+
propertyTranslators.forEach((translator2) => {
|
|
34419
|
+
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
34420
|
+
});
|
|
34421
|
+
const config$3 = {
|
|
34422
|
+
xmlName: XML_NODE_NAME$3,
|
|
34423
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
34424
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
34425
|
+
encode: encode$3,
|
|
34426
|
+
decode: decode$3
|
|
34427
|
+
};
|
|
34428
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
34429
|
+
const XML_NODE_NAME$2 = "w:tr";
|
|
34430
|
+
const SD_NODE_NAME$2 = "tableRow";
|
|
34431
|
+
const validXmlAttributes$2 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
34432
|
+
(xmlName) => createAttributeHandler(xmlName)
|
|
34433
|
+
);
|
|
34434
|
+
const encode$2 = (params2, encodedAttrs) => {
|
|
34435
|
+
const { row, table } = params2.extraParams;
|
|
34436
|
+
let tableRowProperties = {};
|
|
34437
|
+
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
34438
|
+
if (tPr) {
|
|
34439
|
+
({ attributes: tableRowProperties } = translator$3.encode({
|
|
34440
|
+
...params2,
|
|
34441
|
+
nodes: [tPr]
|
|
34442
|
+
}));
|
|
34443
|
+
}
|
|
34444
|
+
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
34445
|
+
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
34446
|
+
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
34447
|
+
const gridColumnWidths = _getGridColumnWidths(table);
|
|
34448
|
+
const cellNodes = row.elements.filter((el) => el.name === "w:tc");
|
|
34449
|
+
let currentColumnIndex = 0;
|
|
34450
|
+
const content = cellNodes?.map((n) => {
|
|
34451
|
+
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
34452
|
+
const result = translator$1.encode({
|
|
34453
|
+
...params2,
|
|
34454
|
+
extraParams: {
|
|
34455
|
+
...params2.extraParams,
|
|
34456
|
+
node: n,
|
|
34457
|
+
columnIndex: currentColumnIndex,
|
|
34458
|
+
columnWidth
|
|
34459
|
+
}
|
|
34460
|
+
});
|
|
34461
|
+
const tcPr = n.elements?.find((el) => el.name === "w:tcPr");
|
|
34462
|
+
const colspanTag = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
34463
|
+
const colspan = parseInt(colspanTag?.attributes["w:val"] || 1, 10);
|
|
34464
|
+
currentColumnIndex += colspan;
|
|
34465
|
+
return result;
|
|
34466
|
+
}) || [];
|
|
34467
|
+
const newNode = {
|
|
34468
|
+
type: "tableRow",
|
|
34469
|
+
content,
|
|
34470
|
+
attrs: encodedAttrs
|
|
34471
|
+
};
|
|
34472
|
+
return newNode;
|
|
34473
|
+
};
|
|
34474
|
+
const _getGridColumnWidths = (tableNode) => {
|
|
34475
|
+
const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
|
|
34476
|
+
if (!tblGrid) return [];
|
|
34477
|
+
const columnWidths = tblGrid?.elements?.flatMap((el) => {
|
|
34478
|
+
if (el.name !== "w:gridCol") return [];
|
|
34479
|
+
return twipsToPixels(el.attributes["w:w"]);
|
|
34480
|
+
}) || [];
|
|
34481
|
+
return columnWidths;
|
|
34482
|
+
};
|
|
34483
|
+
const decode$2 = (params2, decodedAttrs) => {
|
|
34484
|
+
const { node: node2 } = params2;
|
|
34485
|
+
const elements = translateChildNodes(params2);
|
|
34486
|
+
if (node2.attrs?.tableRowProperties) {
|
|
34487
|
+
const tableRowProperties = { ...node2.attrs.tableRowProperties };
|
|
34488
|
+
if (node2.attrs.rowHeight != null) {
|
|
34489
|
+
const rowHeightPixels = twipsToPixels(node2.attrs.tableRowProperties["rowHeight"]?.value);
|
|
34490
|
+
if (rowHeightPixels !== node2.attrs.rowHeight) {
|
|
34491
|
+
tableRowProperties["rowHeight"] = { value: String(pixelsToTwips(node2.attrs["rowHeight"])) };
|
|
34492
|
+
}
|
|
34493
|
+
}
|
|
34494
|
+
tableRowProperties["cantSplit"] = node2.attrs["cantSplit"];
|
|
34495
|
+
const trPr = translator$3.decode({
|
|
34496
|
+
...params2,
|
|
34497
|
+
node: { ...node2, attrs: { ...node2.attrs, tableRowProperties } }
|
|
34498
|
+
});
|
|
34499
|
+
if (trPr) elements.unshift(trPr);
|
|
34500
|
+
}
|
|
34501
|
+
return {
|
|
34502
|
+
name: "w:tr",
|
|
34503
|
+
attributes: decodedAttrs || {},
|
|
34504
|
+
elements
|
|
34505
|
+
};
|
|
34506
|
+
};
|
|
34157
34507
|
const config$2 = {
|
|
34158
34508
|
xmlName: XML_NODE_NAME$2,
|
|
34159
34509
|
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
@@ -34226,7 +34576,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34226
34576
|
attrs["borders"] = borderData;
|
|
34227
34577
|
const content = [];
|
|
34228
34578
|
rows.forEach((row) => {
|
|
34229
|
-
const result =
|
|
34579
|
+
const result = translator$2.encode({
|
|
34580
|
+
...params2,
|
|
34581
|
+
nodes: [row],
|
|
34582
|
+
extraParams: {
|
|
34583
|
+
row,
|
|
34584
|
+
table: node2,
|
|
34585
|
+
rowBorders: borderRowData,
|
|
34586
|
+
styleTag: tblStyleTag
|
|
34587
|
+
}
|
|
34588
|
+
});
|
|
34230
34589
|
if (result.content?.length) content.push(result);
|
|
34231
34590
|
});
|
|
34232
34591
|
return {
|
|
@@ -34235,31 +34594,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34235
34594
|
attrs
|
|
34236
34595
|
};
|
|
34237
34596
|
}
|
|
34238
|
-
function handleTableCellNode$1({
|
|
34239
|
-
params: params2,
|
|
34240
|
-
node: node2,
|
|
34241
|
-
table,
|
|
34242
|
-
row,
|
|
34243
|
-
rowBorders,
|
|
34244
|
-
styleTag,
|
|
34245
|
-
columnIndex,
|
|
34246
|
-
columnWidth = null
|
|
34247
|
-
}) {
|
|
34248
|
-
const translatorParams = {
|
|
34249
|
-
...params2,
|
|
34250
|
-
extraParams: {
|
|
34251
|
-
node: node2,
|
|
34252
|
-
table,
|
|
34253
|
-
row,
|
|
34254
|
-
rowBorders,
|
|
34255
|
-
styleTag,
|
|
34256
|
-
columnIndex,
|
|
34257
|
-
columnWidth
|
|
34258
|
-
}
|
|
34259
|
-
};
|
|
34260
|
-
const schemaNode = translator$1.encode(translatorParams);
|
|
34261
|
-
return schemaNode;
|
|
34262
|
-
}
|
|
34263
34597
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
34264
34598
|
if (!tblStyleTag) return null;
|
|
34265
34599
|
const stylesToReturn = {};
|
|
@@ -34340,50 +34674,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34340
34674
|
rowBorders
|
|
34341
34675
|
};
|
|
34342
34676
|
}
|
|
34343
|
-
function handleTableRowNode(node2, table, rowBorders, styleTag, params2) {
|
|
34344
|
-
const attrs = {};
|
|
34345
|
-
const tPr = node2.elements.find((el) => el.name === "w:trPr");
|
|
34346
|
-
const rowHeightTag = tPr?.elements?.find((el) => el.name === "w:trHeight");
|
|
34347
|
-
const rowHeight = rowHeightTag?.attributes["w:val"];
|
|
34348
|
-
const cantSplitTag = tPr?.elements?.find((el) => el.name === "w:cantSplit");
|
|
34349
|
-
if (cantSplitTag) {
|
|
34350
|
-
attrs["cantSplit"] = true;
|
|
34351
|
-
}
|
|
34352
|
-
const borders = {};
|
|
34353
|
-
if (rowBorders?.insideH) borders["bottom"] = rowBorders.insideH;
|
|
34354
|
-
if (rowBorders?.insideV) borders["right"] = rowBorders.insideV;
|
|
34355
|
-
attrs["borders"] = borders;
|
|
34356
|
-
if (rowHeight) {
|
|
34357
|
-
attrs["rowHeight"] = twipsToPixels(rowHeight);
|
|
34358
|
-
}
|
|
34359
|
-
const gridColumnWidths = getGridColumnWidths(table);
|
|
34360
|
-
const cellNodes = node2.elements.filter((el) => el.name === "w:tc");
|
|
34361
|
-
let currentColumnIndex = 0;
|
|
34362
|
-
const content = cellNodes?.map((n) => {
|
|
34363
|
-
let colWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
34364
|
-
const result = handleTableCellNode$1({
|
|
34365
|
-
params: params2,
|
|
34366
|
-
node: n,
|
|
34367
|
-
table,
|
|
34368
|
-
row: node2,
|
|
34369
|
-
rowBorders: borders,
|
|
34370
|
-
styleTag,
|
|
34371
|
-
columnIndex: currentColumnIndex,
|
|
34372
|
-
columnWidth: colWidth
|
|
34373
|
-
});
|
|
34374
|
-
const tcPr = n.elements?.find((el) => el.name === "w:tcPr");
|
|
34375
|
-
const colspanTag = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
34376
|
-
const colspan = parseInt(colspanTag?.attributes["w:val"] || 1, 10);
|
|
34377
|
-
currentColumnIndex += colspan;
|
|
34378
|
-
return result;
|
|
34379
|
-
}) || [];
|
|
34380
|
-
const newNode = {
|
|
34381
|
-
type: "tableRow",
|
|
34382
|
-
content,
|
|
34383
|
-
attrs
|
|
34384
|
-
};
|
|
34385
|
-
return newNode;
|
|
34386
|
-
}
|
|
34387
34677
|
const getGridColumnWidths = (tableNode) => {
|
|
34388
34678
|
const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
|
|
34389
34679
|
if (!tblGrid) return [];
|
|
@@ -34406,6 +34696,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34406
34696
|
const { docx, nodeListHandler: nodeListHandler2 } = params2;
|
|
34407
34697
|
const tcPr = node2.elements.find((el) => el.name === "w:tcPr");
|
|
34408
34698
|
const borders = tcPr?.elements?.find((el) => el.name === "w:tcBorders");
|
|
34699
|
+
if (rowBorders?.insideH) {
|
|
34700
|
+
rowBorders["bottom"] = rowBorders.insideH;
|
|
34701
|
+
delete rowBorders.insideH;
|
|
34702
|
+
}
|
|
34703
|
+
if (rowBorders?.insideV) {
|
|
34704
|
+
rowBorders["right"] = rowBorders.insideV;
|
|
34705
|
+
delete rowBorders?.insideV;
|
|
34706
|
+
}
|
|
34409
34707
|
const inlineBorders = processInlineCellBorders(borders, rowBorders);
|
|
34410
34708
|
const gridColumnWidths = getGridColumnWidths(table);
|
|
34411
34709
|
const tcWidth = tcPr?.elements?.find((el) => el.name === "w:tcW");
|
|
@@ -34716,7 +35014,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34716
35014
|
_createAttributeHandler("r:id", "rId"),
|
|
34717
35015
|
_createAttributeHandler("w:tgtFrame", "target")
|
|
34718
35016
|
];
|
|
34719
|
-
const encode$
|
|
35017
|
+
const encode$j = (params2, encodedAttrs) => {
|
|
34720
35018
|
const { nodes, docx, nodeListHandler: nodeListHandler2 } = params2;
|
|
34721
35019
|
const node2 = nodes[0];
|
|
34722
35020
|
let href = _resolveHref(docx, encodedAttrs);
|
|
@@ -34795,7 +35093,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34795
35093
|
xmlName: XML_NODE_NAME,
|
|
34796
35094
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
34797
35095
|
type: NodeTranslator.translatorTypes.NODE,
|
|
34798
|
-
encode: encode$
|
|
35096
|
+
encode: encode$j,
|
|
34799
35097
|
decode,
|
|
34800
35098
|
attributes: validXmlAttributes
|
|
34801
35099
|
};
|
|
@@ -34806,19 +35104,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34806
35104
|
doc: translateDocumentNode,
|
|
34807
35105
|
body: translateBodyNode,
|
|
34808
35106
|
heading: translateHeadingNode,
|
|
34809
|
-
paragraph: translator$
|
|
35107
|
+
paragraph: translator$g,
|
|
34810
35108
|
text: translateTextNode,
|
|
34811
35109
|
bulletList: translateList,
|
|
34812
35110
|
orderedList: translateList,
|
|
34813
|
-
lineBreak: translator$
|
|
35111
|
+
lineBreak: translator$i,
|
|
34814
35112
|
table: translateTable,
|
|
34815
|
-
tableRow:
|
|
35113
|
+
tableRow: translator$2,
|
|
34816
35114
|
tableCell: translator$1,
|
|
34817
35115
|
bookmarkStart: translateBookmarkStart,
|
|
34818
35116
|
fieldAnnotation: translateFieldAnnotation,
|
|
34819
|
-
tab: translator$
|
|
35117
|
+
tab: translator$h,
|
|
34820
35118
|
image: translateImageNode,
|
|
34821
|
-
hardBreak: translator$
|
|
35119
|
+
hardBreak: translator$i,
|
|
34822
35120
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
34823
35121
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
34824
35122
|
commentReference: () => null,
|
|
@@ -35598,36 +35896,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35598
35896
|
elements
|
|
35599
35897
|
};
|
|
35600
35898
|
}
|
|
35601
|
-
function translateTableRow(params2) {
|
|
35602
|
-
const elements = translateChildNodes(params2);
|
|
35603
|
-
const tableRowProperties = generateTableRowProperties(params2.node);
|
|
35604
|
-
if (tableRowProperties.elements.length) elements.unshift(tableRowProperties);
|
|
35605
|
-
return {
|
|
35606
|
-
name: "w:tr",
|
|
35607
|
-
elements
|
|
35608
|
-
};
|
|
35609
|
-
}
|
|
35610
|
-
function generateTableRowProperties(node2) {
|
|
35611
|
-
const { attrs } = node2;
|
|
35612
|
-
const elements = [];
|
|
35613
|
-
const { rowHeight, rowHeightType } = attrs;
|
|
35614
|
-
if (rowHeight) {
|
|
35615
|
-
const attributes = { "w:val": pixelsToTwips(rowHeight) };
|
|
35616
|
-
if (rowHeightType) attributes["w:hRule"] = rowHeightType;
|
|
35617
|
-
const rowHeightElement = {
|
|
35618
|
-
name: "w:trHeight",
|
|
35619
|
-
attributes
|
|
35620
|
-
};
|
|
35621
|
-
elements.push(rowHeightElement);
|
|
35622
|
-
}
|
|
35623
|
-
if (attrs?.cantSplit) {
|
|
35624
|
-
elements.push({ name: "w:cantSplit" });
|
|
35625
|
-
}
|
|
35626
|
-
return {
|
|
35627
|
-
name: "w:trPr",
|
|
35628
|
-
elements
|
|
35629
|
-
};
|
|
35630
|
-
}
|
|
35631
35899
|
function translateBookmarkStart(params2) {
|
|
35632
35900
|
const bookmarkStartNode = {
|
|
35633
35901
|
name: "w:bookmarkStart",
|
|
@@ -36847,21 +37115,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36847
37115
|
handlerName: "trackChangeNodeHandler",
|
|
36848
37116
|
handler: handleTrackChangeNode
|
|
36849
37117
|
};
|
|
36850
|
-
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
36851
|
-
handlerName,
|
|
36852
|
-
handler: (params2) => {
|
|
36853
|
-
const { nodes } = params2;
|
|
36854
|
-
if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
|
|
36855
|
-
return { nodes: [], consumed: 0 };
|
|
36856
|
-
}
|
|
36857
|
-
const result = translator2.encode(params2);
|
|
36858
|
-
if (!result) return { nodes: [], consumed: 0 };
|
|
36859
|
-
return {
|
|
36860
|
-
nodes: Array.isArray(result) ? result : [result],
|
|
36861
|
-
consumed: 1
|
|
36862
|
-
};
|
|
36863
|
-
}
|
|
36864
|
-
});
|
|
36865
37118
|
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator);
|
|
36866
37119
|
const handleRunNode = (params2) => {
|
|
36867
37120
|
const { nodes, nodeListHandler: nodeListHandler2, parentStyleId, docx } = params2;
|
|
@@ -36974,7 +37227,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36974
37227
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
36975
37228
|
return { nodes: [], consumed: 0 };
|
|
36976
37229
|
}
|
|
36977
|
-
const schemaNode = translator$
|
|
37230
|
+
const schemaNode = translator$g.encode(params2);
|
|
36978
37231
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
36979
37232
|
return { nodes: newNodes, consumed: 1 };
|
|
36980
37233
|
};
|
|
@@ -37287,7 +37540,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37287
37540
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
37288
37541
|
return { nodes: [], consumed: 0 };
|
|
37289
37542
|
}
|
|
37290
|
-
const result = translator$
|
|
37543
|
+
const result = translator$i.encode(params2);
|
|
37291
37544
|
if (!result) return { nodes: [], consumed: 0 };
|
|
37292
37545
|
return {
|
|
37293
37546
|
nodes: [result],
|
|
@@ -37956,7 +38209,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37956
38209
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
37957
38210
|
return { nodes: [], consumed: 0 };
|
|
37958
38211
|
}
|
|
37959
|
-
const node2 = translator$
|
|
38212
|
+
const node2 = translator$h.encode(params2);
|
|
37960
38213
|
return { nodes: [node2], consumed: 1 };
|
|
37961
38214
|
};
|
|
37962
38215
|
const tabNodeEntityHandler = {
|
|
@@ -63697,7 +63950,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63697
63950
|
if (!cantSplit) return {};
|
|
63698
63951
|
return { "data-cant-split": "true" };
|
|
63699
63952
|
}
|
|
63700
|
-
}
|
|
63953
|
+
},
|
|
63954
|
+
/**
|
|
63955
|
+
* @category Attribute
|
|
63956
|
+
* @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
|
|
63957
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
|
|
63958
|
+
*/
|
|
63959
|
+
tableRowProperties: { rendered: false },
|
|
63960
|
+
/**
|
|
63961
|
+
* @category Attribute
|
|
63962
|
+
* @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
|
|
63963
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
63964
|
+
*/
|
|
63965
|
+
rsidDel: { rendered: false },
|
|
63966
|
+
/**
|
|
63967
|
+
* @category Attribute
|
|
63968
|
+
* @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
|
|
63969
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
63970
|
+
*/
|
|
63971
|
+
rsidR: { rendered: false },
|
|
63972
|
+
/**
|
|
63973
|
+
* @category Attribute
|
|
63974
|
+
* @param {string} [rsidRPr] - Unique identifier used to track the editing session when the glyph character representing the table row mark was last modified in the main document.
|
|
63975
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
63976
|
+
*/
|
|
63977
|
+
rsidRPr: { rendered: false },
|
|
63978
|
+
/**
|
|
63979
|
+
* @category Attribute
|
|
63980
|
+
* @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
|
|
63981
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
63982
|
+
*/
|
|
63983
|
+
rsidTr: { rendered: false },
|
|
63984
|
+
/**
|
|
63985
|
+
* @category Attribute
|
|
63986
|
+
* @param {string} [paraId] - A randomly generated unique identifier for the table row.
|
|
63987
|
+
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
|
|
63988
|
+
*/
|
|
63989
|
+
paraId: { rendered: false },
|
|
63990
|
+
/**
|
|
63991
|
+
* @category Attribute
|
|
63992
|
+
* @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
|
|
63993
|
+
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
|
|
63994
|
+
*/
|
|
63995
|
+
textId: { rendered: false }
|
|
63701
63996
|
};
|
|
63702
63997
|
},
|
|
63703
63998
|
parseDOM() {
|
|
@@ -88708,7 +89003,7 @@ ${style2}
|
|
|
88708
89003
|
required: false
|
|
88709
89004
|
},
|
|
88710
89005
|
fileSource: {
|
|
88711
|
-
type: File,
|
|
89006
|
+
type: [File, Blob],
|
|
88712
89007
|
required: false
|
|
88713
89008
|
},
|
|
88714
89009
|
state: {
|
|
@@ -88988,7 +89283,7 @@ ${style2}
|
|
|
88988
89283
|
};
|
|
88989
89284
|
}
|
|
88990
89285
|
};
|
|
88991
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-
|
|
89286
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-8b2f8c17"]]);
|
|
88992
89287
|
const _hoisted_1$h = ["innerHTML"];
|
|
88993
89288
|
const _sfc_main$i = {
|
|
88994
89289
|
__name: "SuperInput",
|
|
@@ -89081,9 +89376,9 @@ ${style2}
|
|
|
89081
89376
|
};
|
|
89082
89377
|
const SuperInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-4d5cff52"]]);
|
|
89083
89378
|
const registeredHandlers = Object.freeze({
|
|
89084
|
-
"w:br": translator$
|
|
89085
|
-
"w:tab": translator$
|
|
89086
|
-
"w:p": translator$
|
|
89379
|
+
"w:br": translator$i,
|
|
89380
|
+
"w:tab": translator$h,
|
|
89381
|
+
"w:p": translator$g
|
|
89087
89382
|
});
|
|
89088
89383
|
const Extensions = {
|
|
89089
89384
|
Node: Node$1,
|
|
@@ -90300,6 +90595,59 @@ ${style2}
|
|
|
90300
90595
|
return refs;
|
|
90301
90596
|
}
|
|
90302
90597
|
}
|
|
90598
|
+
const extractBrowserFile = (input) => {
|
|
90599
|
+
if (!input) return null;
|
|
90600
|
+
if (typeof File === "function" && input instanceof File) return input;
|
|
90601
|
+
if (typeof Blob === "function" && input instanceof Blob) {
|
|
90602
|
+
const hasFileCtor = typeof File === "function";
|
|
90603
|
+
if (hasFileCtor) {
|
|
90604
|
+
const name = input.name || "document";
|
|
90605
|
+
return new File([input], name, { type: input.type });
|
|
90606
|
+
}
|
|
90607
|
+
return input;
|
|
90608
|
+
}
|
|
90609
|
+
if (input.originFileObj) return extractBrowserFile(input.originFileObj);
|
|
90610
|
+
if (input.file) return extractBrowserFile(input.file);
|
|
90611
|
+
if (input.raw) return extractBrowserFile(input.raw);
|
|
90612
|
+
return null;
|
|
90613
|
+
};
|
|
90614
|
+
const inferTypeFromName = (name = "") => {
|
|
90615
|
+
const lower = String(name).toLowerCase();
|
|
90616
|
+
if (lower.endsWith(".docx")) return DOCX;
|
|
90617
|
+
if (lower.endsWith(".pdf")) return PDF;
|
|
90618
|
+
if (lower.endsWith(".html") || lower.endsWith(".htm")) return HTML;
|
|
90619
|
+
if (lower.endsWith(".md") || lower.endsWith(".markdown")) return "text/markdown";
|
|
90620
|
+
return "";
|
|
90621
|
+
};
|
|
90622
|
+
const normalizeDocumentEntry = (entry) => {
|
|
90623
|
+
const maybeFile = extractBrowserFile(entry);
|
|
90624
|
+
if (maybeFile) {
|
|
90625
|
+
const name = (
|
|
90626
|
+
/** @type {any} */
|
|
90627
|
+
maybeFile.name || entry && entry.name || "document"
|
|
90628
|
+
);
|
|
90629
|
+
const type2 = maybeFile.type || inferTypeFromName(name) || DOCX;
|
|
90630
|
+
return {
|
|
90631
|
+
type: type2,
|
|
90632
|
+
data: maybeFile,
|
|
90633
|
+
name,
|
|
90634
|
+
isNewFile: true
|
|
90635
|
+
};
|
|
90636
|
+
}
|
|
90637
|
+
if (entry && typeof entry === "object" && "data" in entry) {
|
|
90638
|
+
const file = extractBrowserFile(entry.data);
|
|
90639
|
+
if (file) {
|
|
90640
|
+
const type2 = entry.type || file.type || inferTypeFromName(file.name) || DOCX;
|
|
90641
|
+
return {
|
|
90642
|
+
...entry,
|
|
90643
|
+
type: type2,
|
|
90644
|
+
data: file,
|
|
90645
|
+
name: entry.name || file.name || "document"
|
|
90646
|
+
};
|
|
90647
|
+
}
|
|
90648
|
+
}
|
|
90649
|
+
return entry;
|
|
90650
|
+
};
|
|
90303
90651
|
function useFieldValueWatcher(field, originalValue) {
|
|
90304
90652
|
const fieldId = field.itemid;
|
|
90305
90653
|
const rawField = field;
|
|
@@ -92155,13 +92503,39 @@ ${reason}`);
|
|
|
92155
92503
|
}
|
|
92156
92504
|
}
|
|
92157
92505
|
};
|
|
92506
|
+
const _blobToFile = (blob, name, type2) => {
|
|
92507
|
+
return new File([blob], name, { type: type2 });
|
|
92508
|
+
};
|
|
92158
92509
|
const _initializeDocumentData = async (doc2) => {
|
|
92510
|
+
doc2 = normalizeDocumentEntry(doc2);
|
|
92159
92511
|
if (currentConfig.value?.html) doc2.html = currentConfig.value.html;
|
|
92160
92512
|
if (!doc2.data && doc2.url && !doc2.type) doc2.type = DOCX;
|
|
92161
92513
|
if (currentConfig.value?.modules.collaboration && !doc2.isNewFile) {
|
|
92162
92514
|
return { ...doc2, data: null, url: null };
|
|
92163
92515
|
}
|
|
92164
|
-
if (doc2.data)
|
|
92516
|
+
if (doc2.data instanceof File) {
|
|
92517
|
+
let fileName = doc2.name;
|
|
92518
|
+
const extension = doc2.type === DOCX ? ".docx" : doc2.type === PDF ? ".pdf" : ".bin";
|
|
92519
|
+
if (!fileName) {
|
|
92520
|
+
fileName = `document${extension}`;
|
|
92521
|
+
} else if (!fileName.includes(".")) {
|
|
92522
|
+
fileName = `${fileName}${extension}`;
|
|
92523
|
+
}
|
|
92524
|
+
if (doc2.data.name !== fileName) {
|
|
92525
|
+
const fileObject = _blobToFile(doc2.data, fileName, doc2.data.type || doc2.type);
|
|
92526
|
+
return { ...doc2, name: fileName, data: fileObject };
|
|
92527
|
+
}
|
|
92528
|
+
if (!doc2.name) return { ...doc2, name: fileName };
|
|
92529
|
+
return doc2;
|
|
92530
|
+
} else if (doc2.data instanceof Blob) {
|
|
92531
|
+
let fileName = doc2.name;
|
|
92532
|
+
if (!fileName) {
|
|
92533
|
+
const extension = doc2.type === DOCX ? ".docx" : doc2.type === PDF ? ".pdf" : ".bin";
|
|
92534
|
+
fileName = `document${extension}`;
|
|
92535
|
+
}
|
|
92536
|
+
const fileObject = _blobToFile(doc2.data, fileName, doc2.data.type || doc2.type);
|
|
92537
|
+
return { ...doc2, data: fileObject };
|
|
92538
|
+
} else if (doc2.data) return doc2;
|
|
92165
92539
|
else if (doc2.url && doc2.type) {
|
|
92166
92540
|
if (doc2.type.toLowerCase() === "docx") doc2.type = DOCX;
|
|
92167
92541
|
else if (doc2.type.toLowerCase() === "pdf") doc2.type = PDF;
|
|
@@ -105371,7 +105745,7 @@ ${style2}
|
|
|
105371
105745
|
__name: "HtmlViewer",
|
|
105372
105746
|
props: {
|
|
105373
105747
|
fileSource: {
|
|
105374
|
-
type: File,
|
|
105748
|
+
type: [File, Blob],
|
|
105375
105749
|
required: true
|
|
105376
105750
|
},
|
|
105377
105751
|
documentId: {
|
|
@@ -105426,7 +105800,7 @@ ${style2}
|
|
|
105426
105800
|
};
|
|
105427
105801
|
}
|
|
105428
105802
|
};
|
|
105429
|
-
const HtmlViewer = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
105803
|
+
const HtmlViewer = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-da3494ba"]]);
|
|
105430
105804
|
const _hoisted_1$2 = {
|
|
105431
105805
|
class: "ai-highlight-container",
|
|
105432
105806
|
id: "aiHighlightContainer"
|
|
@@ -106304,13 +106678,15 @@ ${style2}
|
|
|
106304
106678
|
const doc2 = this.config.document;
|
|
106305
106679
|
const hasDocumentConfig = !!doc2 && typeof doc2 === "object" && Object.keys(this.config.document)?.length;
|
|
106306
106680
|
const hasDocumentUrl = !!doc2 && typeof doc2 === "string" && doc2.length > 0;
|
|
106307
|
-
const hasDocumentFile = !!doc2 && doc2 instanceof File;
|
|
106681
|
+
const hasDocumentFile = !!doc2 && typeof File === "function" && doc2 instanceof File;
|
|
106682
|
+
const hasDocumentBlob = !!doc2 && doc2 instanceof Blob && !(doc2 instanceof File);
|
|
106308
106683
|
const hasListOfDocuments = this.config.documents && this.config.documents?.length;
|
|
106309
106684
|
if (hasDocumentConfig && hasListOfDocuments) {
|
|
106310
106685
|
console.warn("🦋 [superdoc] You can only provide one of document or documents");
|
|
106311
106686
|
}
|
|
106312
106687
|
if (hasDocumentConfig) {
|
|
106313
|
-
|
|
106688
|
+
const normalized = normalizeDocumentEntry(this.config.document);
|
|
106689
|
+
this.config.documents = [normalized];
|
|
106314
106690
|
} else if (hasDocumentUrl) {
|
|
106315
106691
|
this.config.documents = [
|
|
106316
106692
|
{
|
|
@@ -106329,6 +106705,25 @@ ${style2}
|
|
|
106329
106705
|
isNewFile: true
|
|
106330
106706
|
}
|
|
106331
106707
|
];
|
|
106708
|
+
} else if (hasDocumentBlob) {
|
|
106709
|
+
const docType = this.config.document.type || DOCX;
|
|
106710
|
+
let extension = ".docx";
|
|
106711
|
+
if (docType === PDF) {
|
|
106712
|
+
extension = ".pdf";
|
|
106713
|
+
} else if (docType === HTML) {
|
|
106714
|
+
extension = ".html";
|
|
106715
|
+
}
|
|
106716
|
+
this.config.documents = [
|
|
106717
|
+
{
|
|
106718
|
+
type: docType,
|
|
106719
|
+
data: this.config.document,
|
|
106720
|
+
name: `document${extension}`,
|
|
106721
|
+
isNewFile: true
|
|
106722
|
+
}
|
|
106723
|
+
];
|
|
106724
|
+
}
|
|
106725
|
+
if (Array.isArray(this.config.documents) && this.config.documents.length > 0) {
|
|
106726
|
+
this.config.documents = this.config.documents.map((d2) => normalizeDocumentEntry(d2));
|
|
106332
106727
|
}
|
|
106333
106728
|
}
|
|
106334
106729
|
#initVueApp() {
|