#756 Adding alt text feature
This commit is contained in:
@ -1,15 +1,36 @@
|
||||
import { XmlComponent } from "@file/xml-components";
|
||||
import { DocPropertiesAttributes } from "./doc-properties-attributes";
|
||||
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
|
||||
import { uniqueNumericId } from "@util/convenience-functions";
|
||||
|
||||
class DocPropertiesAttributes extends XmlAttributeComponent<{
|
||||
readonly id?: number;
|
||||
readonly name?: string;
|
||||
readonly description?: string;
|
||||
readonly title?: string;
|
||||
}> {
|
||||
protected readonly xmlKeys = {
|
||||
id: "id",
|
||||
name: "name",
|
||||
description: "descr",
|
||||
title: "title",
|
||||
};
|
||||
}
|
||||
|
||||
export interface DocPropertiesOptions {
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly title: string;
|
||||
}
|
||||
|
||||
export class DocProperties extends XmlComponent {
|
||||
public constructor() {
|
||||
public constructor({ name, description, title }: DocPropertiesOptions = { name: "", description: "", title: "" }) {
|
||||
super("wp:docPr");
|
||||
|
||||
this.root.push(
|
||||
new DocPropertiesAttributes({
|
||||
id: 0,
|
||||
name: "",
|
||||
descr: "",
|
||||
id: uniqueNumericId(),
|
||||
name,
|
||||
description,
|
||||
title,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user