fixed formatting styles
This commit is contained in:
@ -11,7 +11,7 @@ export class Media {
|
|||||||
this.map = new Map<string, IMediaData>();
|
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 = {
|
const imageData = {
|
||||||
referenceId: this.map.size + relationshipsCount + 1,
|
referenceId: this.map.size + relationshipsCount + 1,
|
||||||
stream: data,
|
stream: data,
|
||||||
@ -54,8 +54,8 @@ export class Media {
|
|||||||
if (width && height) {
|
if (width && height) {
|
||||||
dimensions = {
|
dimensions = {
|
||||||
width: width,
|
width: width,
|
||||||
height: height
|
height: height,
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
dimensions = sizeOf(data);
|
dimensions = sizeOf(data);
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ export class Numbering extends XmlComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public prepForXml(): IXmlableObject {
|
public prepForXml(): IXmlableObject {
|
||||||
this.abstractNumbering.forEach(x => this.root.push(x));
|
this.abstractNumbering.forEach((x) => this.root.push(x));
|
||||||
this.concreteNumbering.forEach(x => this.root.push(x));
|
this.concreteNumbering.forEach((x) => this.root.push(x));
|
||||||
return super.prepForXml();
|
return super.prepForXml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -168,10 +168,12 @@ describe("Paragraph", () => {
|
|||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"w:p": [
|
"w:p": [
|
||||||
{
|
{
|
||||||
"w:pPr": [{
|
"w:pPr": [
|
||||||
"w:pageBreakBefore": []
|
{
|
||||||
}],
|
"w:pageBreakBefore": [],
|
||||||
}
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -154,7 +154,6 @@ describe("External styles factory", () => {
|
|||||||
],
|
],
|
||||||
rootKey: "w:style",
|
rootKey: "w:style",
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -44,9 +44,7 @@ export class ExternalStylesFactory {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// convert the styles one by one
|
// convert the styles one by one
|
||||||
xmlStyles["w:style"]
|
xmlStyles["w:style"].map((style) => this.convertElement("w:style", style)).forEach(importedStyle.push.bind(importedStyle));
|
||||||
.map((style) => this.convertElement("w:style", style))
|
|
||||||
.forEach(importedStyle.push.bind(importedStyle));
|
|
||||||
|
|
||||||
return importedStyle;
|
return importedStyle;
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
export * from "./table";
|
export * from "./table";
|
||||||
export * from './table-cell';
|
export * from "./table-cell";
|
||||||
|
@ -169,12 +169,12 @@ describe("TableCellWidth", () => {
|
|||||||
expect(tree).to.deep.equal({
|
expect(tree).to.deep.equal({
|
||||||
"w:tcW": [
|
"w:tcW": [
|
||||||
{
|
{
|
||||||
"_attr": {
|
_attr: {
|
||||||
"w:type": "dxa",
|
"w:type": "dxa",
|
||||||
"w:w": 100
|
"w:w": 100,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export * from "./xml-component";
|
export * from "./xml-component";
|
||||||
export * from "./attributes";
|
export * from "./attributes";
|
||||||
export * from "./default-attributes";
|
export * from "./default-attributes";
|
||||||
export * from './imported-xml-component';
|
export * from "./imported-xml-component";
|
||||||
export * from "./xmlable-object";
|
export * from "./xmlable-object";
|
||||||
|
@ -26,7 +26,7 @@ describe("XmlComponent", () => {
|
|||||||
xmlComponent.addChildElement(child);
|
xmlComponent.addChildElement(child);
|
||||||
|
|
||||||
const xml = xmlComponent.prepForXml();
|
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 {
|
public prepForXml(): IXmlableObject {
|
||||||
const children = this.root
|
const children = this.root
|
||||||
.filter(c => {
|
.filter((c) => {
|
||||||
if (c instanceof BaseXmlComponent) {
|
if (c instanceof BaseXmlComponent) {
|
||||||
return !c.isDeleted;
|
return !c.isDeleted;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user