feat: transfer comments property to File CoreProperties like numbering.

This commit is contained in:
Chen Yuncai
2022-03-07 20:02:14 +08:00
parent b2a09b512f
commit b81086ab7a
7 changed files with 32 additions and 25 deletions

View File

@ -1,3 +1,4 @@
import { Comments } from './../paragraph/run/comment-run';
import { StringContainer, XmlComponent } from "file/xml-components";
import { ICustomPropertyOptions } from "../custom-properties";
import { IDocumentBackgroundOptions } from "../document";
@ -21,6 +22,7 @@ export interface IPropertiesOptions {
readonly externalStyles?: string;
readonly styles?: IStylesOptions;
readonly numbering?: INumberingOptions;
readonly comments?: Comments;
readonly footnotes?: {
readonly [key: string]: {
readonly children: Paragraph[];

View File

@ -71,6 +71,10 @@ export class File {
},
);
if (options.comments) {
this.comments = options.comments;
}
this.fileRelationships = new Relationships();
this.customProperties = new CustomProperties(options.customProperties ?? []);
this.appProperties = new AppProperties();
@ -136,9 +140,6 @@ export class File {
this.footnotesWrapper.View.createFootNote(parseFloat(key), options.footnotes[key].children);
}
}
if (fileProperties.template && fileProperties.template.comments) {
this.comments = fileProperties.template.comments;
}
}
private addSection({ headers = {}, footers = {}, children, properties }: ISectionOptions): void {

View File

@ -10,7 +10,7 @@ interface ICommentOptions {
}
class CommentAttributes extends XmlAttributeComponent<ICommentOptions> {
protected readonly xmlKeys = { id: "w:id", initias: "w:initials", author: "w:author", date: "w:date" };
protected readonly xmlKeys = { id: "w:id", initials: "w:initials", author: "w:author", date: "w:date" };
}
const COMMENT_ATTRIBUTES_MAP = {