fixed formatting styles
This commit is contained in:
@ -5,4 +5,4 @@ export * from "./numbering";
|
||||
export * from "./media";
|
||||
export * from "./drawing";
|
||||
export * from "./styles";
|
||||
export * from "./xml-components";
|
||||
export * from "./xml-components";
|
||||
|
@ -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,12 +54,12 @@ export class Media {
|
||||
if (width && height) {
|
||||
dimensions = {
|
||||
width: width,
|
||||
height: height
|
||||
}
|
||||
height: height,
|
||||
};
|
||||
} else {
|
||||
dimensions = sizeOf(data);
|
||||
}
|
||||
|
||||
|
||||
return this.createMedia(key, relationshipsCount, dimensions, data);
|
||||
}
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
export * from "./numbering";
|
||||
export * from "./abstract-numbering";
|
||||
export * from "./abstract-numbering";
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -168,10 +168,12 @@ describe("Paragraph", () => {
|
||||
expect(tree).to.deep.equal({
|
||||
"w:p": [
|
||||
{
|
||||
"w:pPr": [{
|
||||
"w:pageBreakBefore": []
|
||||
}],
|
||||
}
|
||||
"w:pPr": [
|
||||
{
|
||||
"w:pageBreakBefore": [],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
@ -154,7 +154,6 @@ describe("External styles factory", () => {
|
||||
],
|
||||
rootKey: "w:style",
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
export * from "./table";
|
||||
export * from './table-cell';
|
||||
export * from "./table-cell";
|
||||
|
@ -169,13 +169,13 @@ describe("TableCellWidth", () => {
|
||||
expect(tree).to.deep.equal({
|
||||
"w:tcW": [
|
||||
{
|
||||
"_attr": {
|
||||
_attr: {
|
||||
"w:type": "dxa",
|
||||
"w:w": 100
|
||||
}
|
||||
}
|
||||
]
|
||||
"w:w": 100,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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";
|
||||
|
@ -24,9 +24,9 @@ describe("XmlComponent", () => {
|
||||
const child = new TestComponent("w:test1");
|
||||
child.delete();
|
||||
xmlComponent.addChildElement(child);
|
||||
|
||||
|
||||
const xml = xmlComponent.prepForXml();
|
||||
assert.equal(xml['w:test'].length, 0);
|
||||
assert.equal(xml["w:test"].length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user