#713 Update chinese demo and refactor

This commit is contained in:
Dolan
2021-03-09 01:37:22 +00:00
parent 98253c3445
commit e98fe5921c
5 changed files with 65 additions and 11 deletions

View File

@ -13,11 +13,11 @@ export class DocumentDefaults extends XmlComponent {
private readonly runPropertiesDefaults: RunPropertiesDefaults;
private readonly paragraphPropertiesDefaults: ParagraphPropertiesDefaults;
constructor(options?: IDocumentDefaultsOptions) {
constructor(options: IDocumentDefaultsOptions) {
super("w:docDefaults");
this.runPropertiesDefaults = new RunPropertiesDefaults(options && options.run);
this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(options && options.paragraph);
this.runPropertiesDefaults = new RunPropertiesDefaults(options.run);
this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(options.paragraph);
this.root.push(this.runPropertiesDefaults);
this.root.push(this.paragraphPropertiesDefaults);

View File

@ -2,11 +2,9 @@ import { IRunStylePropertiesOptions, RunProperties } from "file/paragraph/run/pr
import { XmlComponent } from "file/xml-components";
export class RunPropertiesDefaults extends XmlComponent {
private readonly properties: RunProperties;
constructor(options?: IRunStylePropertiesOptions) {
super("w:rPrDefault");
this.properties = new RunProperties(options);
this.root.push(this.properties);
this.root.push(new RunProperties(options));
}
}

View File

@ -50,7 +50,7 @@ export class DefaultStylesFactory {
return {
initialStyles: documentAttributes,
importedStyles: [
new DocumentDefaults(options.document),
new DocumentDefaults(options.document ?? {}),
new TitleStyle({
run: {
size: 56,