Fix reading template images in the browser

This commit is contained in:
Simon Brunel
2022-01-20 16:20:28 +01:00
parent 01ab5e0c00
commit 9a937891a8
2 changed files with 4 additions and 1 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# https://prettier.io/docs/en/options.html#end-of-line
* text=auto eol=lf

View File

@ -157,7 +157,8 @@ export class ImportDotx {
const hyperLinkReferences = this.findReferenceFiles(xmlRef).filter((r) => r.type === RelationshipType.HYPERLINK);
for (const r of wrapperImagesReferences) {
const buffer = await zipContent.files[`word/${r.target}`].async("nodebuffer");
const bufferType = JSZip.support.arraybuffer ? "arraybuffer" : "nodebuffer";
const buffer = await zipContent.files[`word/${r.target}`].async(bufferType);
const mediaData = media.addMedia(buffer, {
width: 100,
height: 100,