:feat: refine paragraph/run properties options
This commit is contained in:
@ -1,15 +1,24 @@
|
||||
import { IParagraphStylePropertiesOptions } from "file/paragraph/properties";
|
||||
import { IRunStylePropertiesOptions } from "file/paragraph/run/properties";
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { ParagraphPropertiesDefaults } from "./paragraph-properties";
|
||||
import { RunPropertiesDefaults } from "./run-properties";
|
||||
|
||||
export interface IDocumentDefaultsOptions {
|
||||
readonly paragraph?: IParagraphStylePropertiesOptions;
|
||||
readonly run?: IRunStylePropertiesOptions;
|
||||
}
|
||||
|
||||
export class DocumentDefaults extends XmlComponent {
|
||||
private readonly runPropertiesDefaults: RunPropertiesDefaults;
|
||||
private readonly paragraphPropertiesDefaults: ParagraphPropertiesDefaults;
|
||||
|
||||
constructor() {
|
||||
constructor(options?: IDocumentDefaultsOptions) {
|
||||
super("w:docDefaults");
|
||||
this.runPropertiesDefaults = new RunPropertiesDefaults();
|
||||
this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults();
|
||||
|
||||
this.runPropertiesDefaults = new RunPropertiesDefaults(options && options.run);
|
||||
this.paragraphPropertiesDefaults = new ParagraphPropertiesDefaults(options && options.paragraph);
|
||||
|
||||
this.root.push(this.runPropertiesDefaults);
|
||||
this.root.push(this.paragraphPropertiesDefaults);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { ParagraphProperties } from "file/paragraph/properties";
|
||||
import { IParagraphStylePropertiesOptions, ParagraphProperties } from "file/paragraph/properties";
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class ParagraphPropertiesDefaults extends XmlComponent {
|
||||
constructor() {
|
||||
constructor(options?: IParagraphStylePropertiesOptions) {
|
||||
super("w:pPrDefault");
|
||||
this.root.push(new ParagraphProperties({}));
|
||||
this.root.push(new ParagraphProperties(options));
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { Size, SizeComplexScript } from "file/paragraph/run/formatting";
|
||||
import { RunProperties } from "file/paragraph/run/properties";
|
||||
import { IRunStylePropertiesOptions, RunProperties } from "file/paragraph/run/properties";
|
||||
import { IFontAttributesProperties, RunFonts } from "file/paragraph/run/run-fonts";
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
export class RunPropertiesDefaults extends XmlComponent {
|
||||
private readonly properties: RunProperties;
|
||||
|
||||
constructor() {
|
||||
constructor(options?: IRunStylePropertiesOptions) {
|
||||
super("w:rPrDefault");
|
||||
this.properties = new RunProperties();
|
||||
this.properties = new RunProperties(options);
|
||||
this.root.push(this.properties);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user