Add SymbolRun to allow adding symbols inline
This commit is contained in:
20
src/file/paragraph/run/symbol-run.ts
Normal file
20
src/file/paragraph/run/symbol-run.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { IRunOptions, Run } from "./run";
|
||||
import { Symbol } from "./run-components/symbol";
|
||||
|
||||
export interface ISymbolRunOptions extends IRunOptions {
|
||||
readonly char: string;
|
||||
readonly symbolfont?: string;
|
||||
}
|
||||
|
||||
export class SymbolRun extends Run {
|
||||
constructor(options: ISymbolRunOptions | string) {
|
||||
if (typeof options === "string") {
|
||||
super({});
|
||||
this.root.push(new Symbol(options));
|
||||
return;
|
||||
}
|
||||
|
||||
super(options);
|
||||
this.root.push(new Symbol(options.char, options.symbolfont));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user