Allow contextual spacing to be specified as an argument to paragraph style

This commit is contained in:
Max Lay
2019-12-11 15:05:09 +13:00
parent 9683e89159
commit 1649d2a0fa
2 changed files with 6 additions and 1 deletions

View File

@ -29,6 +29,7 @@ export interface IRunStyleOptions {
export interface IParagraphStyleOptions2 { export interface IParagraphStyleOptions2 {
readonly alignment?: AlignmentType; readonly alignment?: AlignmentType;
readonly thematicBreak?: boolean; readonly thematicBreak?: boolean;
readonly contextualSpacing?: boolean;
readonly rightTabStop?: number; readonly rightTabStop?: number;
readonly leftTabStop?: number; readonly leftTabStop?: number;
readonly indent?: IIndentAttributesProperties; readonly indent?: IIndentAttributesProperties;

View File

@ -1,4 +1,4 @@
import { Alignment, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph"; import { Alignment, ContextualSpacing, Indent, KeepLines, KeepNext, OutlineLevel, ParagraphProperties, Spacing, ThematicBreak } from "file/paragraph";
import { TabStop, TabStopType } from "file/paragraph/formatting"; import { TabStop, TabStopType } from "file/paragraph/formatting";
import * as formatting from "file/paragraph/run/formatting"; import * as formatting from "file/paragraph/run/formatting";
import { RunProperties } from "file/paragraph/run/properties"; import { RunProperties } from "file/paragraph/run/properties";
@ -134,6 +134,10 @@ export class ParagraphStyle extends Style {
this.paragraphProperties.push(new ThematicBreak()); this.paragraphProperties.push(new ThematicBreak());
} }
if (options.paragraph.contextualSpacing) {
this.paragraphProperties.push(new ContextualSpacing(options.paragraph.contextualSpacing));
}
if (options.paragraph.rightTabStop) { if (options.paragraph.rightTabStop) {
this.paragraphProperties.push(new TabStop(TabStopType.RIGHT, options.paragraph.rightTabStop)); this.paragraphProperties.push(new TabStop(TabStopType.RIGHT, options.paragraph.rightTabStop));
} }