diff --git a/ts/docx/paragraph/index.ts b/ts/docx/paragraph/index.ts index a63861c3a7..5c42381311 100644 --- a/ts/docx/paragraph/index.ts +++ b/ts/docx/paragraph/index.ts @@ -1,3 +1,4 @@ +import { IData } from "../../media/data"; import { Num } from "../../numbering/num"; import { Run } from "../run"; import { PictureRun } from "../run/picture-run"; @@ -37,8 +38,8 @@ export class Paragraph extends XmlComponent { return run; } - public createPictureRun(imagePath: string): PictureRun { - const run = new PictureRun(imagePath); + public createPictureRun(imageData: IData): PictureRun { + const run = new PictureRun(imageData); this.addRun(run); return run; } diff --git a/ts/docx/run/picture-run.ts b/ts/docx/run/picture-run.ts index fdf2310c4b..038d1fc7bf 100644 --- a/ts/docx/run/picture-run.ts +++ b/ts/docx/run/picture-run.ts @@ -1,10 +1,16 @@ +import { IData } from "../../media/data"; import { Run } from "../run"; import { Drawing } from "./run-components/drawing"; export class PictureRun extends Run { - constructor(imagePath: string) { + constructor(imageData: IData) { super(); - this.root.push(new Drawing(imagePath)); + + if (imageData === undefined) { + throw new Error("imageData cannot be undefined"); + } + + this.root.push(new Drawing(imageData)); } }