docx 9.9.0 → 9.10.0
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/index.cjs +182 -80
- package/dist/index.d.cts +63 -6
- package/dist/index.d.ts +63 -6
- package/dist/index.iife.js +182 -80
- package/dist/index.mjs +182 -80
- package/dist/index.umd.cjs +182 -80
- package/dist/layout.cjs +1 -6
- package/dist/layout.iife.js +1 -6
- package/dist/layout.mjs +1 -6
- package/dist/layout.umd.cjs +1 -6
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -12789,7 +12789,7 @@ var import_hash = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((expor
|
|
|
12789
12789
|
hash.sha512 = hash.sha.sha512;
|
|
12790
12790
|
hash.ripemd160 = hash.ripemd.ripemd160;
|
|
12791
12791
|
})))(), 1);
|
|
12792
|
-
var urlAlphabet = "
|
|
12792
|
+
var urlAlphabet = "57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9";
|
|
12793
12793
|
//#endregion
|
|
12794
12794
|
//#region node_modules/nanoid/non-secure/index.js
|
|
12795
12795
|
var customAlphabet = (alphabet, defaultSize = 21) => {
|
|
@@ -14586,48 +14586,6 @@ var ChildNonVisualProperties = class extends XmlComponent {
|
|
|
14586
14586
|
}
|
|
14587
14587
|
};
|
|
14588
14588
|
//#endregion
|
|
14589
|
-
//#region src/file/drawing/doc-properties/doc-properties-children.ts
|
|
14590
|
-
/**
|
|
14591
|
-
* Child elements for document properties.
|
|
14592
|
-
*
|
|
14593
|
-
* This module provides hyperlink elements that can be attached to
|
|
14594
|
-
* drawing elements for interactive behavior.
|
|
14595
|
-
*
|
|
14596
|
-
* @module
|
|
14597
|
-
*/
|
|
14598
|
-
/**
|
|
14599
|
-
* Creates a click hyperlink element for a drawing.
|
|
14600
|
-
*
|
|
14601
|
-
* This element defines what happens when a user clicks on a drawing element.
|
|
14602
|
-
*
|
|
14603
|
-
* ## XSD Schema
|
|
14604
|
-
* ```xml
|
|
14605
|
-
* <xsd:complexType name="CT_Hyperlink">
|
|
14606
|
-
* <xsd:group ref="EG_PContent" minOccurs="0" maxOccurs="unbounded"/>
|
|
14607
|
-
* <xsd:attribute name="tgtFrame" type="s:ST_String"/>
|
|
14608
|
-
* <xsd:attribute name="tooltip" type="s:ST_String"/>
|
|
14609
|
-
* <xsd:attribute name="docLocation" type="s:ST_String"/>
|
|
14610
|
-
* <xsd:attribute name="history" type="s:ST_OnOff"/>
|
|
14611
|
-
* <xsd:attribute name="anchor" type="s:ST_String"/>
|
|
14612
|
-
* <xsd:attribute ref="r:id"/>
|
|
14613
|
-
* </xsd:complexType>
|
|
14614
|
-
* ```
|
|
14615
|
-
*
|
|
14616
|
-
* @param linkId - The relationship ID for the hyperlink target
|
|
14617
|
-
* @param hasXmlNs - Whether to include the XML namespace declaration
|
|
14618
|
-
* @returns An XML component representing the click hyperlink
|
|
14619
|
-
*/
|
|
14620
|
-
var createHyperlinkClick = (linkId, hasXmlNs) => new BuilderElement({
|
|
14621
|
-
name: "a:hlinkClick",
|
|
14622
|
-
attributes: _objectSpread2(_objectSpread2({}, hasXmlNs ? { xmlns: {
|
|
14623
|
-
key: "xmlns:a",
|
|
14624
|
-
value: "http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
14625
|
-
} } : {}), {}, { id: {
|
|
14626
|
-
key: "r:id",
|
|
14627
|
-
value: `rId${linkId}`
|
|
14628
|
-
} })
|
|
14629
|
-
});
|
|
14630
|
-
//#endregion
|
|
14631
14589
|
//#region src/file/drawing/inline/graphic/graphic-data/pic/non-visual-pic-properties/non-visual-properties/non-visual-properties-attributes.ts
|
|
14632
14590
|
/**
|
|
14633
14591
|
* Non-visual properties attributes module.
|
|
@@ -14708,7 +14666,7 @@ var NonVisualProperties = class extends XmlComponent {
|
|
|
14708
14666
|
for (let i = context.stack.length - 1; i >= 0; i--) {
|
|
14709
14667
|
const element = context.stack[i];
|
|
14710
14668
|
if (!(element instanceof ConcreteHyperlink)) continue;
|
|
14711
|
-
this.root.push(
|
|
14669
|
+
this.root.push(element.createDrawingClick(context, false));
|
|
14712
14670
|
break;
|
|
14713
14671
|
}
|
|
14714
14672
|
const result = super.prepForXml(context);
|
|
@@ -15378,6 +15336,48 @@ var createRelationship = (id, type, target, targetMode) => new BuilderElement({
|
|
|
15378
15336
|
}
|
|
15379
15337
|
});
|
|
15380
15338
|
//#endregion
|
|
15339
|
+
//#region src/file/drawing/doc-properties/doc-properties-children.ts
|
|
15340
|
+
/**
|
|
15341
|
+
* Child elements for document properties.
|
|
15342
|
+
*
|
|
15343
|
+
* This module provides hyperlink elements that can be attached to
|
|
15344
|
+
* drawing elements for interactive behavior.
|
|
15345
|
+
*
|
|
15346
|
+
* @module
|
|
15347
|
+
*/
|
|
15348
|
+
/**
|
|
15349
|
+
* Creates a click hyperlink element for a drawing.
|
|
15350
|
+
*
|
|
15351
|
+
* This element defines what happens when a user clicks on a drawing element.
|
|
15352
|
+
*
|
|
15353
|
+
* ## XSD Schema
|
|
15354
|
+
* ```xml
|
|
15355
|
+
* <xsd:complexType name="CT_Hyperlink">
|
|
15356
|
+
* <xsd:group ref="EG_PContent" minOccurs="0" maxOccurs="unbounded"/>
|
|
15357
|
+
* <xsd:attribute name="tgtFrame" type="s:ST_String"/>
|
|
15358
|
+
* <xsd:attribute name="tooltip" type="s:ST_String"/>
|
|
15359
|
+
* <xsd:attribute name="docLocation" type="s:ST_String"/>
|
|
15360
|
+
* <xsd:attribute name="history" type="s:ST_OnOff"/>
|
|
15361
|
+
* <xsd:attribute name="anchor" type="s:ST_String"/>
|
|
15362
|
+
* <xsd:attribute ref="r:id"/>
|
|
15363
|
+
* </xsd:complexType>
|
|
15364
|
+
* ```
|
|
15365
|
+
*
|
|
15366
|
+
* @param linkId - The relationship ID for the hyperlink target
|
|
15367
|
+
* @param hasXmlNs - Whether to include the XML namespace declaration
|
|
15368
|
+
* @returns An XML component representing the click hyperlink
|
|
15369
|
+
*/
|
|
15370
|
+
var createHyperlinkClick = (linkId, hasXmlNs) => new BuilderElement({
|
|
15371
|
+
name: "a:hlinkClick",
|
|
15372
|
+
attributes: _objectSpread2(_objectSpread2({}, hasXmlNs ? { xmlns: {
|
|
15373
|
+
key: "xmlns:a",
|
|
15374
|
+
value: "http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
15375
|
+
} } : {}), {}, { id: {
|
|
15376
|
+
key: "r:id",
|
|
15377
|
+
value: `rId${linkId}`
|
|
15378
|
+
} })
|
|
15379
|
+
});
|
|
15380
|
+
//#endregion
|
|
15381
15381
|
//#region src/file/drawing/doc-properties/non-visual-drawing-properties.ts
|
|
15382
15382
|
/**
|
|
15383
15383
|
* Non-visual drawing properties (`CT_NonVisualDrawingProps`) of the shapes, pictures and groups inside a drawing:
|
|
@@ -15572,7 +15572,7 @@ var DocProperties = class extends XmlComponent {
|
|
|
15572
15572
|
} else for (let i = context.stack.length - 1; i >= 0; i--) {
|
|
15573
15573
|
const element = context.stack[i];
|
|
15574
15574
|
if (!(element instanceof ConcreteHyperlink)) continue;
|
|
15575
|
-
this.root.push(
|
|
15575
|
+
this.root.push(element.createDrawingClick(context, true));
|
|
15576
15576
|
break;
|
|
15577
15577
|
}
|
|
15578
15578
|
if (this.decorative) this.root.push(createDecorativeExtensionList(true));
|
|
@@ -18960,20 +18960,44 @@ var HyperlinkType = {
|
|
|
18960
18960
|
* ```
|
|
18961
18961
|
*/
|
|
18962
18962
|
var ConcreteHyperlink = class extends XmlComponent {
|
|
18963
|
-
|
|
18963
|
+
/**
|
|
18964
|
+
* @param children - Inline content of the hyperlink
|
|
18965
|
+
* @param relationshipId - Id of the external relationship, without the rId prefix
|
|
18966
|
+
* @param anchor - Bookmark name or external URL fragment
|
|
18967
|
+
* @param externalLink - The full address of an external hyperlink, so the relationship id is kept alongside its anchor
|
|
18968
|
+
*/
|
|
18969
|
+
constructor(children, relationshipId, anchor, externalLink) {
|
|
18964
18970
|
super("w:hyperlink");
|
|
18965
18971
|
_defineProperty(this, "linkId", void 0);
|
|
18972
|
+
_defineProperty(this, "drawingLink", void 0);
|
|
18966
18973
|
this.linkId = relationshipId;
|
|
18974
|
+
this.drawingLink = anchor && externalLink !== void 0 ? new DrawingLink(externalLink) : void 0;
|
|
18967
18975
|
const attributes = new HyperlinkAttributes({
|
|
18968
18976
|
history: 1,
|
|
18969
18977
|
anchor: anchor ? anchor : void 0,
|
|
18970
|
-
id: !anchor ? `rId${this.linkId}` : void 0
|
|
18978
|
+
id: !anchor || externalLink !== void 0 ? `rId${this.linkId}` : void 0
|
|
18971
18979
|
});
|
|
18972
18980
|
this.root.push(attributes);
|
|
18973
18981
|
children.forEach((child) => {
|
|
18974
18982
|
this.root.push(child);
|
|
18975
18983
|
});
|
|
18976
18984
|
}
|
|
18985
|
+
/**
|
|
18986
|
+
* Creates the `a:hlinkClick` of a picture in the hyperlink, which links to the same address.
|
|
18987
|
+
*
|
|
18988
|
+
* The hyperlink decides which relationship its pictures use, rather than the pictures reading `linkId`, because only it
|
|
18989
|
+
* knows whether that relationship has lost the fragment to `w:anchor`. The picture's relationship is added as the
|
|
18990
|
+
* picture is written, through the context's relationships, so it lands in the part the picture is in, both when
|
|
18991
|
+
* packing and when patching.
|
|
18992
|
+
*
|
|
18993
|
+
* @param context - The context the picture is written in, whose relationships get the picture's link if it has its own
|
|
18994
|
+
* @param declareNamespace - Declares the DrawingML namespace, for elements outside `a:graphic` such as `wp:docPr`
|
|
18995
|
+
*/
|
|
18996
|
+
createDrawingClick(context, declareNamespace) {
|
|
18997
|
+
if (!this.drawingLink) return createHyperlinkClick(this.linkId, declareNamespace);
|
|
18998
|
+
this.drawingLink.addRelationship(context);
|
|
18999
|
+
return this.drawingLink.createClick(declareNamespace);
|
|
19000
|
+
}
|
|
18977
19001
|
};
|
|
18978
19002
|
/**
|
|
18979
19003
|
* Represents an internal hyperlink to a bookmark within the document.
|
|
@@ -19022,6 +19046,11 @@ var InternalHyperlink = class extends ConcreteHyperlink {
|
|
|
19022
19046
|
* External hyperlinks create a relationship to an external resource (URL).
|
|
19023
19047
|
* The relationship is created during document preparation and the hyperlink
|
|
19024
19048
|
* is converted to a ConcreteHyperlink with the relationship ID.
|
|
19049
|
+
* URL fragments of at most 255 UTF-16 units are written as anchors, preserving any additional # characters.
|
|
19050
|
+
* Longer fragments stay in the original relationship URI to avoid exceeding Word's anchor limit;
|
|
19051
|
+
* those links retain the existing limitations for fragments with multiple # characters.
|
|
19052
|
+
* Word appends the anchor to the relationship target as described in MS-OI29500 §17.16.22:
|
|
19053
|
+
* https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/df06e423-11a6-4a36-bfb3-82139e531781
|
|
19025
19054
|
*
|
|
19026
19055
|
* Reference: http://officeopenxml.com/WPhyperlink.php
|
|
19027
19056
|
*
|
|
@@ -19035,6 +19064,7 @@ var InternalHyperlink = class extends ConcreteHyperlink {
|
|
|
19035
19064
|
* <xsd:group ref="EG_PContent" minOccurs="0" maxOccurs="unbounded"/>
|
|
19036
19065
|
* <xsd:attribute ref="r:id"/>
|
|
19037
19066
|
* <xsd:attribute name="history" type="s:ST_OnOff" use="optional"/>
|
|
19067
|
+
* <xsd:attribute name="anchor" type="s:ST_String" use="optional"/>
|
|
19038
19068
|
* </xsd:complexType>
|
|
19039
19069
|
* ```
|
|
19040
19070
|
*
|
|
@@ -19483,6 +19513,29 @@ var PageReference = class extends Run {
|
|
|
19483
19513
|
}
|
|
19484
19514
|
};
|
|
19485
19515
|
//#endregion
|
|
19516
|
+
//#region src/file/paragraph/links/external-hyperlink-target.ts
|
|
19517
|
+
/**
|
|
19518
|
+
* External hyperlink targets and fragments for WordprocessingML.
|
|
19519
|
+
*
|
|
19520
|
+
* Word appends the anchor to the relationship target, separated by a # character.
|
|
19521
|
+
* Reference: https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oi29500/df06e423-11a6-4a36-bfb3-82139e531781
|
|
19522
|
+
*
|
|
19523
|
+
* @module
|
|
19524
|
+
*/
|
|
19525
|
+
var MAX_ANCHOR_LENGTH = 255;
|
|
19526
|
+
/**
|
|
19527
|
+
* Splits a nonempty fragment that fits Word's anchor limit without decoding or normalizing either part.
|
|
19528
|
+
* Longer fragments stay in the original relationship URI, retaining its existing multi-hash limitations.
|
|
19529
|
+
*/
|
|
19530
|
+
var externalHyperlinkTarget = (link) => {
|
|
19531
|
+
const index = link.indexOf("#");
|
|
19532
|
+
const fragmentLength = link.length - index - 1;
|
|
19533
|
+
return index > 0 && fragmentLength > 0 && fragmentLength <= MAX_ANCHOR_LENGTH ? {
|
|
19534
|
+
target: link.slice(0, index),
|
|
19535
|
+
anchor: link.slice(index + 1)
|
|
19536
|
+
} : { target: link };
|
|
19537
|
+
};
|
|
19538
|
+
//#endregion
|
|
19486
19539
|
//#region src/file/fonts/font.ts
|
|
19487
19540
|
/**
|
|
19488
19541
|
* Font module for WordprocessingML documents.
|
|
@@ -19621,32 +19674,26 @@ var createFont = ({ name, altName, panose1, charset, family, notTrueType, pitch,
|
|
|
19621
19674
|
]
|
|
19622
19675
|
});
|
|
19623
19676
|
//#endregion
|
|
19624
|
-
//#region src/file/fonts/create-
|
|
19677
|
+
//#region src/file/fonts/create-embedded-font.ts
|
|
19625
19678
|
/**
|
|
19626
|
-
* Creates
|
|
19679
|
+
* Creates an embedded font with default settings.
|
|
19627
19680
|
*
|
|
19628
19681
|
* This helper function creates a font definition with standard font signature
|
|
19629
19682
|
* values that work for most common fonts. The signature specifies Unicode
|
|
19630
19683
|
* and code page ranges supported by the font.
|
|
19631
19684
|
*
|
|
19632
|
-
* @param options - Font creation options
|
|
19633
|
-
* @param options.name - Font name
|
|
19634
|
-
* @param options.index - Font relationship index
|
|
19635
|
-
* @param options.fontKey - Unique font key (GUID) for obfuscation
|
|
19636
|
-
* @param options.characterSet - Optional character set identifier
|
|
19637
|
-
*
|
|
19638
19685
|
* @returns XmlComponent representing the font definition
|
|
19639
19686
|
*
|
|
19640
19687
|
* @example
|
|
19641
19688
|
* ```typescript
|
|
19642
|
-
* const font =
|
|
19689
|
+
* const font = createEmbeddedFont({
|
|
19643
19690
|
* name: "Arial",
|
|
19644
|
-
*
|
|
19645
|
-
* fontKey: "12345678-1234-1234-1234-
|
|
19691
|
+
* embedRegular: { id: "rId1", fontKey: "12345678-1234-1234-1234-123456789012" },
|
|
19692
|
+
* embedBold: { id: "rId2", fontKey: "12345678-1234-1234-1234-123456789013" },
|
|
19646
19693
|
* });
|
|
19647
19694
|
* ```
|
|
19648
19695
|
*/
|
|
19649
|
-
var
|
|
19696
|
+
var createEmbeddedFont = ({ name, characterSet, embedRegular, embedBold, embedItalic, embedBoldItalic }) => createFont({
|
|
19650
19697
|
name,
|
|
19651
19698
|
sig: {
|
|
19652
19699
|
usb0: "E0002AFF",
|
|
@@ -19659,10 +19706,10 @@ var createRegularFont = ({ name, index, fontKey, characterSet }) => createFont({
|
|
|
19659
19706
|
charset: characterSet,
|
|
19660
19707
|
family: "auto",
|
|
19661
19708
|
pitch: "variable",
|
|
19662
|
-
embedRegular
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
|
|
19709
|
+
embedRegular,
|
|
19710
|
+
embedBold,
|
|
19711
|
+
embedItalic,
|
|
19712
|
+
embedBoldItalic
|
|
19666
19713
|
});
|
|
19667
19714
|
//#endregion
|
|
19668
19715
|
//#region src/file/fonts/font-table.ts
|
|
@@ -19740,25 +19787,47 @@ var createFontTable = (fonts) => new BuilderElement({
|
|
|
19740
19787
|
value: "w14 w15 w16se w16cid w16 w16cex w16sdtdh"
|
|
19741
19788
|
}
|
|
19742
19789
|
},
|
|
19743
|
-
children: fonts.map(
|
|
19744
|
-
name: font.name,
|
|
19745
|
-
index: i + 1,
|
|
19746
|
-
fontKey: font.fontKey,
|
|
19747
|
-
characterSet: font.characterSet
|
|
19748
|
-
}))
|
|
19790
|
+
children: fonts.map(createEmbeddedFont)
|
|
19749
19791
|
});
|
|
19750
19792
|
//#endregion
|
|
19751
19793
|
//#region src/file/fonts/font-wrapper.ts
|
|
19794
|
+
var FACES = [
|
|
19795
|
+
{
|
|
19796
|
+
option: "data",
|
|
19797
|
+
element: "embedRegular",
|
|
19798
|
+
bold: false,
|
|
19799
|
+
italic: false
|
|
19800
|
+
},
|
|
19801
|
+
{
|
|
19802
|
+
option: "bold",
|
|
19803
|
+
element: "embedBold",
|
|
19804
|
+
bold: true,
|
|
19805
|
+
italic: false
|
|
19806
|
+
},
|
|
19807
|
+
{
|
|
19808
|
+
option: "italic",
|
|
19809
|
+
element: "embedItalic",
|
|
19810
|
+
bold: false,
|
|
19811
|
+
italic: true
|
|
19812
|
+
},
|
|
19813
|
+
{
|
|
19814
|
+
option: "boldItalic",
|
|
19815
|
+
element: "embedBoldItalic",
|
|
19816
|
+
bold: true,
|
|
19817
|
+
italic: true
|
|
19818
|
+
}
|
|
19819
|
+
];
|
|
19752
19820
|
/**
|
|
19753
19821
|
* Wrapper class for managing the font table and its relationships.
|
|
19754
19822
|
*
|
|
19755
19823
|
* Creates a font table with embedded font files and manages the relationships
|
|
19756
|
-
* required for font embedding. Each font is
|
|
19824
|
+
* required for font embedding. Each face of a font is embedded as a file of its own,
|
|
19825
|
+
* with a unique key for obfuscation.
|
|
19757
19826
|
*
|
|
19758
19827
|
* @example
|
|
19759
19828
|
* ```typescript
|
|
19760
19829
|
* const fontWrapper = new FontWrapper([
|
|
19761
|
-
* { name: "CustomFont", data: fontBuffer }
|
|
19830
|
+
* { name: "CustomFont", data: fontBuffer, bold: boldFontBuffer }
|
|
19762
19831
|
* ]);
|
|
19763
19832
|
* ```
|
|
19764
19833
|
*/
|
|
@@ -19767,12 +19836,43 @@ var FontWrapper = class {
|
|
|
19767
19836
|
_defineProperty(this, "options", void 0);
|
|
19768
19837
|
_defineProperty(this, "fontTable", void 0);
|
|
19769
19838
|
_defineProperty(this, "relationships", void 0);
|
|
19770
|
-
_defineProperty(
|
|
19839
|
+
_defineProperty(
|
|
19840
|
+
this,
|
|
19841
|
+
/** @deprecated Use `files`, which has the file and key of each face a font embeds, not only the regular face's key */
|
|
19842
|
+
"fontOptionsWithKey",
|
|
19843
|
+
[]
|
|
19844
|
+
);
|
|
19845
|
+
_defineProperty(
|
|
19846
|
+
this,
|
|
19847
|
+
/** The files of the faces the fonts embed, in order: the Nth is `fonts/font<N>.odttf`, with the relationship `rId<N>` */
|
|
19848
|
+
"files",
|
|
19849
|
+
[]
|
|
19850
|
+
);
|
|
19771
19851
|
this.options = options;
|
|
19772
|
-
|
|
19773
|
-
|
|
19852
|
+
const faces = options.map((font) => FACES.flatMap(({ option, element, bold, italic }) => {
|
|
19853
|
+
const data = font[option];
|
|
19854
|
+
return data ? [{
|
|
19855
|
+
element,
|
|
19856
|
+
file: {
|
|
19857
|
+
name: font.name,
|
|
19858
|
+
data,
|
|
19859
|
+
bold,
|
|
19860
|
+
italic,
|
|
19861
|
+
fontKey: uniqueUuid()
|
|
19862
|
+
}
|
|
19863
|
+
}] : [];
|
|
19864
|
+
}));
|
|
19865
|
+
this.files = faces.flatMap((ofFont) => ofFont.map(({ file }) => file));
|
|
19866
|
+
this.fontOptionsWithKey = options.map((font, index) => _objectSpread2(_objectSpread2({}, font), {}, { fontKey: faces[index][0].file.fontKey }));
|
|
19867
|
+
this.fontTable = createFontTable(options.map((font, index) => _objectSpread2({
|
|
19868
|
+
name: font.name,
|
|
19869
|
+
characterSet: font.characterSet
|
|
19870
|
+
}, Object.fromEntries(faces[index].map(({ element, file }) => [element, {
|
|
19871
|
+
id: `rId${this.files.indexOf(file) + 1}`,
|
|
19872
|
+
fontKey: file.fontKey
|
|
19873
|
+
}])))));
|
|
19774
19874
|
this.relationships = new Relationships();
|
|
19775
|
-
for (let i = 0; i <
|
|
19875
|
+
for (let i = 0; i < this.files.length; i++) this.relationships.addRelationship(i + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font", `fonts/font${i + 1}.odttf`);
|
|
19776
19876
|
}
|
|
19777
19877
|
get View() {
|
|
19778
19878
|
return this.fontTable;
|
|
@@ -20295,8 +20395,9 @@ var Paragraph = class extends FileChild {
|
|
|
20295
20395
|
prepForXml(context) {
|
|
20296
20396
|
for (const element of this.root) if (element instanceof ExternalHyperlink) {
|
|
20297
20397
|
const index = this.root.indexOf(element);
|
|
20298
|
-
const
|
|
20299
|
-
|
|
20398
|
+
const { target, anchor } = externalHyperlinkTarget(element.options.link);
|
|
20399
|
+
const concreteHyperlink = new ConcreteHyperlink(element.options.children, uniqueId(), anchor, element.options.link);
|
|
20400
|
+
context.viewWrapper.Relationships.addRelationship(concreteHyperlink.linkId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", target, TargetModeType.EXTERNAL);
|
|
20300
20401
|
this.root[index] = concreteHyperlink;
|
|
20301
20402
|
}
|
|
20302
20403
|
return super.prepForXml(context);
|
|
@@ -35471,7 +35572,7 @@ var Compiler = class {
|
|
|
35471
35572
|
zip.file(`word/media/${data.fileName}`, data.data);
|
|
35472
35573
|
zip.file(`word/media/${data.fallback.fileName}`, data.fallback.data);
|
|
35473
35574
|
}
|
|
35474
|
-
for (const [i, { data: buffer, fontKey }] of file.FontTable.
|
|
35575
|
+
for (const [i, { data: buffer, fontKey }] of file.FontTable.files.entries()) zip.file(`word/fonts/font${i + 1}.odttf`, obfuscate(buffer, fontKey));
|
|
35475
35576
|
return zip;
|
|
35476
35577
|
}
|
|
35477
35578
|
xmlifyFile(file, prettify) {
|
|
@@ -37766,12 +37867,13 @@ var patchDocument = function() {
|
|
|
37766
37867
|
json: element,
|
|
37767
37868
|
patch: _objectSpread2(_objectSpread2({}, patchValue), {}, { children: patchValue.children.flatMap((child) => child instanceof Bookmark ? child.writtenAs : [child]).map((child) => {
|
|
37768
37869
|
if (child instanceof ExternalHyperlink) {
|
|
37769
|
-
const
|
|
37870
|
+
const { target, anchor } = externalHyperlinkTarget(child.options.link);
|
|
37871
|
+
const concreteHyperlink = new ConcreteHyperlink(child.options.children, uniqueId(), anchor, child.options.link);
|
|
37770
37872
|
hyperlinkRelationships.push({
|
|
37771
37873
|
key,
|
|
37772
37874
|
id: concreteHyperlink.linkId,
|
|
37773
37875
|
type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
37774
|
-
target
|
|
37876
|
+
target,
|
|
37775
37877
|
targetMode: TargetModeType.EXTERNAL
|
|
37776
37878
|
});
|
|
37777
37879
|
return concreteHyperlink;
|