@viveeditor/docx 0.1.0 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,6 +21,8 @@ editor.commands.replaceContent(html)
21
21
  const blob = await exportDocx(editor, { title: 'Report' })
22
22
  ```
23
23
 
24
+ Word fonts are kept only when they match an entry of the editor's font list. If you configured `FontFamily` with your own `fontFamilies`, pass the same list to `importDocx(file, { fontFamilies })`.
25
+
24
26
  Files over 20 MB, password-protected files and files that unpack too large or too deep are refused with a `DocxError`. See [Word (.docx)](https://github.com/mtvrkan/viveeditor#word-docx) for what is kept.
25
27
 
26
28
  ## License
package/dist/index.d.ts CHANGED
@@ -22,15 +22,33 @@ interface ImportOptions {
22
22
  imagePolicy?: Partial<ImageSourcePolicy>;
23
23
  signal?: AbortSignal;
24
24
  limits?: Partial<ImportLimits>;
25
+ fontFamilies?: readonly string[];
26
+ comments?: boolean;
27
+ trackedChanges?: "accept" | "keep";
25
28
  }
26
29
  type ImportWarningCode = "HIDDEN_TEXT" | "IMAGE_DROPPED" | "LINK_DROPPED" | "OBJECT_DROPPED" | "NESTING_FLATTENED";
27
30
  interface ImportWarning {
28
31
  code: ImportWarningCode;
29
32
  count: number;
30
33
  }
34
+ interface ImportedComment {
35
+ id: string;
36
+ author: {
37
+ id: string;
38
+ name: string;
39
+ };
40
+ body: string;
41
+ created: string;
42
+ }
43
+ interface ImportedThread {
44
+ id: string;
45
+ resolved: boolean;
46
+ comments: ImportedComment[];
47
+ }
31
48
  interface DocxImport {
32
49
  html: string;
33
50
  warnings: ImportWarning[];
51
+ threads: ImportedThread[];
34
52
  }
35
53
  export declare const DEFAULT_IMPORT_LIMITS: Readonly<ImportLimits>;
36
54
  export declare function importDocx(file: Blob, options?: ImportOptions): Promise<DocxImport>;
@@ -38,8 +56,21 @@ interface ExportSource {
38
56
  readonly schema: Schema;
39
57
  getJSON(): unknown;
40
58
  }
59
+ interface ExportComment {
60
+ readonly author: {
61
+ readonly name: string;
62
+ };
63
+ readonly body: string;
64
+ readonly created: string;
65
+ }
66
+ interface ExportThread {
67
+ readonly id: string;
68
+ readonly resolved?: boolean;
69
+ readonly comments: readonly ExportComment[];
70
+ }
41
71
  interface ExportOptions {
42
72
  title?: string;
73
+ threads?: readonly ExportThread[];
43
74
  fetchImages?: boolean;
44
75
  signal?: AbortSignal;
45
76
  limits?: Partial<ExportLimits>;
@@ -51,5 +82,5 @@ interface ExportLimits {
51
82
  }
52
83
  export declare const DOCX_MIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
53
84
  export declare function exportDocx(source: ExportSource, options?: ExportOptions): Promise<Blob>;
54
- export type { DocxErrorCode, DocxImport, ExportLimits, ExportOptions, ExportSource, ImportLimits, ImportOptions, ImportWarning, ImportWarningCode };
85
+ export type { DocxErrorCode, DocxImport, ExportComment, ExportLimits, ExportOptions, ExportSource, ExportThread, ImportLimits, ImportOptions, ImportWarning, ImportWarningCode, ImportedComment, ImportedThread };
55
86
  //# sourceMappingURL=index.d.ts.map