Files
docx-js/src/file/paragraph/run/run-components/text.ts

16 lines
449 B
TypeScript
Raw Normal View History

import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
2016-05-09 13:02:59 +01:00
2018-01-23 01:33:12 +00:00
class TextAttributes extends XmlAttributeComponent<{ space: "default" | "preserve" }> {
protected xmlKeys = { space: "xml:space" };
}
2016-05-09 13:02:59 +01:00
export class Text extends XmlComponent {
2016-05-09 13:02:59 +01:00
constructor(text: string) {
super("w:t");
2018-01-23 01:33:12 +00:00
this.root.push(new TextAttributes({ space: "preserve" }));
if (text) {
this.root.push(text);
}
2016-05-09 13:02:59 +01:00
}
2017-03-08 21:49:41 +00:00
}