@harbour-enterprises/superdoc 0.19.0-next.1 → 0.19.0-next.2
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-C2T9YTtR.cjs → PdfViewer-D-X0_rBI.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DXueyp6G.es.js → PdfViewer-D59q6eRC.es.js} +1 -1
- package/dist/chunks/{index-DYPEIENP.es.js → index-DYxO8sGC.es.js} +2 -2
- package/dist/chunks/{index-Do3Yz9zO.cjs → index-Q9QnSj8V.cjs} +2 -2
- package/dist/chunks/{super-editor.es-BY32iqnX.es.js → super-editor.es-DcrpYhcf.es.js} +265 -182
- package/dist/chunks/{super-editor.es-ehqZe3p-.cjs → super-editor.es-DfRBE7HT.cjs} +265 -182
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-X9LxTGJB.js → converter-C8B4S-1x.js} +224 -175
- package/dist/super-editor/chunks/{docx-zipper-CAu7OzVm.js → docx-zipper-BOcyXVbk.js} +1 -1
- package/dist/super-editor/chunks/{editor-DJIu60o8.js → editor-DSLtHYXL.js} +43 -9
- package/dist/super-editor/chunks/{toolbar-DYCZq9kV.js → toolbar-bgMTmwZ7.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/v2/importer/docxImporter.d.ts +2 -2
- package/dist/super-editor/src/core/super-converter/v2/importer/hyperlinkImporter.d.ts +2 -6
- package/dist/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/hyperlink/hyperlink-translator.d.ts +7 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/hyperlink/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -1
- package/dist/super-editor/src/extensions/link/link.d.ts +4 -0
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 +265 -182
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -25568,7 +25568,7 @@ const _NodeTranslator = class _NodeTranslator2 {
|
|
|
25568
25568
|
*/
|
|
25569
25569
|
decode(params2) {
|
|
25570
25570
|
const decodedAttrs = this.decodeAttributes(params2);
|
|
25571
|
-
return this.decodeFn ? this.decodeFn(params2, decodedAttrs) : void 0;
|
|
25571
|
+
return this.decodeFn ? this.decodeFn.call(this, params2, decodedAttrs) : void 0;
|
|
25572
25572
|
}
|
|
25573
25573
|
/**
|
|
25574
25574
|
* Encode the attributes for the node.
|
|
@@ -25577,7 +25577,7 @@ const _NodeTranslator = class _NodeTranslator2 {
|
|
|
25577
25577
|
*/
|
|
25578
25578
|
encode(params2) {
|
|
25579
25579
|
const encodedAttrs = this.encodeAttributes(params2);
|
|
25580
|
-
return this.encodeFn ? this.encodeFn(params2, encodedAttrs) : void 0;
|
|
25580
|
+
return this.encodeFn ? this.encodeFn.call(this, params2, encodedAttrs) : void 0;
|
|
25581
25581
|
}
|
|
25582
25582
|
/**
|
|
25583
25583
|
* Create a new NodeTranslator instance from a configuration object.
|
|
@@ -25611,37 +25611,37 @@ const _NodeTranslator = class _NodeTranslator2 {
|
|
|
25611
25611
|
};
|
|
25612
25612
|
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
25613
25613
|
let NodeTranslator = _NodeTranslator;
|
|
25614
|
-
const encode$
|
|
25614
|
+
const encode$g = (attributes) => {
|
|
25615
25615
|
return attributes["w:type"];
|
|
25616
25616
|
};
|
|
25617
|
-
const decode$
|
|
25617
|
+
const decode$g = (attrs) => {
|
|
25618
25618
|
const { lineBreakType } = attrs;
|
|
25619
25619
|
return lineBreakType;
|
|
25620
25620
|
};
|
|
25621
25621
|
const attrConfig$b = Object.freeze({
|
|
25622
25622
|
xmlName: "w:type",
|
|
25623
25623
|
sdName: "lineBreakType",
|
|
25624
|
-
encode: encode$
|
|
25625
|
-
decode: decode$
|
|
25624
|
+
encode: encode$g,
|
|
25625
|
+
decode: decode$g
|
|
25626
25626
|
});
|
|
25627
|
-
const encode$
|
|
25627
|
+
const encode$f = (attributes) => {
|
|
25628
25628
|
const xmlAttrValue = attributes["w:clear"];
|
|
25629
25629
|
return xmlAttrValue;
|
|
25630
25630
|
};
|
|
25631
|
-
const decode$
|
|
25631
|
+
const decode$f = (attrs) => {
|
|
25632
25632
|
const { clear } = attrs;
|
|
25633
25633
|
return clear;
|
|
25634
25634
|
};
|
|
25635
25635
|
const attrConfig$a = Object.freeze({
|
|
25636
25636
|
xmlName: "w:clear",
|
|
25637
25637
|
sdName: "clear",
|
|
25638
|
-
encode: encode$
|
|
25639
|
-
decode: decode$
|
|
25638
|
+
encode: encode$f,
|
|
25639
|
+
decode: decode$f
|
|
25640
25640
|
});
|
|
25641
|
-
const validXmlAttributes$
|
|
25642
|
-
const XML_NODE_NAME$
|
|
25643
|
-
const SD_NODE_NAME$
|
|
25644
|
-
const encode$
|
|
25641
|
+
const validXmlAttributes$4 = [attrConfig$b, attrConfig$a];
|
|
25642
|
+
const XML_NODE_NAME$4 = "w:br";
|
|
25643
|
+
const SD_NODE_NAME$4 = "lineBreak";
|
|
25644
|
+
const encode$e = (_2, encodedAttrs) => {
|
|
25645
25645
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
25646
25646
|
const translated = {
|
|
25647
25647
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -25651,7 +25651,7 @@ const encode$d = (_2, encodedAttrs) => {
|
|
|
25651
25651
|
}
|
|
25652
25652
|
return translated;
|
|
25653
25653
|
};
|
|
25654
|
-
const decode$
|
|
25654
|
+
const decode$e = (params2, decodedAttrs) => {
|
|
25655
25655
|
const { node: node2 } = params2;
|
|
25656
25656
|
if (!node2) return;
|
|
25657
25657
|
const wBreak = { name: "w:br" };
|
|
@@ -25668,63 +25668,63 @@ const decode$d = (params2, decodedAttrs) => {
|
|
|
25668
25668
|
};
|
|
25669
25669
|
return translated;
|
|
25670
25670
|
};
|
|
25671
|
-
const config$
|
|
25672
|
-
xmlName: XML_NODE_NAME$
|
|
25673
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
25671
|
+
const config$4 = {
|
|
25672
|
+
xmlName: XML_NODE_NAME$4,
|
|
25673
|
+
sdNodeOrKeyName: SD_NODE_NAME$4,
|
|
25674
25674
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25675
|
-
encode: encode$
|
|
25676
|
-
decode: decode$
|
|
25677
|
-
attributes: validXmlAttributes$
|
|
25675
|
+
encode: encode$e,
|
|
25676
|
+
decode: decode$e,
|
|
25677
|
+
attributes: validXmlAttributes$4
|
|
25678
25678
|
};
|
|
25679
|
-
const translator$
|
|
25680
|
-
const encode$
|
|
25679
|
+
const translator$4 = NodeTranslator.from(config$4);
|
|
25680
|
+
const encode$d = (attributes) => {
|
|
25681
25681
|
return attributes["w:val"];
|
|
25682
25682
|
};
|
|
25683
|
-
const decode$
|
|
25683
|
+
const decode$d = (attrs) => {
|
|
25684
25684
|
const { tabSize } = attrs || {};
|
|
25685
25685
|
return tabSize;
|
|
25686
25686
|
};
|
|
25687
25687
|
const attrConfig$9 = Object.freeze({
|
|
25688
25688
|
xmlName: "w:val",
|
|
25689
25689
|
sdName: "tabSize",
|
|
25690
|
-
encode: encode$
|
|
25691
|
-
decode: decode$
|
|
25690
|
+
encode: encode$d,
|
|
25691
|
+
decode: decode$d
|
|
25692
25692
|
});
|
|
25693
|
-
const encode$
|
|
25693
|
+
const encode$c = (attributes) => {
|
|
25694
25694
|
return attributes["w:leader"];
|
|
25695
25695
|
};
|
|
25696
|
-
const decode$
|
|
25696
|
+
const decode$c = (attrs) => {
|
|
25697
25697
|
const { leader } = attrs || {};
|
|
25698
25698
|
return leader;
|
|
25699
25699
|
};
|
|
25700
25700
|
const attrConfig$8 = Object.freeze({
|
|
25701
25701
|
xmlName: "w:leader",
|
|
25702
25702
|
sdName: "leader",
|
|
25703
|
-
encode: encode$
|
|
25704
|
-
decode: decode$
|
|
25703
|
+
encode: encode$c,
|
|
25704
|
+
decode: decode$c
|
|
25705
25705
|
});
|
|
25706
|
-
const encode$
|
|
25706
|
+
const encode$b = (attributes) => {
|
|
25707
25707
|
return attributes["w:pos"];
|
|
25708
25708
|
};
|
|
25709
|
-
const decode$
|
|
25709
|
+
const decode$b = (attrs) => {
|
|
25710
25710
|
const { pos } = attrs || {};
|
|
25711
25711
|
return pos;
|
|
25712
25712
|
};
|
|
25713
25713
|
const attrConfig$7 = Object.freeze({
|
|
25714
25714
|
xmlName: "w:pos",
|
|
25715
25715
|
sdName: "pos",
|
|
25716
|
-
encode: encode$
|
|
25717
|
-
decode: decode$
|
|
25716
|
+
encode: encode$b,
|
|
25717
|
+
decode: decode$b
|
|
25718
25718
|
});
|
|
25719
|
-
const validXmlAttributes$
|
|
25720
|
-
const XML_NODE_NAME$
|
|
25721
|
-
const SD_NODE_NAME$
|
|
25722
|
-
const encode$
|
|
25719
|
+
const validXmlAttributes$3 = [attrConfig$9, attrConfig$7, attrConfig$8];
|
|
25720
|
+
const XML_NODE_NAME$3 = "w:tab";
|
|
25721
|
+
const SD_NODE_NAME$3 = "tab";
|
|
25722
|
+
const encode$a = (_2, encodedAttrs = {}) => {
|
|
25723
25723
|
const translated = { type: "tab" };
|
|
25724
25724
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
25725
25725
|
return translated;
|
|
25726
25726
|
};
|
|
25727
|
-
const decode$
|
|
25727
|
+
const decode$a = (params2, decodedAttrs = {}) => {
|
|
25728
25728
|
const { node: node2 } = params2 || {};
|
|
25729
25729
|
if (!node2) return;
|
|
25730
25730
|
const wTab = { name: "w:tab" };
|
|
@@ -25740,15 +25740,15 @@ const decode$9 = (params2, decodedAttrs = {}) => {
|
|
|
25740
25740
|
}
|
|
25741
25741
|
return translated;
|
|
25742
25742
|
};
|
|
25743
|
-
const config$
|
|
25744
|
-
xmlName: XML_NODE_NAME$
|
|
25745
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
25743
|
+
const config$3 = {
|
|
25744
|
+
xmlName: XML_NODE_NAME$3,
|
|
25745
|
+
sdNodeOrKeyName: SD_NODE_NAME$3,
|
|
25746
25746
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25747
|
-
encode: encode$
|
|
25748
|
-
decode: decode$
|
|
25749
|
-
attributes: validXmlAttributes$
|
|
25747
|
+
encode: encode$a,
|
|
25748
|
+
decode: decode$a,
|
|
25749
|
+
attributes: validXmlAttributes$3
|
|
25750
25750
|
};
|
|
25751
|
-
const translator$
|
|
25751
|
+
const translator$3 = NodeTranslator.from(config$3);
|
|
25752
25752
|
const mergeTextNodes = (nodes) => {
|
|
25753
25753
|
if (!nodes || !Array.isArray(nodes)) {
|
|
25754
25754
|
return nodes;
|
|
@@ -26318,91 +26318,91 @@ const handleParagraphNode$1 = (params2) => {
|
|
|
26318
26318
|
}
|
|
26319
26319
|
return schemaNode;
|
|
26320
26320
|
};
|
|
26321
|
-
const encode$
|
|
26321
|
+
const encode$9 = (attributes) => {
|
|
26322
26322
|
return attributes["w:rsidDel"];
|
|
26323
26323
|
};
|
|
26324
|
-
const decode$
|
|
26324
|
+
const decode$9 = (attrs) => {
|
|
26325
26325
|
return attrs.rsidDel;
|
|
26326
26326
|
};
|
|
26327
26327
|
const attrConfig$6 = Object.freeze({
|
|
26328
26328
|
xmlName: "w:rsidDel",
|
|
26329
26329
|
sdName: "rsidDel",
|
|
26330
|
-
encode: encode$
|
|
26331
|
-
decode: decode$
|
|
26330
|
+
encode: encode$9,
|
|
26331
|
+
decode: decode$9
|
|
26332
26332
|
});
|
|
26333
|
-
const encode$
|
|
26333
|
+
const encode$8 = (attributes) => {
|
|
26334
26334
|
return attributes["w:rsidP"];
|
|
26335
26335
|
};
|
|
26336
|
-
const decode$
|
|
26336
|
+
const decode$8 = (attrs) => {
|
|
26337
26337
|
return attrs.rsidP;
|
|
26338
26338
|
};
|
|
26339
26339
|
const attrConfig$5 = Object.freeze({
|
|
26340
26340
|
xmlName: "w:rsidP",
|
|
26341
26341
|
sdName: "rsidP",
|
|
26342
|
-
encode: encode$
|
|
26343
|
-
decode: decode$
|
|
26342
|
+
encode: encode$8,
|
|
26343
|
+
decode: decode$8
|
|
26344
26344
|
});
|
|
26345
|
-
const encode$
|
|
26345
|
+
const encode$7 = (attributes) => {
|
|
26346
26346
|
return attributes["w:rsidR"];
|
|
26347
26347
|
};
|
|
26348
|
-
const decode$
|
|
26348
|
+
const decode$7 = (attrs) => {
|
|
26349
26349
|
return attrs.rsidR;
|
|
26350
26350
|
};
|
|
26351
26351
|
const attrConfig$4 = Object.freeze({
|
|
26352
26352
|
xmlName: "w:rsidR",
|
|
26353
26353
|
sdName: "rsidR",
|
|
26354
|
-
encode: encode$
|
|
26355
|
-
decode: decode$
|
|
26354
|
+
encode: encode$7,
|
|
26355
|
+
decode: decode$7
|
|
26356
26356
|
});
|
|
26357
|
-
const encode$
|
|
26357
|
+
const encode$6 = (attributes) => {
|
|
26358
26358
|
return attributes["w:rsidRPr"];
|
|
26359
26359
|
};
|
|
26360
|
-
const decode$
|
|
26360
|
+
const decode$6 = (attrs) => {
|
|
26361
26361
|
return attrs.rsidRPr;
|
|
26362
26362
|
};
|
|
26363
26363
|
const attrConfig$3 = Object.freeze({
|
|
26364
26364
|
xmlName: "w:rsidRPr",
|
|
26365
26365
|
sdName: "rsidRPr",
|
|
26366
|
-
encode: encode$
|
|
26367
|
-
decode: decode$
|
|
26366
|
+
encode: encode$6,
|
|
26367
|
+
decode: decode$6
|
|
26368
26368
|
});
|
|
26369
|
-
const encode$
|
|
26369
|
+
const encode$5 = (attributes) => {
|
|
26370
26370
|
return attributes["w:rsidRDefault"];
|
|
26371
26371
|
};
|
|
26372
|
-
const decode$
|
|
26372
|
+
const decode$5 = (attrs) => {
|
|
26373
26373
|
return attrs.rsidRDefault;
|
|
26374
26374
|
};
|
|
26375
26375
|
const attrConfig$2 = Object.freeze({
|
|
26376
26376
|
xmlName: "w:rsidRDefault",
|
|
26377
26377
|
sdName: "rsidRDefault",
|
|
26378
|
-
encode: encode$
|
|
26379
|
-
decode: decode$
|
|
26378
|
+
encode: encode$5,
|
|
26379
|
+
decode: decode$5
|
|
26380
26380
|
});
|
|
26381
|
-
const encode$
|
|
26381
|
+
const encode$4 = (attributes) => {
|
|
26382
26382
|
return attributes["w14:paraId"];
|
|
26383
26383
|
};
|
|
26384
|
-
const decode$
|
|
26384
|
+
const decode$4 = (attrs) => {
|
|
26385
26385
|
return attrs.paraId;
|
|
26386
26386
|
};
|
|
26387
26387
|
const attrConfig$1 = Object.freeze({
|
|
26388
26388
|
xmlName: "w14:paraId",
|
|
26389
26389
|
sdName: "paraId",
|
|
26390
|
-
encode: encode$
|
|
26391
|
-
decode: decode$
|
|
26390
|
+
encode: encode$4,
|
|
26391
|
+
decode: decode$4
|
|
26392
26392
|
});
|
|
26393
|
-
const encode$
|
|
26393
|
+
const encode$3 = (attributes) => {
|
|
26394
26394
|
return attributes["w14:textId"];
|
|
26395
26395
|
};
|
|
26396
|
-
const decode$
|
|
26396
|
+
const decode$3 = (attrs) => {
|
|
26397
26397
|
return attrs.textId;
|
|
26398
26398
|
};
|
|
26399
26399
|
const attrConfig = Object.freeze({
|
|
26400
26400
|
xmlName: "w14:textId",
|
|
26401
26401
|
sdName: "textId",
|
|
26402
|
-
encode: encode$
|
|
26403
|
-
decode: decode$
|
|
26402
|
+
encode: encode$3,
|
|
26403
|
+
decode: decode$3
|
|
26404
26404
|
});
|
|
26405
|
-
const validXmlAttributes$
|
|
26405
|
+
const validXmlAttributes$2 = [
|
|
26406
26406
|
attrConfig$1,
|
|
26407
26407
|
attrConfig,
|
|
26408
26408
|
attrConfig$4,
|
|
@@ -26411,9 +26411,9 @@ const validXmlAttributes$1 = [
|
|
|
26411
26411
|
attrConfig$3,
|
|
26412
26412
|
attrConfig$6
|
|
26413
26413
|
];
|
|
26414
|
-
const XML_NODE_NAME$
|
|
26415
|
-
const SD_NODE_NAME$
|
|
26416
|
-
const encode$
|
|
26414
|
+
const XML_NODE_NAME$2 = "w:p";
|
|
26415
|
+
const SD_NODE_NAME$2 = "paragraph";
|
|
26416
|
+
const encode$2 = (params2, encodedAttrs = {}) => {
|
|
26417
26417
|
const node2 = handleParagraphNode$1(params2);
|
|
26418
26418
|
if (!node2) return void 0;
|
|
26419
26419
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -26421,7 +26421,7 @@ const encode$1 = (params2, encodedAttrs = {}) => {
|
|
|
26421
26421
|
}
|
|
26422
26422
|
return node2;
|
|
26423
26423
|
};
|
|
26424
|
-
const decode$
|
|
26424
|
+
const decode$2 = (params2, decodedAttrs = {}) => {
|
|
26425
26425
|
const translated = translateParagraphNode(params2);
|
|
26426
26426
|
if (!translated) return void 0;
|
|
26427
26427
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -26429,15 +26429,15 @@ const decode$1 = (params2, decodedAttrs = {}) => {
|
|
|
26429
26429
|
}
|
|
26430
26430
|
return translated;
|
|
26431
26431
|
};
|
|
26432
|
-
const config$
|
|
26433
|
-
xmlName: XML_NODE_NAME$
|
|
26434
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
26432
|
+
const config$2 = {
|
|
26433
|
+
xmlName: XML_NODE_NAME$2,
|
|
26434
|
+
sdNodeOrKeyName: SD_NODE_NAME$2,
|
|
26435
26435
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26436
|
-
encode: encode$
|
|
26437
|
-
decode: decode$
|
|
26438
|
-
attributes: validXmlAttributes$
|
|
26436
|
+
encode: encode$2,
|
|
26437
|
+
decode: decode$2,
|
|
26438
|
+
attributes: validXmlAttributes$2
|
|
26439
26439
|
};
|
|
26440
|
-
const translator$
|
|
26440
|
+
const translator$2 = NodeTranslator.from(config$2);
|
|
26441
26441
|
const handleAllTableNodes = (params2) => {
|
|
26442
26442
|
const { nodes } = params2;
|
|
26443
26443
|
if (nodes.length === 0) {
|
|
@@ -26532,7 +26532,7 @@ function handleTableCellNode$1({
|
|
|
26532
26532
|
columnWidth
|
|
26533
26533
|
}
|
|
26534
26534
|
};
|
|
26535
|
-
const schemaNode = translator.encode(translatorParams);
|
|
26535
|
+
const schemaNode = translator$1.encode(translatorParams);
|
|
26536
26536
|
return schemaNode;
|
|
26537
26537
|
}
|
|
26538
26538
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
@@ -26934,10 +26934,10 @@ function generateCellMargins(cellMargins) {
|
|
|
26934
26934
|
if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
|
|
26935
26935
|
return elements;
|
|
26936
26936
|
}
|
|
26937
|
-
const XML_NODE_NAME = "w:tc";
|
|
26938
|
-
const SD_NODE_NAME = "tableCell";
|
|
26939
|
-
const validXmlAttributes = [];
|
|
26940
|
-
function encode$
|
|
26937
|
+
const XML_NODE_NAME$1 = "w:tc";
|
|
26938
|
+
const SD_NODE_NAME$1 = "tableCell";
|
|
26939
|
+
const validXmlAttributes$1 = [];
|
|
26940
|
+
function encode$1(params2, encodedAttrs) {
|
|
26941
26941
|
const { node: node2, table, row, rowBorders, styleTag, columnIndex, columnWidth } = params2.extraParams;
|
|
26942
26942
|
const schemaNode = handleTableCellNode({
|
|
26943
26943
|
params: params2,
|
|
@@ -26954,18 +26954,123 @@ function encode$g(params2, encodedAttrs) {
|
|
|
26954
26954
|
}
|
|
26955
26955
|
return schemaNode;
|
|
26956
26956
|
}
|
|
26957
|
-
function decode(params2, decodedAttrs) {
|
|
26957
|
+
function decode$1(params2, decodedAttrs) {
|
|
26958
26958
|
const translated = translateTableCell(params2);
|
|
26959
26959
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
26960
26960
|
translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
|
|
26961
26961
|
}
|
|
26962
26962
|
return translated;
|
|
26963
26963
|
}
|
|
26964
|
+
const config$1 = {
|
|
26965
|
+
xmlName: XML_NODE_NAME$1,
|
|
26966
|
+
sdNodeOrKeyName: SD_NODE_NAME$1,
|
|
26967
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
26968
|
+
encode: encode$1,
|
|
26969
|
+
decode: decode$1,
|
|
26970
|
+
attributes: validXmlAttributes$1
|
|
26971
|
+
};
|
|
26972
|
+
const translator$1 = NodeTranslator.from(config$1);
|
|
26973
|
+
const XML_NODE_NAME = "w:hyperlink";
|
|
26974
|
+
const SD_NODE_NAME = "link";
|
|
26975
|
+
const _createAttributeHandler = (xmlName, sdName) => ({
|
|
26976
|
+
xmlName,
|
|
26977
|
+
sdName,
|
|
26978
|
+
encode: (attributes) => attributes[xmlName],
|
|
26979
|
+
decode: (attributes) => attributes[sdName]
|
|
26980
|
+
});
|
|
26981
|
+
const validXmlAttributes = [
|
|
26982
|
+
_createAttributeHandler("w:anchor", "anchor"),
|
|
26983
|
+
_createAttributeHandler("w:docLocation", "docLocation"),
|
|
26984
|
+
{
|
|
26985
|
+
xmlName: "w:history",
|
|
26986
|
+
sdName: "history",
|
|
26987
|
+
encode: (attributes) => attributes["w:history"] === "1" || attributes["w:history"] === "true",
|
|
26988
|
+
decode: (attributes) => attributes["history"] ? "1" : "0"
|
|
26989
|
+
},
|
|
26990
|
+
_createAttributeHandler("w:tooltip", "tooltip"),
|
|
26991
|
+
_createAttributeHandler("r:id", "rId"),
|
|
26992
|
+
_createAttributeHandler("w:tgtFrame", "target")
|
|
26993
|
+
];
|
|
26994
|
+
const encode$h = (params2, encodedAttrs) => {
|
|
26995
|
+
const { nodes, docx, nodeListHandler: nodeListHandler2 } = params2;
|
|
26996
|
+
const node2 = nodes[0];
|
|
26997
|
+
let href = _resolveHref(docx, encodedAttrs);
|
|
26998
|
+
const linkMark = { type: "link", attrs: { ...encodedAttrs, href } };
|
|
26999
|
+
const runNodes = node2.elements.filter((el) => el.name === "w:r");
|
|
27000
|
+
runNodes.forEach((runNode) => {
|
|
27001
|
+
runNode.marks = [...runNode.marks || [], linkMark];
|
|
27002
|
+
});
|
|
27003
|
+
const updatedNode = nodeListHandler2.handler({
|
|
27004
|
+
...params2,
|
|
27005
|
+
nodes: runNodes,
|
|
27006
|
+
path: [...params2.path || [], node2]
|
|
27007
|
+
});
|
|
27008
|
+
return updatedNode;
|
|
27009
|
+
};
|
|
27010
|
+
const _resolveHref = (docx, encodedAttrs) => {
|
|
27011
|
+
const rels = docx["word/_rels/document.xml.rels"];
|
|
27012
|
+
const relationships = rels.elements.find((el) => el.name === "Relationships");
|
|
27013
|
+
const { elements } = relationships;
|
|
27014
|
+
const { rId, anchor } = encodedAttrs;
|
|
27015
|
+
let href;
|
|
27016
|
+
if (!rId && anchor) {
|
|
27017
|
+
href = `#${anchor}`;
|
|
27018
|
+
} else if (rId) {
|
|
27019
|
+
const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
|
|
27020
|
+
const { attributes: relAttributes = {} } = rel;
|
|
27021
|
+
href = relAttributes["Target"];
|
|
27022
|
+
}
|
|
27023
|
+
return href;
|
|
27024
|
+
};
|
|
27025
|
+
function decode(params2, _2) {
|
|
27026
|
+
const { node: node2 } = params2;
|
|
27027
|
+
const linkMark = node2.marks.find((m2) => m2.type === "link");
|
|
27028
|
+
const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
|
|
27029
|
+
let { anchor, href: link } = linkMark.attrs;
|
|
27030
|
+
const isExternalLink = !anchor;
|
|
27031
|
+
if (isExternalLink) {
|
|
27032
|
+
linkAttrs["r:id"] = _addNewLinkRelationship(params2, link, linkAttrs["r:id"]);
|
|
27033
|
+
}
|
|
27034
|
+
node2.marks = node2.marks.filter((m2) => m2.type !== "link");
|
|
27035
|
+
const outputNode = exportSchemaToJson({ ...params2, node: node2 });
|
|
27036
|
+
const newNode = {
|
|
27037
|
+
name: "w:hyperlink",
|
|
27038
|
+
type: "element",
|
|
27039
|
+
attributes: {
|
|
27040
|
+
...linkAttrs
|
|
27041
|
+
},
|
|
27042
|
+
elements: [outputNode]
|
|
27043
|
+
};
|
|
27044
|
+
return newNode;
|
|
27045
|
+
}
|
|
27046
|
+
function _addNewLinkRelationship(params2, link, rId) {
|
|
27047
|
+
if (!rId) rId = generateDocxRandomId();
|
|
27048
|
+
if (!params2.relationships || !Array.isArray(params2.relationships)) {
|
|
27049
|
+
params2.relationships = [];
|
|
27050
|
+
}
|
|
27051
|
+
const existingRel = params2.relationships.find(
|
|
27052
|
+
(rel) => rel.attributes && rel.attributes.Id === rId && rel.attributes.Target === link
|
|
27053
|
+
);
|
|
27054
|
+
if (existingRel) {
|
|
27055
|
+
return rId;
|
|
27056
|
+
}
|
|
27057
|
+
params2.relationships.push({
|
|
27058
|
+
type: "element",
|
|
27059
|
+
name: "Relationship",
|
|
27060
|
+
attributes: {
|
|
27061
|
+
Id: rId,
|
|
27062
|
+
Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
27063
|
+
Target: link,
|
|
27064
|
+
TargetMode: "External"
|
|
27065
|
+
}
|
|
27066
|
+
});
|
|
27067
|
+
return rId;
|
|
27068
|
+
}
|
|
26964
27069
|
const config = {
|
|
26965
27070
|
xmlName: XML_NODE_NAME,
|
|
26966
27071
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
26967
27072
|
type: NodeTranslator.translatorTypes.NODE,
|
|
26968
|
-
encode: encode$
|
|
27073
|
+
encode: encode$h,
|
|
26969
27074
|
decode,
|
|
26970
27075
|
attributes: validXmlAttributes
|
|
26971
27076
|
};
|
|
@@ -26976,19 +27081,19 @@ function exportSchemaToJson(params2) {
|
|
|
26976
27081
|
doc: translateDocumentNode,
|
|
26977
27082
|
body: translateBodyNode,
|
|
26978
27083
|
heading: translateHeadingNode,
|
|
26979
|
-
paragraph: translator$
|
|
27084
|
+
paragraph: translator$2,
|
|
26980
27085
|
text: translateTextNode,
|
|
26981
27086
|
bulletList: translateList,
|
|
26982
27087
|
orderedList: translateList,
|
|
26983
|
-
lineBreak: translator$
|
|
27088
|
+
lineBreak: translator$4,
|
|
26984
27089
|
table: translateTable,
|
|
26985
27090
|
tableRow: translateTableRow,
|
|
26986
|
-
tableCell: translator,
|
|
27091
|
+
tableCell: translator$1,
|
|
26987
27092
|
bookmarkStart: translateBookmarkStart,
|
|
26988
27093
|
fieldAnnotation: translateFieldAnnotation,
|
|
26989
|
-
tab: translator$
|
|
27094
|
+
tab: translator$3,
|
|
26990
27095
|
image: translateImageNode,
|
|
26991
|
-
hardBreak: translator$
|
|
27096
|
+
hardBreak: translator$4,
|
|
26992
27097
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
26993
27098
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
26994
27099
|
commentReference: () => null,
|
|
@@ -27320,7 +27425,7 @@ function translateTextNode(params2) {
|
|
|
27320
27425
|
const isTrackedNode = node2.marks?.some((m2) => trackedMarks.includes(m2.type));
|
|
27321
27426
|
if (isTrackedNode) return translateTrackedNode(params2);
|
|
27322
27427
|
const isLinkNode = node2.marks?.some((m2) => m2.type === "link");
|
|
27323
|
-
if (isLinkNode) return
|
|
27428
|
+
if (isLinkNode) return translator.decode(params2);
|
|
27324
27429
|
const { text, marks = [] } = node2;
|
|
27325
27430
|
return getTextNodeForExport(text, marks, params2);
|
|
27326
27431
|
}
|
|
@@ -27399,27 +27504,6 @@ function processOutputMarks(marks = []) {
|
|
|
27399
27504
|
}
|
|
27400
27505
|
});
|
|
27401
27506
|
}
|
|
27402
|
-
function translateLinkNode(params2) {
|
|
27403
|
-
const { node: node2 } = params2;
|
|
27404
|
-
const linkMark = node2.marks.find((m2) => m2.type === "link");
|
|
27405
|
-
const link = linkMark.attrs.href;
|
|
27406
|
-
let rId = linkMark.attrs.rId;
|
|
27407
|
-
if (!rId) {
|
|
27408
|
-
rId = addNewLinkRelationship(params2, link);
|
|
27409
|
-
}
|
|
27410
|
-
node2.marks = node2.marks.filter((m2) => m2.type !== "link");
|
|
27411
|
-
const outputNode = exportSchemaToJson({ ...params2, node: node2 });
|
|
27412
|
-
const contentNode = processLinkContentNode(outputNode);
|
|
27413
|
-
const newNode = {
|
|
27414
|
-
name: "w:hyperlink",
|
|
27415
|
-
type: "element",
|
|
27416
|
-
attributes: {
|
|
27417
|
-
"r:id": rId
|
|
27418
|
-
},
|
|
27419
|
-
elements: [contentNode]
|
|
27420
|
-
};
|
|
27421
|
-
return newNode;
|
|
27422
|
-
}
|
|
27423
27507
|
function processLinkContentNode(node2) {
|
|
27424
27508
|
if (!node2) return node2;
|
|
27425
27509
|
const contentNode = carbonCopy(node2);
|
|
@@ -29038,57 +29122,22 @@ const trackChangeNodeHandlerEntity = {
|
|
|
29038
29122
|
handlerName: "trackChangeNodeHandler",
|
|
29039
29123
|
handler: handleTrackChangeNode
|
|
29040
29124
|
};
|
|
29041
|
-
const
|
|
29042
|
-
|
|
29043
|
-
|
|
29044
|
-
|
|
29045
|
-
|
|
29046
|
-
|
|
29047
|
-
const rels = docx["word/_rels/document.xml.rels"];
|
|
29048
|
-
const relationships = rels.elements.find((el) => el.name === "Relationships");
|
|
29049
|
-
const { elements } = relationships;
|
|
29050
|
-
const { attributes } = node2;
|
|
29051
|
-
const rId = attributes["r:id"];
|
|
29052
|
-
const anchor = attributes["w:anchor"];
|
|
29053
|
-
attributes["w:history"];
|
|
29054
|
-
const rel = elements.find((el) => el.attributes["Id"] === rId) || {};
|
|
29055
|
-
const { attributes: relAttributes = {} } = rel;
|
|
29056
|
-
let href = relAttributes["Target"];
|
|
29057
|
-
if (anchor && !href) href = `#${anchor}`;
|
|
29058
|
-
const runNodes = node2.elements.filter((el) => el.name === "w:r");
|
|
29059
|
-
const linkMark = { type: "link", attrs: { href, rId } };
|
|
29060
|
-
for (const runNode of runNodes) {
|
|
29061
|
-
if (!runNode.marks) runNode.marks = [];
|
|
29062
|
-
runNode.marks.push(linkMark);
|
|
29063
|
-
const rPr = runNode.elements.find((el) => el.name === "w:rPr");
|
|
29064
|
-
if (rPr) {
|
|
29065
|
-
const styleRel = rPr.elements.find((el) => el.name === "w:rStyle");
|
|
29066
|
-
if (styleRel) {
|
|
29067
|
-
const styles = docx["word/styles.xml"];
|
|
29068
|
-
const { elements: elements2 } = styles.elements[0];
|
|
29069
|
-
const styleElements = elements2.filter((el) => el.name === "w:style");
|
|
29070
|
-
const style2 = styleElements.find((el) => el.attributes["w:styleId"] === "Hyperlink");
|
|
29071
|
-
const styleRpr = style2?.elements?.find((el) => el.name === "w:rPr");
|
|
29072
|
-
if (styleRpr) {
|
|
29073
|
-
styleRpr.elements.forEach((styleEl) => {
|
|
29074
|
-
const hasElInRPr = rPr.elements.find((el) => el.name === styleEl.name);
|
|
29075
|
-
if (!hasElInRPr) rPr.elements.push(styleEl);
|
|
29076
|
-
});
|
|
29077
|
-
}
|
|
29078
|
-
}
|
|
29125
|
+
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
29126
|
+
handlerName,
|
|
29127
|
+
handler: (params2) => {
|
|
29128
|
+
const { nodes } = params2;
|
|
29129
|
+
if (nodes.length === 0 || nodes[0].name !== translator2.xmlName) {
|
|
29130
|
+
return { nodes: [], consumed: 0 };
|
|
29079
29131
|
}
|
|
29132
|
+
const result = translator2.encode(params2);
|
|
29133
|
+
if (!result) return { nodes: [], consumed: 0 };
|
|
29134
|
+
return {
|
|
29135
|
+
nodes: Array.isArray(result) ? result : [result],
|
|
29136
|
+
consumed: 1
|
|
29137
|
+
};
|
|
29080
29138
|
}
|
|
29081
|
-
|
|
29082
|
-
|
|
29083
|
-
nodes: runNodes,
|
|
29084
|
-
path: [...params2.path || [], node2]
|
|
29085
|
-
});
|
|
29086
|
-
return { nodes: updatedNode, consumed: 1 };
|
|
29087
|
-
};
|
|
29088
|
-
const hyperlinkNodeHandlerEntity = {
|
|
29089
|
-
handlerName: "hyperlinkNodeHandler",
|
|
29090
|
-
handler: handleHyperlinkNode
|
|
29091
|
-
};
|
|
29139
|
+
});
|
|
29140
|
+
const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator);
|
|
29092
29141
|
const handleRunNode = (params2) => {
|
|
29093
29142
|
const { nodes, nodeListHandler: nodeListHandler2, parentStyleId, docx } = params2;
|
|
29094
29143
|
if (nodes.length === 0 || nodes[0].name !== "w:r") {
|
|
@@ -29200,7 +29249,7 @@ const handleParagraphNode = (params2) => {
|
|
|
29200
29249
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
29201
29250
|
return { nodes: [], consumed: 0 };
|
|
29202
29251
|
}
|
|
29203
|
-
const schemaNode = translator$
|
|
29252
|
+
const schemaNode = translator$2.encode(params2);
|
|
29204
29253
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
29205
29254
|
return { nodes: newNodes, consumed: 1 };
|
|
29206
29255
|
};
|
|
@@ -29513,7 +29562,7 @@ const handler = (params2) => {
|
|
|
29513
29562
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
29514
29563
|
return { nodes: [], consumed: 0 };
|
|
29515
29564
|
}
|
|
29516
|
-
const result = translator$
|
|
29565
|
+
const result = translator$4.encode(params2);
|
|
29517
29566
|
if (!result) return { nodes: [], consumed: 0 };
|
|
29518
29567
|
return {
|
|
29519
29568
|
nodes: [result],
|
|
@@ -30209,7 +30258,7 @@ const handleTabNode = (params2) => {
|
|
|
30209
30258
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
30210
30259
|
return { nodes: [], consumed: 0 };
|
|
30211
30260
|
}
|
|
30212
|
-
const node2 = translator$
|
|
30261
|
+
const node2 = translator$3.encode(params2);
|
|
30213
30262
|
return { nodes: [node2], consumed: 1 };
|
|
30214
30263
|
};
|
|
30215
30264
|
const tabNodeEntityHandler = {
|
|
@@ -47116,8 +47165,8 @@ function ensureValidLinkRID(links, editor, tr, logger) {
|
|
|
47116
47165
|
let modified = false;
|
|
47117
47166
|
const results = [];
|
|
47118
47167
|
links.forEach(({ mark, from: from2, to }) => {
|
|
47119
|
-
const { rId, href } = mark.attrs;
|
|
47120
|
-
if (!rId && href) {
|
|
47168
|
+
const { rId, href, anchor } = mark.attrs;
|
|
47169
|
+
if (!rId && href && !anchor) {
|
|
47121
47170
|
let newId = editor.converter.docxHelpers.findRelationshipIdFromTarget(href, editor);
|
|
47122
47171
|
if (newId) logger.debug("Reusing existing rId for link:", newId, "from pos:", from2, "to pos:", to);
|
|
47123
47172
|
if (!newId) {
|
|
@@ -59944,9 +59993,10 @@ const Link = Mark2.create({
|
|
|
59944
59993
|
*/
|
|
59945
59994
|
protocols: ["http", "https"],
|
|
59946
59995
|
htmlAttributes: {
|
|
59947
|
-
target:
|
|
59996
|
+
target: null,
|
|
59948
59997
|
rel: "noopener noreferrer nofollow",
|
|
59949
|
-
class: null
|
|
59998
|
+
class: null,
|
|
59999
|
+
title: null
|
|
59950
60000
|
}
|
|
59951
60001
|
};
|
|
59952
60002
|
},
|
|
@@ -59975,9 +60025,16 @@ const Link = Mark2.create({
|
|
|
59975
60025
|
},
|
|
59976
60026
|
/**
|
|
59977
60027
|
* @category Attribute
|
|
59978
|
-
* @param {
|
|
60028
|
+
* @param {TargetFrameOptions} [target='_blank'] - Link target window
|
|
59979
60029
|
*/
|
|
59980
|
-
target: {
|
|
60030
|
+
target: {
|
|
60031
|
+
default: this.options.htmlAttributes.target,
|
|
60032
|
+
renderDOM: ({ target, href }) => {
|
|
60033
|
+
if (target) return { target };
|
|
60034
|
+
else if (href && !href.startsWith("#")) return { target: "_blank" };
|
|
60035
|
+
return {};
|
|
60036
|
+
}
|
|
60037
|
+
},
|
|
59981
60038
|
/**
|
|
59982
60039
|
* @category Attribute
|
|
59983
60040
|
* @param {string} [rel='noopener noreferrer nofollow'] - Relationship attributes
|
|
@@ -59998,7 +60055,33 @@ const Link = Mark2.create({
|
|
|
59998
60055
|
* @category Attribute
|
|
59999
60056
|
* @param {string} [name] - Anchor name for internal references
|
|
60000
60057
|
*/
|
|
60001
|
-
name: { default: null }
|
|
60058
|
+
name: { default: null },
|
|
60059
|
+
/**
|
|
60060
|
+
* @category Attribute
|
|
60061
|
+
* @param {boolean} [history] - Specifies whether the target of the hyperlink shall be added to a list of viewed hyperlinks when it is invoked.
|
|
60062
|
+
*/
|
|
60063
|
+
history: { default: true, rendered: false },
|
|
60064
|
+
/**
|
|
60065
|
+
* @category Attribute
|
|
60066
|
+
* @param {string|null} [anchor] - Specifies the name of a bookmark that is the target of this link. If the rId and href attributes are specified, then this attribute is ignored.
|
|
60067
|
+
*/
|
|
60068
|
+
anchor: { rendered: false },
|
|
60069
|
+
/**
|
|
60070
|
+
* @category Attribute
|
|
60071
|
+
* @param {string|null} [docLocation] - Specifies a location in the target of the hyperlink.
|
|
60072
|
+
*/
|
|
60073
|
+
docLocation: { rendered: false },
|
|
60074
|
+
/**
|
|
60075
|
+
* @category Attribute
|
|
60076
|
+
* @param {string|null} [tooltip] - A tooltip for the link
|
|
60077
|
+
*/
|
|
60078
|
+
tooltip: {
|
|
60079
|
+
default: null,
|
|
60080
|
+
renderDOM: ({ tooltip }) => {
|
|
60081
|
+
if (tooltip) return { title: tooltip };
|
|
60082
|
+
return {};
|
|
60083
|
+
}
|
|
60084
|
+
}
|
|
60002
60085
|
};
|
|
60003
60086
|
},
|
|
60004
60087
|
addCommands() {
|
|
@@ -81304,9 +81387,9 @@ const _sfc_main = {
|
|
|
81304
81387
|
};
|
|
81305
81388
|
const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
|
|
81306
81389
|
const registeredHandlers = Object.freeze({
|
|
81307
|
-
"w:br": translator$
|
|
81308
|
-
"w:tab": translator$
|
|
81309
|
-
"w:p": translator$
|
|
81390
|
+
"w:br": translator$4,
|
|
81391
|
+
"w:tab": translator$3,
|
|
81392
|
+
"w:p": translator$2
|
|
81310
81393
|
});
|
|
81311
81394
|
const Extensions = {
|
|
81312
81395
|
Node: Node$1,
|