Files
docx-js/src/file/drawing/inline/graphic/graphic.ts

39 lines
1.0 KiB
TypeScript
Raw Normal View History

import { IMediaData, IMediaDataTransformation } from "@file/media";
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
2018-12-21 01:39:20 +00:00
2018-03-24 19:06:10 +00:00
import { GraphicData } from "./graphic-data";
import { OutlineOptions } from "./graphic-data/pic/shape-properties/outline/outline";
2018-03-24 19:06:10 +00:00
2021-03-15 00:11:39 +00:00
class GraphicAttributes extends XmlAttributeComponent<{
readonly a: string;
2021-03-15 00:11:39 +00:00
}> {
protected readonly xmlKeys = {
2018-03-24 19:06:10 +00:00
a: "xmlns:a",
};
}
export class Graphic extends XmlComponent {
2018-08-07 01:38:15 +01:00
private readonly data: GraphicData;
2018-03-24 19:06:10 +00:00
public constructor({
mediaData,
transform,
outline,
}: {
readonly mediaData: IMediaData;
readonly transform: IMediaDataTransformation;
readonly outline?: OutlineOptions;
}) {
2018-03-24 19:06:10 +00:00
super("a:graphic");
this.root.push(
new GraphicAttributes({
a: "http://schemas.openxmlformats.org/drawingml/2006/main",
}),
);
this.data = new GraphicData({ mediaData, transform, outline });
2018-03-24 19:06:10 +00:00
this.root.push(this.data);
}
}