Make media return a picture run instead
This commit is contained in:
@ -55,12 +55,13 @@ export interface IParagraphOptions {
|
||||
readonly level: number;
|
||||
readonly custom?: boolean;
|
||||
};
|
||||
readonly children?: Array<TextRun | PictureRun | Hyperlink>;
|
||||
}
|
||||
|
||||
export class Paragraph extends XmlComponent {
|
||||
private readonly properties: ParagraphProperties;
|
||||
|
||||
constructor(options: string | IParagraphOptions) {
|
||||
constructor(options: string | PictureRun | IParagraphOptions) {
|
||||
super("w:p");
|
||||
|
||||
if (typeof options === "string") {
|
||||
@ -70,6 +71,13 @@ export class Paragraph extends XmlComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
if (options instanceof PictureRun) {
|
||||
this.properties = new ParagraphProperties({});
|
||||
this.root.push(this.properties);
|
||||
this.root.push(options);
|
||||
return;
|
||||
}
|
||||
|
||||
this.properties = new ParagraphProperties({
|
||||
border: options.border,
|
||||
});
|
||||
@ -163,6 +171,12 @@ export class Paragraph extends XmlComponent {
|
||||
this.root.push(run);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.children) {
|
||||
for (const child of options.children) {
|
||||
this.root.push(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public addRun(run: Run): Paragraph {
|
||||
|
Reference in New Issue
Block a user