now extends XmlComponent

This commit is contained in:
Dolan Miu
2016-04-09 20:16:35 +01:00
parent 84610bd72f
commit f68a2aff56
33 changed files with 180 additions and 371 deletions

View File

@ -1,45 +1,30 @@
import {XmlComponent, Attributes} from "../xml-components";
export class Bold implements XmlComponent {
private b: Array<XmlComponent>;
xmlKeys = {
b: 'w:b'
}
export class Bold extends XmlComponent {
constructor() {
this.b = new Array<XmlComponent>();
this.b.push(new Attributes({
super("w:b");
this.root.push(new Attributes({
val: true
}));
}
}
export class Italics {
private i: Array<XmlComponent>;
xmlKeys = {
i: 'w:i'
}
export class Italics extends XmlComponent {
constructor() {
this.i = new Array<XmlComponent>();
this.i.push(new Attributes({
super("w:i");
this.root.push(new Attributes({
val: true
}));
}
}
export class Underline {
private u: Array<XmlComponent>;
xmlKeys = {
u: 'w:u'
}
export class Underline extends XmlComponent {
constructor() {
this.u = new Array<XmlComponent>();
this.u.push(new Attributes({
super("w:u");
this.root.push(new Attributes({
val: true
}));
}

View File

@ -2,18 +2,14 @@ import {XmlComponent, Attributes} from "../xml-components";
import {RunProperties} from "./properties";
import {Bold, Italics, Underline} from "./emphasis";
export class Run implements XmlComponent {
protected r: Array<XmlComponent>;
export class Run extends XmlComponent {
private properties: RunProperties;
xmlKeys = {
r: 'w:r'
}
constructor() {
this.r = new Array<XmlComponent>();
super("w:r");
this.properties = new RunProperties();
this.r.push(this.properties);
this.root.push(this.properties);
}
bold(): Run {

View File

@ -1,17 +1,12 @@
import {XmlComponent, Attributes} from "../xml-components";
export class RunProperties implements XmlComponent {
private rPr: Array<XmlComponent>;
xmlKeys = {
rPr: 'w:rPr'
}
export class RunProperties extends XmlComponent {
constructor() {
this.rPr = new Array<XmlComponent>();
super("w:rPr");
}
push(item: XmlComponent): void {
this.rPr.push(item);
this.root.push(item);
}
}

View File

@ -5,6 +5,6 @@ export class TextRun extends Run {
constructor(text: string) {
super();
this.r.push(new Text(text));
this.root.push(new Text(text));
}
}