@harbour-enterprises/superdoc 0.19.0-next.4 → 0.19.0-next.6
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-DmC4Qg1S.cjs → PdfViewer-BlV8_l4e.cjs} +1 -1
- package/dist/chunks/{PdfViewer-Df9H8xeA.es.js → PdfViewer-oqYWe1FJ.es.js} +1 -1
- package/dist/chunks/{index-C_oHQN7n.es.js → index-CeockUQz.es.js} +35 -3
- package/dist/chunks/{index-CWQGBk3Z.cjs → index-DHyh73q4.cjs} +35 -3
- package/dist/chunks/{super-editor.es-C2QwEj1z.es.js → super-editor.es-BRBU19lM.es.js} +614 -295
- package/dist/chunks/{super-editor.es-B_u6OGsf.cjs → super-editor.es-bu-RKSWh.cjs} +614 -295
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/stores/superdoc-store.d.ts +3 -0
- package/dist/stores/superdoc-store.d.ts.map +1 -1
- package/dist/style.css +6 -6
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-CMajoq-M.js → converter-BFq1XXek.js} +472 -208
- package/dist/super-editor/chunks/{docx-zipper-C5rg6GNf.js → docx-zipper-BahUy6FS.js} +1 -1
- package/dist/super-editor/chunks/{editor-CH3sE8Fq.js → editor-BdLd21gy.js} +135 -85
- package/dist/super-editor/chunks/{toolbar-BHnLBr61.js → toolbar-DoJY1zlM.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/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 +13 -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 +647 -296
- 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,362 @@ 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 }) {
|
|
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
|
+
if (!node2?.elements || node2.elements.length === 0) {
|
|
34228
|
+
return asArray ? [] : {};
|
|
34229
|
+
}
|
|
34230
|
+
const attributes = asArray ? [] : {};
|
|
34231
|
+
node2.elements.forEach((el) => {
|
|
34232
|
+
const translator2 = translatorsByXmlName[el.name];
|
|
34233
|
+
if (translator2) {
|
|
34234
|
+
const encodedAttr = translator2.encode({ nodes: [el] });
|
|
34235
|
+
if (encodedAttr != null) {
|
|
34236
|
+
if (asArray) {
|
|
34237
|
+
attributes.push({ [translator2.sdNodeOrKeyName]: encodedAttr });
|
|
34238
|
+
} else {
|
|
34239
|
+
attributes[translator2.sdNodeOrKeyName] = encodedAttr;
|
|
34240
|
+
}
|
|
34241
|
+
}
|
|
34242
|
+
}
|
|
34243
|
+
});
|
|
34244
|
+
return attributes;
|
|
34245
|
+
}
|
|
34246
|
+
function decodeProperties(translatorsBySdName, properties) {
|
|
34247
|
+
if (!properties || typeof properties !== "object") {
|
|
34248
|
+
return [];
|
|
34249
|
+
}
|
|
34250
|
+
const elements = [];
|
|
34251
|
+
Object.keys(properties).forEach((key) => {
|
|
34252
|
+
const translator2 = translatorsBySdName[key];
|
|
34253
|
+
if (translator2) {
|
|
34254
|
+
const attributes = translator2.decode({ node: { attrs: { [key]: properties[key] } } });
|
|
34255
|
+
if (attributes != null) {
|
|
34256
|
+
elements.push({ name: translator2.xmlName, attributes });
|
|
34257
|
+
}
|
|
34258
|
+
}
|
|
34259
|
+
});
|
|
34260
|
+
return elements;
|
|
34261
|
+
}
|
|
34262
|
+
const parseBoolean = (value) => ["1", "true"].includes(value);
|
|
34263
|
+
const parseInteger = (value) => {
|
|
34264
|
+
if (value == null) return void 0;
|
|
34265
|
+
const intValue = parseInt(value, 10);
|
|
34266
|
+
return isNaN(intValue) ? void 0 : intValue;
|
|
34267
|
+
};
|
|
34268
|
+
const integerToString = (value) => {
|
|
34269
|
+
const intValue = parseInteger(value);
|
|
34270
|
+
return intValue != void 0 ? String(intValue) : void 0;
|
|
34271
|
+
};
|
|
34272
|
+
const translator$f = NodeTranslator.from({
|
|
34273
|
+
xmlName: "w:cantSplit",
|
|
34274
|
+
sdNodeOrKeyName: "cantSplit",
|
|
34275
|
+
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34276
|
+
decode: ({ node: node2 }) => node2.attrs?.cantSplit ? {} : void 0
|
|
34277
|
+
});
|
|
34278
|
+
const translator$e = NodeTranslator.from({
|
|
34279
|
+
xmlName: "w:cnfStyle",
|
|
34280
|
+
sdNodeOrKeyName: "cnfStyle",
|
|
34281
|
+
attributes: [
|
|
34282
|
+
"w:evenHBand",
|
|
34283
|
+
"w:evenVBand",
|
|
34284
|
+
"w:firstColumn",
|
|
34285
|
+
"w:firstRow",
|
|
34286
|
+
"w:firstRowFirstColumn",
|
|
34287
|
+
"w:firstRowLastColumn",
|
|
34288
|
+
"w:lastColumn",
|
|
34289
|
+
"w:lastRow",
|
|
34290
|
+
"w:lastRowFirstColumn",
|
|
34291
|
+
"w:lastRowLastColumn",
|
|
34292
|
+
"w:oddHBand",
|
|
34293
|
+
"w:oddVBand",
|
|
34294
|
+
"w:val"
|
|
34295
|
+
].map((attr) => createAttributeHandler(attr)),
|
|
34296
|
+
encode: (_2, encodedAttrs) => {
|
|
34297
|
+
Object.keys(encodedAttrs).forEach((key) => {
|
|
34298
|
+
encodedAttrs[key] = ["1", "true"].includes(encodedAttrs[key]);
|
|
34299
|
+
});
|
|
34300
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
34301
|
+
},
|
|
34302
|
+
decode: ({ node: node2 }) => {
|
|
34303
|
+
if (!node2.attrs?.cnfStyle) return;
|
|
34304
|
+
const cnfStyleAttrs = {};
|
|
34305
|
+
Object.entries(node2.attrs.cnfStyle).forEach(([key, value]) => {
|
|
34306
|
+
cnfStyleAttrs[`w:${key}`] = value ? "1" : "0";
|
|
34307
|
+
});
|
|
34308
|
+
return Object.keys(cnfStyleAttrs).length > 0 ? cnfStyleAttrs : void 0;
|
|
34309
|
+
}
|
|
34310
|
+
});
|
|
34311
|
+
const translator$d = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
34312
|
+
const translator$c = NodeTranslator.from(
|
|
34313
|
+
createSingleAttrPropertyHandler(
|
|
34314
|
+
"w:gridAfter",
|
|
34315
|
+
null,
|
|
34316
|
+
"w:val",
|
|
34317
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
34318
|
+
(v2) => integerToString(v2)
|
|
34319
|
+
)
|
|
34320
|
+
);
|
|
34321
|
+
const translator$b = NodeTranslator.from(
|
|
34322
|
+
createSingleAttrPropertyHandler(
|
|
34323
|
+
"w:gridBefore",
|
|
34324
|
+
null,
|
|
34325
|
+
"w:val",
|
|
34326
|
+
(v2) => parseInteger(v2) ?? void 0,
|
|
34327
|
+
(v2) => integerToString(v2)
|
|
34328
|
+
)
|
|
34329
|
+
);
|
|
34330
|
+
const translator$a = NodeTranslator.from({
|
|
34331
|
+
xmlName: "w:hidden",
|
|
34332
|
+
sdNodeOrKeyName: "hidden",
|
|
34333
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34334
|
+
decode: ({ node: node2 }) => node2.attrs.hidden ? {} : void 0
|
|
34335
|
+
});
|
|
34336
|
+
const translator$9 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc"));
|
|
34337
|
+
const translator$8 = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "cellSpacing"));
|
|
34338
|
+
const translator$7 = NodeTranslator.from({
|
|
34339
|
+
xmlName: "w:tblHeader",
|
|
34340
|
+
sdNodeOrKeyName: "repeatHeader",
|
|
34341
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
34342
|
+
decode: ({ node: node2 }) => node2.attrs.repeatHeader ? {} : void 0
|
|
34343
|
+
});
|
|
34344
|
+
const translator$6 = NodeTranslator.from({
|
|
34345
|
+
xmlName: "w:trHeight",
|
|
34346
|
+
sdNodeOrKeyName: "rowHeight",
|
|
34347
|
+
encode: ({ nodes }) => {
|
|
34348
|
+
const heightAttrs = {};
|
|
34349
|
+
const val = nodes[0].attributes["w:val"];
|
|
34350
|
+
if (val) {
|
|
34351
|
+
heightAttrs["value"] = parseInt(val, 10);
|
|
34352
|
+
}
|
|
34353
|
+
const rule = nodes[0].attributes["w:hRule"];
|
|
34354
|
+
if (rule) {
|
|
34355
|
+
heightAttrs["rule"] = rule;
|
|
34356
|
+
}
|
|
34357
|
+
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
34358
|
+
},
|
|
34359
|
+
decode: ({ node: node2 }) => {
|
|
34360
|
+
if (!node2.attrs?.rowHeight) return;
|
|
34361
|
+
const heightAttrs = {};
|
|
34362
|
+
if (typeof node2.attrs.rowHeight.value === "number" && !isNaN(node2.attrs.rowHeight.value)) {
|
|
34363
|
+
heightAttrs["w:val"] = String(node2.attrs.rowHeight.value);
|
|
34364
|
+
}
|
|
34365
|
+
if (node2.attrs.rowHeight.rule) {
|
|
34366
|
+
heightAttrs["w:hRule"] = node2.attrs.rowHeight.rule;
|
|
34367
|
+
}
|
|
34368
|
+
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
34369
|
+
}
|
|
34370
|
+
});
|
|
34371
|
+
const translator$5 = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
34372
|
+
const translator$4 = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
34373
|
+
const XML_NODE_NAME$3 = "w:trPr";
|
|
34374
|
+
const SD_ATTR_KEY = "tableRowProperties";
|
|
34375
|
+
const encode$3 = (params2) => {
|
|
34376
|
+
const { nodes } = params2;
|
|
34377
|
+
const node2 = nodes[0];
|
|
34378
|
+
let attributes = {
|
|
34379
|
+
cantSplit: false,
|
|
34380
|
+
hidden: false,
|
|
34381
|
+
repeatHeader: false
|
|
34382
|
+
};
|
|
34383
|
+
attributes = {
|
|
34384
|
+
...attributes,
|
|
34385
|
+
...encodeProperties(node2, propertyTranslatorsByXmlName)
|
|
34386
|
+
};
|
|
34387
|
+
return {
|
|
34388
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
34389
|
+
xmlName: XML_NODE_NAME$3,
|
|
34390
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
34391
|
+
attributes
|
|
34392
|
+
};
|
|
34393
|
+
};
|
|
34394
|
+
const decode$3 = (params2) => {
|
|
34395
|
+
const { tableRowProperties = {} } = params2.node.attrs || {};
|
|
34396
|
+
const elements = decodeProperties(propertyTranslatorsBySdName, tableRowProperties);
|
|
34397
|
+
const newNode = {
|
|
34398
|
+
name: "w:trPr",
|
|
34399
|
+
type: "element",
|
|
34400
|
+
attributes: {},
|
|
34401
|
+
elements
|
|
34402
|
+
};
|
|
34403
|
+
return newNode;
|
|
34404
|
+
};
|
|
34405
|
+
const propertyTranslators = [
|
|
34406
|
+
translator$f,
|
|
34407
|
+
translator$e,
|
|
34408
|
+
translator$d,
|
|
34409
|
+
translator$c,
|
|
34410
|
+
translator$b,
|
|
34411
|
+
translator$a,
|
|
34412
|
+
translator$9,
|
|
34413
|
+
translator$8,
|
|
34414
|
+
translator$7,
|
|
34415
|
+
translator$6,
|
|
34416
|
+
translator$5,
|
|
34417
|
+
translator$4
|
|
34418
|
+
];
|
|
34419
|
+
const propertyTranslatorsByXmlName = {};
|
|
34420
|
+
propertyTranslators.forEach((translator2) => {
|
|
34421
|
+
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
34422
|
+
});
|
|
34423
|
+
const propertyTranslatorsBySdName = {};
|
|
34424
|
+
propertyTranslators.forEach((translator2) => {
|
|
34425
|
+
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
34426
|
+
});
|
|
34427
|
+
const config$3 = {
|
|
34428
|
+
xmlName: XML_NODE_NAME$3,
|
|
34429
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
34430
|
+
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
34431
|
+
encode: encode$3,
|
|
34432
|
+
decode: decode$3
|
|
34433
|
+
};
|
|
34434
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
34435
|
+
const XML_NODE_NAME$2 = "w:tr";
|
|
34436
|
+
const SD_NODE_NAME$2 = "tableRow";
|
|
34437
|
+
const validXmlAttributes$2 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
34438
|
+
(xmlName) => createAttributeHandler(xmlName)
|
|
34439
|
+
);
|
|
34440
|
+
const encode$2 = (params2, encodedAttrs) => {
|
|
34441
|
+
const { row, table } = params2.extraParams;
|
|
34442
|
+
let tableRowProperties = {};
|
|
34443
|
+
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
34444
|
+
if (tPr) {
|
|
34445
|
+
({ attributes: tableRowProperties } = translator$3.encode({
|
|
34446
|
+
...params2,
|
|
34447
|
+
nodes: [tPr]
|
|
34448
|
+
}));
|
|
34449
|
+
}
|
|
34450
|
+
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
34451
|
+
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
34452
|
+
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
34453
|
+
const gridColumnWidths = _getGridColumnWidths(table);
|
|
34454
|
+
const cellNodes = row.elements.filter((el) => el.name === "w:tc");
|
|
34455
|
+
let currentColumnIndex = 0;
|
|
34456
|
+
const content = cellNodes?.map((n) => {
|
|
34457
|
+
let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
|
|
34458
|
+
const result = translator$1.encode({
|
|
34459
|
+
...params2,
|
|
34460
|
+
extraParams: {
|
|
34461
|
+
...params2.extraParams,
|
|
34462
|
+
node: n,
|
|
34463
|
+
columnIndex: currentColumnIndex,
|
|
34464
|
+
columnWidth
|
|
34465
|
+
}
|
|
34466
|
+
});
|
|
34467
|
+
const tcPr = n.elements?.find((el) => el.name === "w:tcPr");
|
|
34468
|
+
const colspanTag = tcPr?.elements?.find((el) => el.name === "w:gridSpan");
|
|
34469
|
+
const colspan = parseInt(colspanTag?.attributes["w:val"] || 1, 10);
|
|
34470
|
+
currentColumnIndex += colspan;
|
|
34471
|
+
return result;
|
|
34472
|
+
}) || [];
|
|
34473
|
+
const newNode = {
|
|
34474
|
+
type: "tableRow",
|
|
34475
|
+
content,
|
|
34476
|
+
attrs: encodedAttrs
|
|
34477
|
+
};
|
|
34478
|
+
return newNode;
|
|
34479
|
+
};
|
|
34480
|
+
const _getGridColumnWidths = (tableNode) => {
|
|
34481
|
+
const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
|
|
34482
|
+
if (!tblGrid) return [];
|
|
34483
|
+
const columnWidths = tblGrid?.elements?.flatMap((el) => {
|
|
34484
|
+
if (el.name !== "w:gridCol") return [];
|
|
34485
|
+
return twipsToPixels(el.attributes["w:w"]);
|
|
34486
|
+
}) || [];
|
|
34487
|
+
return columnWidths;
|
|
34488
|
+
};
|
|
34489
|
+
const decode$2 = (params2, decodedAttrs) => {
|
|
34490
|
+
const { node: node2 } = params2;
|
|
34491
|
+
const elements = translateChildNodes(params2);
|
|
34492
|
+
if (node2.attrs?.tableRowProperties) {
|
|
34493
|
+
const tableRowProperties = { ...node2.attrs.tableRowProperties };
|
|
34494
|
+
if (node2.attrs.rowHeight != null) {
|
|
34495
|
+
const rowHeightPixels = twipsToPixels(node2.attrs.tableRowProperties["rowHeight"]?.value);
|
|
34496
|
+
if (rowHeightPixels !== node2.attrs.rowHeight) {
|
|
34497
|
+
tableRowProperties["rowHeight"] = { value: String(pixelsToTwips(node2.attrs["rowHeight"])) };
|
|
34498
|
+
}
|
|
34499
|
+
}
|
|
34500
|
+
tableRowProperties["cantSplit"] = node2.attrs["cantSplit"];
|
|
34501
|
+
const trPr = translator$3.decode({
|
|
34502
|
+
...params2,
|
|
34503
|
+
node: { ...node2, attrs: { ...node2.attrs, tableRowProperties } }
|
|
34504
|
+
});
|
|
34505
|
+
if (trPr) elements.unshift(trPr);
|
|
34506
|
+
}
|
|
34507
|
+
return {
|
|
34508
|
+
name: "w:tr",
|
|
34509
|
+
attributes: decodedAttrs || {},
|
|
34510
|
+
elements
|
|
34511
|
+
};
|
|
34512
|
+
};
|
|
34157
34513
|
const config$2 = {
|
|
34158
34514
|
xmlName: XML_NODE_NAME$2,
|
|
34159
34515
|
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
@@ -34226,7 +34582,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34226
34582
|
attrs["borders"] = borderData;
|
|
34227
34583
|
const content = [];
|
|
34228
34584
|
rows.forEach((row) => {
|
|
34229
|
-
const result =
|
|
34585
|
+
const result = translator$2.encode({
|
|
34586
|
+
...params2,
|
|
34587
|
+
nodes: [row],
|
|
34588
|
+
extraParams: {
|
|
34589
|
+
row,
|
|
34590
|
+
table: node2,
|
|
34591
|
+
rowBorders: borderRowData,
|
|
34592
|
+
styleTag: tblStyleTag
|
|
34593
|
+
}
|
|
34594
|
+
});
|
|
34230
34595
|
if (result.content?.length) content.push(result);
|
|
34231
34596
|
});
|
|
34232
34597
|
return {
|
|
@@ -34235,31 +34600,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34235
34600
|
attrs
|
|
34236
34601
|
};
|
|
34237
34602
|
}
|
|
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
34603
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
34264
34604
|
if (!tblStyleTag) return null;
|
|
34265
34605
|
const stylesToReturn = {};
|
|
@@ -34340,50 +34680,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34340
34680
|
rowBorders
|
|
34341
34681
|
};
|
|
34342
34682
|
}
|
|
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
34683
|
const getGridColumnWidths = (tableNode) => {
|
|
34388
34684
|
const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
|
|
34389
34685
|
if (!tblGrid) return [];
|
|
@@ -34406,6 +34702,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34406
34702
|
const { docx, nodeListHandler: nodeListHandler2 } = params2;
|
|
34407
34703
|
const tcPr = node2.elements.find((el) => el.name === "w:tcPr");
|
|
34408
34704
|
const borders = tcPr?.elements?.find((el) => el.name === "w:tcBorders");
|
|
34705
|
+
if (rowBorders?.insideH) {
|
|
34706
|
+
rowBorders["bottom"] = rowBorders.insideH;
|
|
34707
|
+
delete rowBorders.insideH;
|
|
34708
|
+
}
|
|
34709
|
+
if (rowBorders?.insideV) {
|
|
34710
|
+
rowBorders["right"] = rowBorders.insideV;
|
|
34711
|
+
delete rowBorders?.insideV;
|
|
34712
|
+
}
|
|
34409
34713
|
const inlineBorders = processInlineCellBorders(borders, rowBorders);
|
|
34410
34714
|
const gridColumnWidths = getGridColumnWidths(table);
|
|
34411
34715
|
const tcWidth = tcPr?.elements?.find((el) => el.name === "w:tcW");
|
|
@@ -34716,7 +35020,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34716
35020
|
_createAttributeHandler("r:id", "rId"),
|
|
34717
35021
|
_createAttributeHandler("w:tgtFrame", "target")
|
|
34718
35022
|
];
|
|
34719
|
-
const encode$
|
|
35023
|
+
const encode$j = (params2, encodedAttrs) => {
|
|
34720
35024
|
const { nodes, docx, nodeListHandler: nodeListHandler2 } = params2;
|
|
34721
35025
|
const node2 = nodes[0];
|
|
34722
35026
|
let href = _resolveHref(docx, encodedAttrs);
|
|
@@ -34747,7 +35051,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34747
35051
|
}
|
|
34748
35052
|
return href;
|
|
34749
35053
|
};
|
|
34750
|
-
function decode(params2
|
|
35054
|
+
function decode(params2) {
|
|
34751
35055
|
const { node: node2 } = params2;
|
|
34752
35056
|
const linkMark = node2.marks.find((m2) => m2.type === "link");
|
|
34753
35057
|
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
@@ -34795,7 +35099,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34795
35099
|
xmlName: XML_NODE_NAME,
|
|
34796
35100
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
34797
35101
|
type: NodeTranslator.translatorTypes.NODE,
|
|
34798
|
-
encode: encode$
|
|
35102
|
+
encode: encode$j,
|
|
34799
35103
|
decode,
|
|
34800
35104
|
attributes: validXmlAttributes
|
|
34801
35105
|
};
|
|
@@ -34806,19 +35110,19 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
34806
35110
|
doc: translateDocumentNode,
|
|
34807
35111
|
body: translateBodyNode,
|
|
34808
35112
|
heading: translateHeadingNode,
|
|
34809
|
-
paragraph: translator$
|
|
35113
|
+
paragraph: translator$g,
|
|
34810
35114
|
text: translateTextNode,
|
|
34811
35115
|
bulletList: translateList,
|
|
34812
35116
|
orderedList: translateList,
|
|
34813
|
-
lineBreak: translator$
|
|
35117
|
+
lineBreak: translator$i,
|
|
34814
35118
|
table: translateTable,
|
|
34815
|
-
tableRow:
|
|
35119
|
+
tableRow: translator$2,
|
|
34816
35120
|
tableCell: translator$1,
|
|
34817
35121
|
bookmarkStart: translateBookmarkStart,
|
|
34818
35122
|
fieldAnnotation: translateFieldAnnotation,
|
|
34819
|
-
tab: translator$
|
|
35123
|
+
tab: translator$h,
|
|
34820
35124
|
image: translateImageNode,
|
|
34821
|
-
hardBreak: translator$
|
|
35125
|
+
hardBreak: translator$i,
|
|
34822
35126
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
34823
35127
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
34824
35128
|
commentReference: () => null,
|
|
@@ -35598,36 +35902,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35598
35902
|
elements
|
|
35599
35903
|
};
|
|
35600
35904
|
}
|
|
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
35905
|
function translateBookmarkStart(params2) {
|
|
35632
35906
|
const bookmarkStartNode = {
|
|
35633
35907
|
name: "w:bookmarkStart",
|
|
@@ -36847,21 +37121,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36847
37121
|
handlerName: "trackChangeNodeHandler",
|
|
36848
37122
|
handler: handleTrackChangeNode
|
|
36849
37123
|
};
|
|
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
37124
|
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator);
|
|
36866
37125
|
const handleRunNode = (params2) => {
|
|
36867
37126
|
const { nodes, nodeListHandler: nodeListHandler2, parentStyleId, docx } = params2;
|
|
@@ -36974,7 +37233,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
36974
37233
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
36975
37234
|
return { nodes: [], consumed: 0 };
|
|
36976
37235
|
}
|
|
36977
|
-
const schemaNode = translator$
|
|
37236
|
+
const schemaNode = translator$g.encode(params2);
|
|
36978
37237
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
36979
37238
|
return { nodes: newNodes, consumed: 1 };
|
|
36980
37239
|
};
|
|
@@ -37287,7 +37546,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37287
37546
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
37288
37547
|
return { nodes: [], consumed: 0 };
|
|
37289
37548
|
}
|
|
37290
|
-
const result = translator$
|
|
37549
|
+
const result = translator$i.encode(params2);
|
|
37291
37550
|
if (!result) return { nodes: [], consumed: 0 };
|
|
37292
37551
|
return {
|
|
37293
37552
|
nodes: [result],
|
|
@@ -37956,7 +38215,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37956
38215
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
37957
38216
|
return { nodes: [], consumed: 0 };
|
|
37958
38217
|
}
|
|
37959
|
-
const node2 = translator$
|
|
38218
|
+
const node2 = translator$h.encode(params2);
|
|
37960
38219
|
return { nodes: [node2], consumed: 1 };
|
|
37961
38220
|
};
|
|
37962
38221
|
const tabNodeEntityHandler = {
|
|
@@ -38153,7 +38412,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38153
38412
|
}
|
|
38154
38413
|
} catch (error) {
|
|
38155
38414
|
console.debug("Import error", error);
|
|
38156
|
-
editor?.emit("exception", { error });
|
|
38415
|
+
editor?.emit("exception", { error, editor });
|
|
38157
38416
|
converter?.telemetry?.trackStatistic("error", {
|
|
38158
38417
|
type: "processing_error",
|
|
38159
38418
|
message: error.message,
|
|
@@ -38166,7 +38425,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38166
38425
|
return processedElements;
|
|
38167
38426
|
} catch (error) {
|
|
38168
38427
|
console.debug("Error during import", error);
|
|
38169
|
-
editor?.emit("exception", { error });
|
|
38428
|
+
editor?.emit("exception", { error, editor });
|
|
38170
38429
|
converter?.telemetry?.trackStatistic("error", {
|
|
38171
38430
|
type: "fatal_error",
|
|
38172
38431
|
message: error.message,
|
|
@@ -38632,8 +38891,13 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
38632
38891
|
return { typeface, panose };
|
|
38633
38892
|
}
|
|
38634
38893
|
getSchema(editor) {
|
|
38635
|
-
|
|
38636
|
-
|
|
38894
|
+
let result;
|
|
38895
|
+
try {
|
|
38896
|
+
this.getDocumentInternalId();
|
|
38897
|
+
result = createDocumentJson({ ...this.convertedXml, media: this.media }, this, editor);
|
|
38898
|
+
} catch (error) {
|
|
38899
|
+
editor?.emit("exception", { error, editor });
|
|
38900
|
+
}
|
|
38637
38901
|
if (result) {
|
|
38638
38902
|
this.savedTagsToRestore.push({ ...result.savedTagsToRestore });
|
|
38639
38903
|
this.pageStyles = result.pageStyles;
|
|
@@ -55024,7 +55288,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
55024
55288
|
}
|
|
55025
55289
|
return { root: root2, wasFixed };
|
|
55026
55290
|
}
|
|
55027
|
-
function cleanupRootChildren(root2
|
|
55291
|
+
function cleanupRootChildren(root2) {
|
|
55028
55292
|
const validChildren = root2.elements?.filter((child) => child?.type === "element" && child.name === "Relationship") || [];
|
|
55029
55293
|
if (root2.elements?.length !== validChildren.length) {
|
|
55030
55294
|
root2.elements = validChildren;
|
|
@@ -56021,85 +56285,89 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56021
56285
|
getUpdatedDocs = false,
|
|
56022
56286
|
fieldsHighlightColor = null
|
|
56023
56287
|
} = {}) {
|
|
56024
|
-
|
|
56025
|
-
|
|
56026
|
-
|
|
56027
|
-
|
|
56028
|
-
|
|
56029
|
-
|
|
56030
|
-
|
|
56031
|
-
|
|
56032
|
-
|
|
56033
|
-
|
|
56034
|
-
|
|
56035
|
-
|
|
56036
|
-
__privateMethod$1(this, _Editor_instances, validateDocumentExport_fn).call(this);
|
|
56037
|
-
if (exportXmlOnly || exportJsonOnly) return documentXml;
|
|
56038
|
-
const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
|
|
56039
|
-
const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
|
|
56040
|
-
const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
|
|
56041
|
-
const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
|
|
56042
|
-
const media = this.converter.addedMedia;
|
|
56043
|
-
const updatedHeadersFooters = {};
|
|
56044
|
-
Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
|
|
56045
|
-
if (name.includes("header") || name.includes("footer")) {
|
|
56046
|
-
const resultXml = this.converter.schemaToXml(json2.elements[0]);
|
|
56047
|
-
updatedHeadersFooters[name] = String(resultXml);
|
|
56048
|
-
}
|
|
56049
|
-
});
|
|
56050
|
-
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
56051
|
-
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
56052
|
-
const updatedDocs = {
|
|
56053
|
-
...this.options.customUpdatedFiles,
|
|
56054
|
-
"word/document.xml": String(documentXml),
|
|
56055
|
-
"docProps/custom.xml": String(customXml),
|
|
56056
|
-
"word/settings.xml": String(customSettings),
|
|
56057
|
-
"word/_rels/document.xml.rels": String(rels),
|
|
56058
|
-
"word/numbering.xml": String(numbering),
|
|
56059
|
-
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
56060
|
-
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
56061
|
-
...updatedHeadersFooters
|
|
56062
|
-
};
|
|
56063
|
-
if (comments.length) {
|
|
56064
|
-
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
56065
|
-
const commentsExtendedXml = this.converter.schemaToXml(
|
|
56066
|
-
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
56067
|
-
);
|
|
56068
|
-
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
56069
|
-
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
56070
|
-
);
|
|
56071
|
-
const commentsIdsXml = this.converter.schemaToXml(
|
|
56072
|
-
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
56288
|
+
try {
|
|
56289
|
+
const json = __privateMethod$1(this, _Editor_instances, prepareDocumentForExport_fn).call(this, comments);
|
|
56290
|
+
const documentXml = await this.converter.exportToDocx(
|
|
56291
|
+
json,
|
|
56292
|
+
this.schema,
|
|
56293
|
+
this.storage.image.media,
|
|
56294
|
+
isFinalDoc,
|
|
56295
|
+
commentsType,
|
|
56296
|
+
comments,
|
|
56297
|
+
this,
|
|
56298
|
+
exportJsonOnly,
|
|
56299
|
+
fieldsHighlightColor
|
|
56073
56300
|
);
|
|
56074
|
-
|
|
56075
|
-
|
|
56076
|
-
|
|
56077
|
-
|
|
56078
|
-
|
|
56079
|
-
|
|
56080
|
-
|
|
56081
|
-
|
|
56082
|
-
|
|
56083
|
-
|
|
56084
|
-
|
|
56301
|
+
__privateMethod$1(this, _Editor_instances, validateDocumentExport_fn).call(this);
|
|
56302
|
+
if (exportXmlOnly || exportJsonOnly) return documentXml;
|
|
56303
|
+
const customXml = this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]);
|
|
56304
|
+
const styles = this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]);
|
|
56305
|
+
const customSettings = this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]);
|
|
56306
|
+
const rels = this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]);
|
|
56307
|
+
const media = this.converter.addedMedia;
|
|
56308
|
+
const updatedHeadersFooters = {};
|
|
56309
|
+
Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
|
|
56310
|
+
if (name.includes("header") || name.includes("footer")) {
|
|
56311
|
+
const resultXml = this.converter.schemaToXml(json2.elements[0]);
|
|
56312
|
+
updatedHeadersFooters[name] = String(resultXml);
|
|
56313
|
+
}
|
|
56314
|
+
});
|
|
56315
|
+
const numberingData = this.converter.convertedXml["word/numbering.xml"];
|
|
56316
|
+
const numbering = this.converter.schemaToXml(numberingData.elements[0]);
|
|
56317
|
+
const updatedDocs = {
|
|
56318
|
+
...this.options.customUpdatedFiles,
|
|
56319
|
+
"word/document.xml": String(documentXml),
|
|
56320
|
+
"docProps/custom.xml": String(customXml),
|
|
56321
|
+
"word/settings.xml": String(customSettings),
|
|
56322
|
+
"word/_rels/document.xml.rels": String(rels),
|
|
56323
|
+
"word/numbering.xml": String(numbering),
|
|
56324
|
+
// Replace & with & in styles.xml as DOCX viewers can't handle it
|
|
56325
|
+
"word/styles.xml": String(styles).replace(/&/gi, "&"),
|
|
56326
|
+
...updatedHeadersFooters
|
|
56327
|
+
};
|
|
56328
|
+
if (comments.length) {
|
|
56329
|
+
const commentsXml = this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]);
|
|
56330
|
+
const commentsExtendedXml = this.converter.schemaToXml(
|
|
56331
|
+
this.converter.convertedXml["word/commentsExtended.xml"].elements[0]
|
|
56332
|
+
);
|
|
56333
|
+
const commentsExtensibleXml = this.converter.schemaToXml(
|
|
56334
|
+
this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]
|
|
56335
|
+
);
|
|
56336
|
+
const commentsIdsXml = this.converter.schemaToXml(
|
|
56337
|
+
this.converter.convertedXml["word/commentsIds.xml"].elements[0]
|
|
56338
|
+
);
|
|
56339
|
+
updatedDocs["word/comments.xml"] = String(commentsXml);
|
|
56340
|
+
updatedDocs["word/commentsExtended.xml"] = String(commentsExtendedXml);
|
|
56341
|
+
updatedDocs["word/commentsExtensible.xml"] = String(commentsExtensibleXml);
|
|
56342
|
+
updatedDocs["word/commentsIds.xml"] = String(commentsIdsXml);
|
|
56343
|
+
}
|
|
56344
|
+
const zipper = new DocxZipper();
|
|
56345
|
+
if (getUpdatedDocs) {
|
|
56346
|
+
updatedDocs["[Content_Types].xml"] = await zipper.updateContentTypes(
|
|
56347
|
+
{
|
|
56348
|
+
files: this.options.content
|
|
56349
|
+
},
|
|
56350
|
+
media,
|
|
56351
|
+
true
|
|
56352
|
+
);
|
|
56353
|
+
return updatedDocs;
|
|
56354
|
+
}
|
|
56355
|
+
const result = await zipper.updateZip({
|
|
56356
|
+
docx: this.options.content,
|
|
56357
|
+
updatedDocs,
|
|
56358
|
+
originalDocxFile: this.options.fileSource,
|
|
56085
56359
|
media,
|
|
56086
|
-
|
|
56087
|
-
|
|
56088
|
-
|
|
56360
|
+
fonts: this.options.fonts,
|
|
56361
|
+
isHeadless: this.options.isHeadless
|
|
56362
|
+
});
|
|
56363
|
+
this.options.telemetry?.trackUsage("document_export", {
|
|
56364
|
+
documentType: "docx",
|
|
56365
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
56366
|
+
});
|
|
56367
|
+
return result;
|
|
56368
|
+
} catch (error) {
|
|
56369
|
+
this.emit("exception", { error, editor: this });
|
|
56089
56370
|
}
|
|
56090
|
-
const result = await zipper.updateZip({
|
|
56091
|
-
docx: this.options.content,
|
|
56092
|
-
updatedDocs,
|
|
56093
|
-
originalDocxFile: this.options.fileSource,
|
|
56094
|
-
media,
|
|
56095
|
-
fonts: this.options.fonts,
|
|
56096
|
-
isHeadless: this.options.isHeadless
|
|
56097
|
-
});
|
|
56098
|
-
this.options.telemetry?.trackUsage("document_export", {
|
|
56099
|
-
documentType: "docx",
|
|
56100
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
56101
|
-
});
|
|
56102
|
-
return result;
|
|
56103
56371
|
}
|
|
56104
56372
|
/**
|
|
56105
56373
|
* Destroy the editor and clean up resources
|
|
@@ -56120,7 +56388,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56120
56388
|
}
|
|
56121
56389
|
this.converter.headerEditors.length = 0;
|
|
56122
56390
|
this.converter.footerEditors.length = 0;
|
|
56123
|
-
} catch {
|
|
56391
|
+
} catch (error) {
|
|
56392
|
+
this.emit("exception", { error, editor: this });
|
|
56124
56393
|
}
|
|
56125
56394
|
}
|
|
56126
56395
|
/**
|
|
@@ -56185,7 +56454,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56185
56454
|
this.initDefaultStyles();
|
|
56186
56455
|
if (this.options.ydoc && this.options.collaborationProvider) {
|
|
56187
56456
|
updateYdocDocxData(this);
|
|
56188
|
-
this.initializeCollaborationData(
|
|
56457
|
+
this.initializeCollaborationData();
|
|
56189
56458
|
} else {
|
|
56190
56459
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
56191
56460
|
}
|
|
@@ -56345,7 +56614,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56345
56614
|
this.on("beforeCreate", this.options.onBeforeCreate);
|
|
56346
56615
|
this.emit("beforeCreate", { editor: this });
|
|
56347
56616
|
this.on("contentError", this.options.onContentError);
|
|
56348
|
-
this.on("exception", this.options.onException);
|
|
56349
56617
|
this.mount(this.options.element);
|
|
56350
56618
|
this.on("create", this.options.onCreate);
|
|
56351
56619
|
this.on("update", this.options.onUpdate);
|
|
@@ -56363,6 +56631,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56363
56631
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
56364
56632
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
56365
56633
|
this.on("list-definitions-change", this.options.onListDefinitionsChange);
|
|
56634
|
+
this.on("exception", this.options.onException);
|
|
56366
56635
|
if (!this.options.isHeadless) {
|
|
56367
56636
|
this.initializeCollaborationData();
|
|
56368
56637
|
this.initDefaultStyles();
|
|
@@ -56689,7 +56958,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
56689
56958
|
console.debug("🔗 [super-editor] Ending collaboration");
|
|
56690
56959
|
if (this.options.collaborationProvider) this.options.collaborationProvider.disconnect();
|
|
56691
56960
|
if (this.options.ydoc) this.options.ydoc.destroy();
|
|
56692
|
-
} catch {
|
|
56961
|
+
} catch (error) {
|
|
56962
|
+
this.emit("exception", { error, editor: this });
|
|
56693
56963
|
}
|
|
56694
56964
|
};
|
|
56695
56965
|
validateDocumentInit_fn = function() {
|
|
@@ -63697,7 +63967,49 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
63697
63967
|
if (!cantSplit) return {};
|
|
63698
63968
|
return { "data-cant-split": "true" };
|
|
63699
63969
|
}
|
|
63700
|
-
}
|
|
63970
|
+
},
|
|
63971
|
+
/**
|
|
63972
|
+
* @category Attribute
|
|
63973
|
+
* @param {TableRowProperties} [tableRowProperties] - Properties for the table row.
|
|
63974
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 377-482
|
|
63975
|
+
*/
|
|
63976
|
+
tableRowProperties: { rendered: false },
|
|
63977
|
+
/**
|
|
63978
|
+
* @category Attribute
|
|
63979
|
+
* @param {string} [rsidDel] - Unique identifier used to track the editing session when the row was deleted from the main document.
|
|
63980
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
63981
|
+
*/
|
|
63982
|
+
rsidDel: { rendered: false },
|
|
63983
|
+
/**
|
|
63984
|
+
* @category Attribute
|
|
63985
|
+
* @param {string} [rsidR] - Unique identifier used to track the editing session when the table row was added to the main document.
|
|
63986
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 472
|
|
63987
|
+
*/
|
|
63988
|
+
rsidR: { rendered: false },
|
|
63989
|
+
/**
|
|
63990
|
+
* @category Attribute
|
|
63991
|
+
* @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.
|
|
63992
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
63993
|
+
*/
|
|
63994
|
+
rsidRPr: { rendered: false },
|
|
63995
|
+
/**
|
|
63996
|
+
* @category Attribute
|
|
63997
|
+
* @param {string} [rsidTr] - Unique identifier used to track the editing session when the table row's properties were last modified in this document.
|
|
63998
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 473
|
|
63999
|
+
*/
|
|
64000
|
+
rsidTr: { rendered: false },
|
|
64001
|
+
/**
|
|
64002
|
+
* @category Attribute
|
|
64003
|
+
* @param {string} [paraId] - A randomly generated unique identifier for the table row.
|
|
64004
|
+
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/a0e7d2e2-2246-44c6-96e8-1cf009823615}
|
|
64005
|
+
*/
|
|
64006
|
+
paraId: { rendered: false },
|
|
64007
|
+
/**
|
|
64008
|
+
* @category Attribute
|
|
64009
|
+
* @param {string} [textId] - A randomly generated unique identifier for the text of the table row.
|
|
64010
|
+
* @see {@link https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/b7eeddec-7c50-47fb-88b6-1feec3ed832c}
|
|
64011
|
+
*/
|
|
64012
|
+
textId: { rendered: false }
|
|
63701
64013
|
};
|
|
63702
64014
|
},
|
|
63703
64015
|
parseDOM() {
|
|
@@ -65936,6 +66248,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65936
66248
|
file = processedImageResult.file;
|
|
65937
66249
|
} catch (err) {
|
|
65938
66250
|
console.warn("Error processing image:", err);
|
|
66251
|
+
editor.emit("exception", { error: err, editor });
|
|
65939
66252
|
return;
|
|
65940
66253
|
}
|
|
65941
66254
|
await uploadImage({
|
|
@@ -65990,9 +66303,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
65990
66303
|
view.dispatch(
|
|
65991
66304
|
view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
|
|
65992
66305
|
);
|
|
65993
|
-
} catch {
|
|
66306
|
+
} catch (error) {
|
|
65994
66307
|
let removeMeta = { type: "remove", id };
|
|
65995
66308
|
view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
|
|
66309
|
+
editor.emit("exception", { error, editor });
|
|
65996
66310
|
}
|
|
65997
66311
|
}
|
|
65998
66312
|
function addImageRelationship({ editor, path }) {
|
|
@@ -87531,7 +87845,9 @@ ${style2}
|
|
|
87531
87845
|
} else if (typeof command2 === "function") {
|
|
87532
87846
|
command2({ item, argument, option });
|
|
87533
87847
|
} else {
|
|
87534
|
-
|
|
87848
|
+
const error = new Error(`[super-toolbar 🎨] Command not found: ${command2}`);
|
|
87849
|
+
this.emit("exception", { error, editor: this.activeEditor });
|
|
87850
|
+
throw error;
|
|
87535
87851
|
}
|
|
87536
87852
|
this.updateToolbarState();
|
|
87537
87853
|
}
|
|
@@ -88786,6 +89102,9 @@ ${style2}
|
|
|
88786
89102
|
return { content: docx, media, mediaFiles, fonts };
|
|
88787
89103
|
} catch (err) {
|
|
88788
89104
|
console.debug("Error loading new file data:", err);
|
|
89105
|
+
if (typeof props.options.onException === "function") {
|
|
89106
|
+
props.options.onException({ error: err, editor: null });
|
|
89107
|
+
}
|
|
88789
89108
|
}
|
|
88790
89109
|
};
|
|
88791
89110
|
const initializeData = async () => {
|
|
@@ -88988,7 +89307,7 @@ ${style2}
|
|
|
88988
89307
|
};
|
|
88989
89308
|
}
|
|
88990
89309
|
};
|
|
88991
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-
|
|
89310
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-0c36dd72"]]);
|
|
88992
89311
|
const _hoisted_1$h = ["innerHTML"];
|
|
88993
89312
|
const _sfc_main$i = {
|
|
88994
89313
|
__name: "SuperInput",
|
|
@@ -89081,9 +89400,9 @@ ${style2}
|
|
|
89081
89400
|
};
|
|
89082
89401
|
const SuperInput = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__scopeId", "data-v-4d5cff52"]]);
|
|
89083
89402
|
const registeredHandlers = Object.freeze({
|
|
89084
|
-
"w:br": translator$
|
|
89085
|
-
"w:tab": translator$
|
|
89086
|
-
"w:p": translator$
|
|
89403
|
+
"w:br": translator$i,
|
|
89404
|
+
"w:tab": translator$h,
|
|
89405
|
+
"w:p": translator$g
|
|
89087
89406
|
});
|
|
89088
89407
|
const Extensions = {
|
|
89089
89408
|
Node: Node$1,
|
|
@@ -92140,6 +92459,7 @@ ${reason}`);
|
|
|
92140
92459
|
}
|
|
92141
92460
|
const useSuperdocStore = /* @__PURE__ */ defineStore("superdoc", () => {
|
|
92142
92461
|
const currentConfig = ref$1(null);
|
|
92462
|
+
let exceptionHandler = null;
|
|
92143
92463
|
const commentsStore = useCommentsStore();
|
|
92144
92464
|
const documents = ref$1([]);
|
|
92145
92465
|
const documentBounds = ref$1([]);
|
|
@@ -92174,6 +92494,13 @@ ${reason}`);
|
|
|
92174
92494
|
scrollTop: 0,
|
|
92175
92495
|
scrollLeft: 0
|
|
92176
92496
|
});
|
|
92497
|
+
const setExceptionHandler = (handler2) => {
|
|
92498
|
+
exceptionHandler = typeof handler2 === "function" ? handler2 : null;
|
|
92499
|
+
};
|
|
92500
|
+
const emitException = (payload) => {
|
|
92501
|
+
const handler2 = exceptionHandler || currentConfig.value?.onException;
|
|
92502
|
+
if (typeof handler2 === "function") handler2(payload);
|
|
92503
|
+
};
|
|
92177
92504
|
const init2 = async (config2) => {
|
|
92178
92505
|
reset();
|
|
92179
92506
|
currentConfig.value = config2;
|
|
@@ -92199,11 +92526,30 @@ ${reason}`);
|
|
|
92199
92526
|
const initializeDocuments = async (docsToProcess = []) => {
|
|
92200
92527
|
if (!docsToProcess) return [];
|
|
92201
92528
|
for (let doc2 of docsToProcess) {
|
|
92529
|
+
if (!doc2) {
|
|
92530
|
+
emitException({
|
|
92531
|
+
error: new Error("Received empty document entry during initialization."),
|
|
92532
|
+
stage: "document-init",
|
|
92533
|
+
document: doc2
|
|
92534
|
+
});
|
|
92535
|
+
console.warn("[superdoc] Skipping empty document entry.");
|
|
92536
|
+
continue;
|
|
92537
|
+
}
|
|
92202
92538
|
try {
|
|
92203
92539
|
let docWithData = await _initializeDocumentData(doc2);
|
|
92540
|
+
if (!docWithData) {
|
|
92541
|
+
emitException({
|
|
92542
|
+
error: new Error("Document could not be initialized with the provided configuration."),
|
|
92543
|
+
stage: "document-init",
|
|
92544
|
+
document: doc2
|
|
92545
|
+
});
|
|
92546
|
+
console.warn("[superdoc] Skipping document due to invalid configuration:", doc2);
|
|
92547
|
+
continue;
|
|
92548
|
+
}
|
|
92204
92549
|
const smartDoc = useDocument(docWithData, currentConfig.value);
|
|
92205
92550
|
documents.value.push(smartDoc);
|
|
92206
92551
|
} catch (e) {
|
|
92552
|
+
emitException({ error: e, stage: "document-init", document: doc2 });
|
|
92207
92553
|
console.warn("[superdoc] Error initializing document:", doc2, "with error:", e, "Skipping document.");
|
|
92208
92554
|
}
|
|
92209
92555
|
}
|
|
@@ -92247,7 +92593,7 @@ ${reason}`);
|
|
|
92247
92593
|
const fileObject = await getFileObject(doc2.url, doc2.name || "document", doc2.type);
|
|
92248
92594
|
return { ...doc2, data: fileObject };
|
|
92249
92595
|
}
|
|
92250
|
-
|
|
92596
|
+
return null;
|
|
92251
92597
|
};
|
|
92252
92598
|
const areDocumentsReady = computed(() => {
|
|
92253
92599
|
for (let obj of documents.value.filter((doc2) => doc2.type === "pdf")) {
|
|
@@ -92297,6 +92643,7 @@ ${reason}`);
|
|
|
92297
92643
|
areDocumentsReady,
|
|
92298
92644
|
// Actions
|
|
92299
92645
|
init: init2,
|
|
92646
|
+
setExceptionHandler,
|
|
92300
92647
|
reset,
|
|
92301
92648
|
handlePageReady,
|
|
92302
92649
|
getDocument,
|
|
@@ -106441,6 +106788,9 @@ ${style2}
|
|
|
106441
106788
|
this.superdocStore = superdocStore;
|
|
106442
106789
|
this.commentsStore = commentsStore;
|
|
106443
106790
|
this.highContrastModeStore = highContrastModeStore;
|
|
106791
|
+
if (typeof this.superdocStore.setExceptionHandler === "function") {
|
|
106792
|
+
this.superdocStore.setExceptionHandler((payload) => this.emit("exception", payload));
|
|
106793
|
+
}
|
|
106444
106794
|
this.superdocStore.init(this.config);
|
|
106445
106795
|
this.commentsStore.init(this.config.modules.comments);
|
|
106446
106796
|
}
|
|
@@ -106636,6 +106986,7 @@ ${style2}
|
|
|
106636
106986
|
};
|
|
106637
106987
|
this.toolbar = new SuperToolbar(config2);
|
|
106638
106988
|
this.toolbar.on("superdoc-command", this.onToolbarCommand.bind(this));
|
|
106989
|
+
this.toolbar.on("exception", this.config.onException);
|
|
106639
106990
|
this.once("editorCreate", () => this.toolbar.updateToolbarState());
|
|
106640
106991
|
}
|
|
106641
106992
|
/**
|