Declarative hyperlinks, bookmarks, tab stops and page breaks

This commit is contained in:
Dolan
2019-09-30 22:56:21 +01:00
parent d2dded860d
commit 04b6d8e54a
20 changed files with 207 additions and 165 deletions

View File

@ -1,11 +1,11 @@
import { expect } from "chai";
import { Formatter } from "export/formatter";
import { TabStopPosition } from "file/paragraph";
import { EMPTY_OBJECT } from "file/xml-components";
import { ParagraphStyle } from "./paragraph-style";
import { EMPTY_OBJECT } from "file/xml-components";
describe("ParagraphStyle", () => {
describe("#constructor", () => {
it("should set the style type to paragraph and use the given style id", () => {
@ -198,7 +198,7 @@ describe("ParagraphStyle", () => {
});
it("#maxRightTabStop", () => {
const style = new ParagraphStyle("myStyleId").maxRightTabStop();
const style = new ParagraphStyle("myStyleId").rightTabStop(TabStopPosition.MAX);
const tree = new Formatter().format(style);
expect(tree).to.deep.equal({
"w:style": [

View File

@ -6,12 +6,12 @@ import {
KeepLines,
KeepNext,
LeftTabStop,
MaxRightTabStop,
OutlineLevel,
ParagraphProperties,
Spacing,
ThematicBreak,
} from "file/paragraph";
import { RightTabStop } from "file/paragraph/formatting";
import * as formatting from "file/paragraph/run/formatting";
import { RunProperties } from "file/paragraph/run/properties";
import { XmlComponent } from "file/xml-components";
@ -144,8 +144,8 @@ export class ParagraphStyle extends Style {
return this.addParagraphProperty(new ThematicBreak());
}
public maxRightTabStop(): ParagraphStyle {
return this.addParagraphProperty(new MaxRightTabStop());
public rightTabStop(position: number): ParagraphStyle {
return this.addParagraphProperty(new RightTabStop(position));
}
public leftTabStop(position: number): ParagraphStyle {