fixed formatting styles

This commit is contained in:
Igor Bulovski
2018-05-17 15:32:15 +02:00
parent cdb86b741c
commit dadd8c122f
12 changed files with 26 additions and 27 deletions

View File

@ -11,7 +11,7 @@ export class Media {
this.map = new Map<string, IMediaData>();
}
private createMedia(key: string, relationshipsCount, dimensions, data: fs.ReadStream | Buffer, filePath?: string, ) {
private createMedia(key: string, relationshipsCount, dimensions, data: fs.ReadStream | Buffer, filePath?: string) {
const imageData = {
referenceId: this.map.size + relationshipsCount + 1,
stream: data,
@ -54,8 +54,8 @@ export class Media {
if (width && height) {
dimensions = {
width: width,
height: height
}
height: height,
};
} else {
dimensions = sizeOf(data);
}

View File

@ -49,8 +49,8 @@ export class Numbering extends XmlComponent {
}
public prepForXml(): IXmlableObject {
this.abstractNumbering.forEach(x => this.root.push(x));
this.concreteNumbering.forEach(x => this.root.push(x));
this.abstractNumbering.forEach((x) => this.root.push(x));
this.concreteNumbering.forEach((x) => this.root.push(x));
return super.prepForXml();
}
}

View File

@ -168,10 +168,12 @@ describe("Paragraph", () => {
expect(tree).to.deep.equal({
"w:p": [
{
"w:pPr": [{
"w:pageBreakBefore": []
}],
}
"w:pPr": [
{
"w:pageBreakBefore": [],
},
],
},
],
});
});

View File

@ -154,7 +154,6 @@ describe("External styles factory", () => {
],
rootKey: "w:style",
});
});
});
});

View File

@ -44,9 +44,7 @@ export class ExternalStylesFactory {
});
// convert the styles one by one
xmlStyles["w:style"]
.map((style) => this.convertElement("w:style", style))
.forEach(importedStyle.push.bind(importedStyle));
xmlStyles["w:style"].map((style) => this.convertElement("w:style", style)).forEach(importedStyle.push.bind(importedStyle));
return importedStyle;
}

View File

@ -1,2 +1,2 @@
export * from "./table";
export * from './table-cell';
export * from "./table-cell";

View File

@ -169,12 +169,12 @@ describe("TableCellWidth", () => {
expect(tree).to.deep.equal({
"w:tcW": [
{
"_attr": {
_attr: {
"w:type": "dxa",
"w:w": 100
}
}
]
"w:w": 100,
},
},
],
});
});
});

View File

@ -1,5 +1,5 @@
export * from "./xml-component";
export * from "./attributes";
export * from "./default-attributes";
export * from './imported-xml-component';
export * from "./imported-xml-component";
export * from "./xmlable-object";

View File

@ -26,7 +26,7 @@ describe("XmlComponent", () => {
xmlComponent.addChildElement(child);
const xml = xmlComponent.prepForXml();
assert.equal(xml['w:test'].length, 0);
assert.equal(xml["w:test"].length, 0);
});
});
});

View File

@ -12,7 +12,7 @@ export abstract class XmlComponent extends BaseXmlComponent {
public prepForXml(): IXmlableObject {
const children = this.root
.filter(c => {
.filter((c) => {
if (c instanceof BaseXmlComponent) {
return !c.isDeleted;
}