added the remaining classes required
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
import { XmlComponent } from "../../../xml-components";
|
||||
import { Inline } from "./inline";
|
||||
|
||||
export class Drawing extends XmlComponent {
|
||||
|
||||
constructor(imagePath: string) {
|
||||
super("w:drawing");
|
||||
|
||||
// store in the document, then get Id
|
||||
|
||||
this.root.push(new Inline(5));
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { XmlComponent } from "../../../../../../xml-components";
|
||||
import { Pic } from "./pic";
|
||||
|
||||
export class Graphic extends XmlComponent {
|
||||
export class GraphicData extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
constructor(referenceId: number) {
|
||||
super("a:graphicData");
|
||||
this.root.push(new Pic(referenceId));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
import { XmlComponent } from "../../../../../../../../xml-components";
|
||||
import { Blip } from "./blip";
|
||||
|
||||
export class BlipFill extends XmlComponent {
|
||||
|
||||
constructor(referenceId: number) {
|
||||
super("pic:blipFill");
|
||||
this.root.push(new Blip(referenceId));
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
import { XmlAttributeComponent, XmlComponent } from "../../../../../../../../xml-components";
|
||||
|
||||
export interface IBlipProperties {
|
||||
embed?: string;
|
||||
}
|
||||
|
||||
class BlipAttributes extends XmlAttributeComponent<IBlipProperties> {
|
||||
protected xmlKeys = {
|
||||
embed: "r:embed",
|
||||
};
|
||||
}
|
||||
|
||||
export class Blip extends XmlComponent {
|
||||
|
||||
constructor(referenceId: number) {
|
||||
super("a:blip");
|
||||
this.root.push(new BlipAttributes({
|
||||
embed: `rId${referenceId}`,
|
||||
}));
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
import { XmlComponent } from "../../../../../../../xml-components";
|
||||
import { BlipFill } from "./blip/blip-fill";
|
||||
|
||||
export class Pic extends XmlComponent {
|
||||
|
||||
constructor(referenceId: number) {
|
||||
super("pic:pic");
|
||||
this.root.push(new BlipFill(referenceId));
|
||||
}
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
import { XmlComponent } from "../../../../../xml-components";
|
||||
import { GraphicData } from "./graphic-data";
|
||||
|
||||
export class Graphic extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
constructor(referenceId: number) {
|
||||
super("a:graphic");
|
||||
this.root.push(new GraphicData(referenceId));
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { XmlComponent } from "../../../../xml-components";
|
||||
import { Graphic } from "./graphic";
|
||||
|
||||
export class Inline extends XmlComponent {
|
||||
|
||||
constructor() {
|
||||
constructor(referenceId: number) {
|
||||
super("wp:inline");
|
||||
this.root.push(new Graphic(referenceId));
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { assert, expect } from "chai";
|
||||
import { assert } from "chai";
|
||||
import { Drawing } from "../../../../docx/run/run-components/drawing";
|
||||
import { Utility } from "../../../utility";
|
||||
|
||||
@ -13,6 +13,7 @@ describe.only("Drawing", () => {
|
||||
it("should create a Drawing with correct root key", () => {
|
||||
const newJson = Utility.jsonify(currentBreak);
|
||||
assert.equal(newJson.rootKey, "w:drawing");
|
||||
console.log(JSON.stringify(newJson, null, 2));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user