Work on moving Document into its own wrapper

This commit is contained in:
Dolan
2021-02-28 16:04:21 +00:00
parent e750735fa4
commit 655b40d418
15 changed files with 157 additions and 65 deletions

View File

@ -804,8 +804,10 @@ describe("Paragraph", () => {
],
});
const fileMock = ({
DocumentRelationships: {
createRelationship: () => ({}),
Document: {
Relationships: {
createRelationship: () => ({}),
},
},
} as unknown) as File;
paragraph.prepForXml(fileMock);

View File

@ -79,7 +79,7 @@ export class Paragraph extends XmlComponent {
if (element instanceof ExternalHyperlink) {
const index = this.root.indexOf(element);
const concreteHyperlink = new ConcreteHyperlink(element.options.child, shortid.generate().toLowerCase());
file.DocumentRelationships.createRelationship(
file.Document.Relationships.createRelationship(
concreteHyperlink.linkId,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
element.options.link,