unify Shading; breaking change: Paragraph/Run shading option key type changed to val, and shadow alias removed
This commit is contained in:
@ -186,16 +186,3 @@ export class HighlightComplexScript extends XmlComponent {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class Shading extends XmlComponent {
|
||||
constructor(value: string, fill: string, color: string) {
|
||||
super("w:shd");
|
||||
this.root.push(
|
||||
new Attributes({
|
||||
val: value,
|
||||
fill: fill,
|
||||
color: color,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ShadingType } from "file/table";
|
||||
import { IShadingAttributesProperties, Shading } from "file/shading";
|
||||
import { IgnoreIfEmptyXmlComponent, XmlComponent } from "file/xml-components";
|
||||
import { EmphasisMark, EmphasisMarkType } from "./emphasis-mark";
|
||||
import {
|
||||
@ -15,7 +15,6 @@ import {
|
||||
Italics,
|
||||
ItalicsComplexScript,
|
||||
RightToLeft,
|
||||
Shading,
|
||||
Size,
|
||||
SizeComplexScript,
|
||||
SmallCaps,
|
||||
@ -57,12 +56,7 @@ export interface IRunStylePropertiesOptions {
|
||||
readonly highlight?: string;
|
||||
readonly highlightComplexScript?: boolean | string;
|
||||
readonly characterSpacing?: number;
|
||||
readonly shading?: {
|
||||
readonly type: ShadingType;
|
||||
readonly fill: string;
|
||||
readonly color: string;
|
||||
};
|
||||
readonly shadow?: IRunStylePropertiesOptions["shading"];
|
||||
readonly shading?: IShadingAttributesProperties;
|
||||
readonly emboss?: boolean;
|
||||
readonly imprint?: boolean;
|
||||
}
|
||||
@ -179,9 +173,8 @@ export class RunProperties extends IgnoreIfEmptyXmlComponent {
|
||||
this.push(new Imprint());
|
||||
}
|
||||
|
||||
const shading = options.shading || options.shadow;
|
||||
if (shading) {
|
||||
this.push(new Shading(shading.type, shading.fill, shading.color));
|
||||
if (options.shading) {
|
||||
this.push(new Shading(options.shading));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "export/formatter";
|
||||
// import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run";
|
||||
import { ShadingType } from "file/table";
|
||||
import { ShadingType } from "file/shading";
|
||||
|
||||
import { Run } from "./";
|
||||
import { EmphasisMarkType } from "./emphasis-mark";
|
||||
@ -234,7 +234,7 @@ describe("Run", () => {
|
||||
it("it should add shadow to the properties", () => {
|
||||
const run = new Run({
|
||||
shading: {
|
||||
type: ShadingType.PERCENT_10,
|
||||
val: ShadingType.PERCENT_10,
|
||||
fill: "00FFFF",
|
||||
color: "FF0000",
|
||||
},
|
||||
|
Reference in New Issue
Block a user