2018-10-26 01:04:07 +01:00
|
|
|
import { Paragraph } from "file/paragraph";
|
2018-06-11 00:45:21 +01:00
|
|
|
import { XmlComponent } from "file/xml-components";
|
2018-10-26 01:04:07 +01:00
|
|
|
|
2018-06-11 00:45:21 +01:00
|
|
|
import { FootnoteAttributes } from "./footnote-attributes";
|
2018-06-28 03:01:25 +01:00
|
|
|
import { FootnoteRefRun } from "./run/footnote-ref-run";
|
2018-06-11 00:45:21 +01:00
|
|
|
|
2018-06-30 23:41:57 +01:00
|
|
|
export enum FootnoteType {
|
|
|
|
SEPERATOR = "separator",
|
|
|
|
CONTINUATION_SEPERATOR = "continuationSeparator",
|
|
|
|
}
|
|
|
|
|
2021-03-01 23:35:52 +00:00
|
|
|
export interface IFootnoteOptions {
|
|
|
|
readonly id: number;
|
|
|
|
readonly type?: FootnoteType;
|
|
|
|
}
|
|
|
|
|
2018-06-30 23:41:57 +01:00
|
|
|
export class Footnote extends XmlComponent {
|
2021-03-01 23:35:52 +00:00
|
|
|
constructor(options: IFootnoteOptions) {
|
2018-06-11 00:45:21 +01:00
|
|
|
super("w:footnote");
|
|
|
|
this.root.push(
|
|
|
|
new FootnoteAttributes({
|
2021-03-01 23:35:52 +00:00
|
|
|
type: options.type,
|
|
|
|
id: options.id,
|
2018-06-11 00:45:21 +01:00
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-06-25 23:17:56 +01:00
|
|
|
public add(paragraph: Paragraph): void {
|
2018-06-28 03:01:25 +01:00
|
|
|
paragraph.addRunToFront(new FootnoteRefRun());
|
2018-06-11 00:45:21 +01:00
|
|
|
this.root.push(paragraph);
|
|
|
|
}
|
|
|
|
}
|