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

25 lines
788 B
TypeScript
Raw Normal View History

import { IMediaData } from "@file/media";
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { createExtentionList } from "./blip-extentions";
2017-03-13 00:02:56 +00:00
type BlipAttributes = {
readonly embed: string;
readonly cstate: string;
};
2017-03-13 00:02:56 +00:00
export const createBlip = (mediaData: IMediaData): XmlComponent =>
new BuilderElement<BlipAttributes>({
name: "a:blip",
attributes: {
embed: {
key: "r:embed",
value: `rId{${mediaData.type === "svg" ? mediaData.fallback.fileName : mediaData.fileName}}`,
},
cstate: {
key: "cstate",
value: "none",
},
},
children: mediaData.type === "svg" ? [createExtentionList(mediaData)] : [],
});