update file/styles
This commit is contained in:
@ -1,12 +1,8 @@
|
||||
import { IRunStylePropertiesOptions, RunProperties } from "file/paragraph/run/properties";
|
||||
|
||||
import { BasedOn, Link, SemiHidden, UiPriority, UnhideWhenUsed } from "./components";
|
||||
import { Style } from "./style";
|
||||
import { IStyleOptions, Style } from "./style";
|
||||
|
||||
export interface IBaseCharacterStyleOptions {
|
||||
readonly basedOn?: string;
|
||||
readonly link?: string;
|
||||
readonly semiHidden?: boolean;
|
||||
export interface IBaseCharacterStyleOptions extends IStyleOptions {
|
||||
readonly run?: IRunStylePropertiesOptions;
|
||||
}
|
||||
|
||||
@ -19,24 +15,16 @@ export class StyleForCharacter extends Style {
|
||||
private readonly runProperties: RunProperties;
|
||||
|
||||
constructor(options: ICharacterStyleOptions) {
|
||||
super({ type: "character", styleId: options.id }, options.name);
|
||||
super(
|
||||
{ type: "character", styleId: options.id },
|
||||
{
|
||||
uiPriority: 99,
|
||||
unhideWhenUsed: true,
|
||||
...options,
|
||||
},
|
||||
);
|
||||
|
||||
this.runProperties = new RunProperties(options.run);
|
||||
|
||||
this.root.push(this.runProperties);
|
||||
this.root.push(new UiPriority(99));
|
||||
this.root.push(new UnhideWhenUsed());
|
||||
|
||||
if (options.basedOn) {
|
||||
this.root.push(new BasedOn(options.basedOn));
|
||||
}
|
||||
|
||||
if (options.link) {
|
||||
this.root.push(new Link(options.link));
|
||||
}
|
||||
|
||||
if (options.semiHidden) {
|
||||
this.root.push(new SemiHidden());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user