made image take in IData instead of image path
This commit is contained in:
@ -1,13 +1,12 @@
|
|||||||
|
import { IData } from "../../../../media/data";
|
||||||
import { XmlComponent } from "../../../xml-components";
|
import { XmlComponent } from "../../../xml-components";
|
||||||
import { Inline } from "./inline";
|
import { Inline } from "./inline";
|
||||||
|
|
||||||
export class Drawing extends XmlComponent {
|
export class Drawing extends XmlComponent {
|
||||||
|
|
||||||
constructor(imagePath: string) {
|
constructor(imageData: IData) {
|
||||||
super("w:drawing");
|
super("w:drawing");
|
||||||
|
|
||||||
// store in the document, then get Id
|
this.root.push(new Inline(imageData.referenceId));
|
||||||
|
|
||||||
this.root.push(new Inline(5));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
ts/media/data.ts
Normal file
8
ts/media/data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import * as fs from "fs";
|
||||||
|
|
||||||
|
export interface IData {
|
||||||
|
referenceId: number;
|
||||||
|
stream: fs.ReadStream;
|
||||||
|
path: string;
|
||||||
|
fileName: string;
|
||||||
|
}
|
@ -1,12 +1,6 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
import { IData } from "./data";
|
||||||
interface IData {
|
|
||||||
referenceId: number;
|
|
||||||
stream: fs.ReadStream;
|
|
||||||
path: string;
|
|
||||||
fileName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Media {
|
export class Media {
|
||||||
private map: Map<string, IData>;
|
private map: Map<string, IData>;
|
||||||
|
Reference in New Issue
Block a user