From 76a10529fff3bef69a8a0d5b5bc0291cbf88bc6f Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 1 May 2016 23:48:45 +0100 Subject: [PATCH] made use of xml unit component --- ts/properties/components.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/ts/properties/components.ts b/ts/properties/components.ts index 2027e0a48a..b0888b618c 100644 --- a/ts/properties/components.ts +++ b/ts/properties/components.ts @@ -1,13 +1,10 @@ +import {XmlUnitComponent} from "../docx/xml-components"; import {XmlComponent} from "../docx/xml-components"; import {DocumentAttributes} from "../docx/document/document-attributes"; -abstract class Component extends XmlComponent { +abstract class Component extends XmlUnitComponent { protected createNullBlockOrValue(value: string): any { - if (value === undefined) { - return [{}]; - } else { - return value; - } + return value; //return null; } } @@ -15,7 +12,7 @@ export class Title extends Component { constructor(value: string) { super("dc:title"); - this.root.push(this.createNullBlockOrValue(value)); + this.root = this.createNullBlockOrValue(value); } } @@ -23,7 +20,7 @@ export class Subject extends Component { constructor(value: string) { super("dc:subject"); - this.root.push(this.createNullBlockOrValue(value)); + this.root = this.createNullBlockOrValue(value); } } @@ -31,7 +28,7 @@ export class Creator extends Component { constructor(value: string) { super("dc:creator"); - this.root.push(this.createNullBlockOrValue(value)); + this.root = this.createNullBlockOrValue(value); } } @@ -39,7 +36,7 @@ export class Keywords extends Component { constructor(value: string) { super("cp:keywords"); - this.root.push(this.createNullBlockOrValue(value)); + this.root = this.createNullBlockOrValue(value); } } @@ -47,7 +44,7 @@ export class Description extends Component { constructor(value: string) { super("dc:description"); - this.root.push(this.createNullBlockOrValue(value)); + this.root = this.createNullBlockOrValue(value); } } @@ -55,7 +52,7 @@ export class LastModifiedBy extends Component { constructor(value: string) { super("cp:lastModifiedBy"); - this.root.push(this.createNullBlockOrValue(value)); + this.root = this.createNullBlockOrValue(value); } } @@ -64,7 +61,7 @@ export class Revision extends Component { constructor(value: string) { super("cp:revision"); var revision = this.createNullBlockOrValue(value); - this.root.push(this.createNullBlockOrValue(value)); + this.root = this.createNullBlockOrValue(value); } }