@harbour-enterprises/superdoc 0.12.0-RC1 → 0.12.0-RC2

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.
Files changed (73) hide show
  1. package/dist/chunks/{eventemitter3-CRfwKE7Z.es.js → eventemitter3-C9iBZY5R.es.js} +1 -1
  2. package/dist/chunks/{eventemitter3-D38HWRLP.cjs → eventemitter3-Cj9ZwxFw.cjs} +1 -1
  3. package/dist/chunks/{index-CPZ-IxHT.es.js → index-BTkgQgI7.es.js} +2 -2
  4. package/dist/chunks/{index-BXKGjuVW.cjs → index-C6SLw2ph.cjs} +1 -1
  5. package/dist/chunks/{index-CqRwYOdx.cjs → index-CbUTRvRk.cjs} +1 -1
  6. package/dist/chunks/{index-Y7BlAr93.es.js → index-kWwSELc2.es.js} +4 -4
  7. package/dist/chunks/{jszip-ChlzEvf9.cjs → jszip-D9YbjC4E.cjs} +1 -1
  8. package/dist/chunks/{jszip-DO3il9iI.es.js → jszip-OpmRHhd4.es.js} +1 -1
  9. package/dist/chunks/super-editor.es-VeFFgSyB.cjs +451 -0
  10. package/dist/chunks/{super-editor.es-jxkEOua-.es.js → super-editor.es-jrBL9mdr.es.js} +16776 -16177
  11. package/dist/chunks/{url-t15h9onH.es.js → url-C29KYeaj.es.js} +2 -2
  12. package/dist/chunks/{url-6Xu7gR4T.cjs → url-DRGmEUtI.cjs} +1 -1
  13. package/dist/chunks/vue-BQCc2YbW.cjs +13 -0
  14. package/dist/chunks/{vue-DXpzqXur.es.js → vue-DKS68Dra.es.js} +1159 -1140
  15. package/dist/chunks/{xml-js-zhwNEV5e.cjs → xml-js-CMQ3QRee.cjs} +1 -1
  16. package/dist/chunks/{xml-js-kwrvzyhm.es.js → xml-js-CgHhGhcJ.es.js} +2 -2
  17. package/dist/components/CommentsLayer/commentsList/super-comments-list.d.ts +1 -2
  18. package/dist/components/CommentsLayer/commentsList/super-comments-list.d.ts.map +1 -1
  19. package/dist/core/SuperDoc.d.ts +264 -41
  20. package/dist/core/SuperDoc.d.ts.map +1 -1
  21. package/dist/stores/superdoc-store.d.ts +6 -744
  22. package/dist/stores/superdoc-store.d.ts.map +1 -1
  23. package/dist/style.css +29 -29
  24. package/dist/super-editor/ai-writer.es.js +208 -121
  25. package/dist/super-editor/chunks/{converter-B_CnsyBe.js → converter-D1a6grDV.js} +2494 -2424
  26. package/dist/super-editor/chunks/{docx-zipper-CmQ11kAl.js → docx-zipper-L7BeJRax.js} +1 -1
  27. package/dist/super-editor/chunks/{editor-D_W26AM3.js → editor-BY7pz5xQ.js} +11524 -11250
  28. package/dist/super-editor/chunks/{toolbar-DgpDtH5C.js → toolbar-DEvjPuNj.js} +132 -132
  29. package/dist/super-editor/components/toolbar/ai-helpers.d.ts +12 -0
  30. package/dist/super-editor/components/toolbar/ai-helpers.d.ts.map +1 -1
  31. package/dist/super-editor/components/toolbar/super-toolbar.d.ts +460 -84
  32. package/dist/super-editor/components/toolbar/super-toolbar.d.ts.map +1 -1
  33. package/dist/super-editor/converter.es.js +1 -1
  34. package/dist/super-editor/core/Editor.d.ts +507 -48
  35. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  36. package/dist/super-editor/core/helpers/annotator.d.ts +10 -3
  37. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  38. package/dist/super-editor/core/helpers/getActiveFormatting.d.ts.map +1 -1
  39. package/dist/super-editor/core/index.d.ts +3 -3
  40. package/dist/super-editor/core/super-converter/SuperConverter.d.ts +1 -1
  41. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  42. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  43. package/dist/super-editor/core/super-converter/helpers.d.ts +1 -1
  44. package/dist/super-editor/core/super-converter/helpers.d.ts.map +1 -1
  45. package/dist/super-editor/core/super-converter/v2/importer/annotationImporter.d.ts.map +1 -1
  46. package/dist/super-editor/core/super-converter/v2/importer/listImporter.d.ts +25 -0
  47. package/dist/super-editor/core/super-converter/v2/importer/listImporter.d.ts.map +1 -1
  48. package/dist/super-editor/docx-zipper.es.js +2 -2
  49. package/dist/super-editor/editor.es.js +3 -3
  50. package/dist/super-editor/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  51. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/trackFieldAnnotationsDeletion.d.ts.map +1 -1
  52. package/dist/super-editor/extensions/linked-styles/linked-styles.d.ts.map +1 -1
  53. package/dist/super-editor/extensions/list-item/ListItemNodeView.d.ts +56 -0
  54. package/dist/super-editor/extensions/list-item/ListItemNodeView.d.ts.map +1 -0
  55. package/dist/super-editor/extensions/list-item/list-item.d.ts +0 -11
  56. package/dist/super-editor/extensions/list-item/list-item.d.ts.map +1 -1
  57. package/dist/super-editor/extensions/table/table.d.ts.map +1 -1
  58. package/dist/super-editor/file-zipper.es.js +1 -1
  59. package/dist/super-editor/style.css +1 -1
  60. package/dist/super-editor/super-editor.es.js +768 -557
  61. package/dist/super-editor/tests/editor/listItemHelpers.test.d.ts +2 -0
  62. package/dist/super-editor/tests/editor/listItemHelpers.test.d.ts.map +1 -0
  63. package/dist/super-editor/toolbar.es.js +2 -2
  64. package/dist/super-editor.cjs +1 -1
  65. package/dist/super-editor.d.ts +3 -0
  66. package/dist/super-editor.es.js +6 -6
  67. package/dist/superdoc.cjs +26 -26
  68. package/dist/superdoc.es.js +1114 -1011
  69. package/dist/superdoc.umd.js +16304 -15571
  70. package/dist/superdoc.umd.js.map +1 -1
  71. package/package.json +2 -2
  72. package/dist/chunks/super-editor.es-D2_UqVSP.cjs +0 -452
  73. package/dist/chunks/vue-Ckf0DkDN.cjs +0 -13
@@ -2,19 +2,25 @@
2
2
  * @typedef {Object} User The current user of this superdoc
3
3
  * @property {string} name The user's name
4
4
  * @property {string} email The user's email
5
- * @property {string | null} image The user's photo
5
+ * @property {string | null} [image] The user's photo
6
6
  */
7
7
  /**
8
- * @typedef {Object} Telemetry Telemetry configuration
8
+ * @typedef {Object} TelemetryConfig Telemetry configuration
9
9
  * @property {boolean} [enabled=true] Whether telemetry is enabled
10
- * @property {string} [licenceKey] The licence key for telemetry
10
+ * @property {string} [licenseKey] The licence key for telemetry
11
11
  * @property {string} [endpoint] The endpoint for telemetry
12
+ * @property {string} [superdocVersion] The version of the superdoc
12
13
  */
13
14
  /**
14
15
  * @typedef {Object} Document
15
- * @property {string} id The ID of the document
16
+ * @property {string} [id] The ID of the document
16
17
  * @property {string} type The type of the document
17
18
  * @property {File | null} [data] The initial data of the document
19
+ * @property {string} [name] The name of the document
20
+ * @property {string} [url] The URL of the document
21
+ * @property {boolean} [isNewFile] Whether the document is a new file
22
+ * @property {import('yjs').Doc} [ydoc] The Yjs document for collaboration
23
+ * @property {import('@hocuspocus/provider').HocuspocusProvider} [provider] The provider for collaboration
18
24
  */
19
25
  /**
20
26
  * @typedef {Object} Modules
@@ -22,12 +28,21 @@
22
28
  * @property {Object} [ai] AI module configuration
23
29
  * @property {string} [ai.apiKey] Harbour API key for AI features
24
30
  * @property {string} [ai.endpoint] Custom endpoint URL for AI services
31
+ * @property {Object} [collaboration] Collaboration module configuration
32
+ * @property {Object} [toolbar] Toolbar module configuration
33
+ */
34
+ /** @typedef {import('@harbour-enterprises/super-editor').Editor} Editor */
35
+ /**
36
+ * @typedef {string} DocumentMode
37
+ * @property {'editing'} editing The document is in editing mode
38
+ * @property {'viewing'} viewing The document is in viewing mode
39
+ * @property {'suggesting'} suggesting The document is in suggesting mode
25
40
  */
26
41
  /**
27
42
  * @typedef {Object} Config
28
43
  * @property {string} [superdocId] The ID of the SuperDoc
29
44
  * @property {string} selector The selector to mount the SuperDoc into
30
- * @property {'editing' | 'viewing' | 'suggesting'} documentMode The mode of the document
45
+ * @property {DocumentMode} documentMode The mode of the document
31
46
  * @property {'editor' | 'viewer' | 'suggester'} [role] The role of the user in this SuperDoc
32
47
  * @property {Object | string} [document] The document to load. If a string, it will be treated as a URL
33
48
  * @property {Array<Document>} documents The documents to load
@@ -40,11 +55,11 @@
40
55
  * @property {Array<string>} [toolbarGroups] Toolbar groups to show
41
56
  * @property {Object} [toolbarIcons] Icons to show in the toolbar
42
57
  * @property {boolean} [isDev] Whether the SuperDoc is in development mode
43
- * @property {Telemetry} [telemetry] Telemetry configuration
58
+ * @property {TelemetryConfig} [telemetry] Telemetry configuration
44
59
  * @property {(editor: Editor) => void} [onEditorBeforeCreate] Callback before an editor is created
45
60
  * @property {(editor: Editor) => void} [onEditorCreate] Callback after an editor is created
46
61
  * @property {() => void} [onEditorDestroy] Callback after an editor is destroyed
47
- * @property {(params: { error: object, editor: Editor, documentId: string, file: File })} [onContentError] Callback when there is an error in the content
62
+ * @property {(params: { error: object, editor: Editor, documentId: string, file: File }) => void} [onContentError] Callback when there is an error in the content
48
63
  * @property {(editor: { superdoc: SuperDoc }) => void} [onReady] Callback when the SuperDoc is ready
49
64
  * @property {(params: { type: string, data: object}) => void} [onCommentsUpdate] Callback when comments are updated
50
65
  * @property {(params: { context: SuperDoc, states: Array }) => void} [onAwarenessUpdate] Callback when awareness is updated
@@ -53,12 +68,26 @@
53
68
  * @property {(isOpened: boolean) => void} [onSidebarToggle] Callback when the sidebar is toggled
54
69
  * @property {(params: { editor: Editor }) => void} [onCollaborationReady] Callback when collaboration is ready
55
70
  * @property {(params: { editor: Editor }) => void} [onEditorUpdate] Callback when document is updated
56
- * @property {(params: { error: Exception }) => void} [onException] Callback when an exception is thrown
71
+ * @property {(params: { error: Error }) => void} [onException] Callback when an exception is thrown
72
+ * @property {(params: { isRendered: boolean }) => void} [onCommentsListChange] Callback when the comments list is rendered
73
+ * @property {string} [format] The format of the document (docx, pdf, html)
74
+ * @property {Object[]} [editorExtensions] The extensions to load for the editor
75
+ * @property {boolean} [isInternal] Whether the SuperDoc is internal
76
+ * @property {string} [title] The title of the SuperDoc
77
+ * @property {Object[]} [conversations] The conversations to load
78
+ * @property {boolean} [isLocked] Whether the SuperDoc is locked
79
+ * @property {Object} [pdfViewer] The PDF viewer configuration
80
+ * @property {function(File): Promise<string>} [handleImageUpload] The function to handle image uploads
81
+ * @property {User} [lockedBy] The user who locked the SuperDoc
82
+ * @property {HocuspocusProviderWebsocket} [socket] The socket connection for collaboration
83
+ * @property {boolean} [rulers] Whether to show the ruler in the editor
57
84
  */
58
85
  /**
59
86
  * SuperDoc class
60
87
  * Expects a config object
88
+ *
61
89
  * @class
90
+ * @extends EventEmitter
62
91
  */
63
92
  export class SuperDoc extends EventEmitter<string | symbol, any> {
64
93
  /** @type {Array<string>} */
@@ -67,9 +96,14 @@ export class SuperDoc extends EventEmitter<string | symbol, any> {
67
96
  * @param {Config} config
68
97
  */
69
98
  constructor(config: Config);
70
- /** @type {number} */
71
- version: number;
72
- users: any;
99
+ /** @type {string} */
100
+ version: string;
101
+ /** @type {User[]} */
102
+ users: User[];
103
+ /** @type {import('yjs').Doc | undefined} */
104
+ ydoc: import("yjs").Doc | undefined;
105
+ /** @type {import('@hocuspocus/provider').HocuspocusProvider | undefined} */
106
+ provider: import("@hocuspocus/provider").HocuspocusProvider | undefined;
73
107
  /** @type {Config} */
74
108
  config: Config;
75
109
  userColorMap: Map<any, any>;
@@ -79,15 +113,19 @@ export class SuperDoc extends EventEmitter<string | symbol, any> {
79
113
  user: User;
80
114
  socket: any;
81
115
  isDev: boolean;
82
- activeEditor: any;
116
+ activeEditor: import("@harbour-enterprises/super-editor").Editor;
83
117
  comments: any[];
84
118
  readyEditors: number;
85
- isLocked: any;
86
- lockedBy: any;
87
- get requiredNumberOfEditors(): any;
119
+ isLocked: boolean;
120
+ lockedBy: User;
121
+ /**
122
+ * Get the number of editors that are required for this superdoc
123
+ * @returns {number} The number of required editors
124
+ */
125
+ get requiredNumberOfEditors(): number;
88
126
  get state(): {
89
127
  documents: any;
90
- users: any;
128
+ users: User[];
91
129
  };
92
130
  app: any;
93
131
  pinia: any;
@@ -96,31 +134,66 @@ export class SuperDoc extends EventEmitter<string | symbol, any> {
96
134
  isCollaborative: boolean;
97
135
  /**
98
136
  * Add a user to the shared users list
99
- *
100
137
  * @param {Object} user The user to add
101
138
  * @returns {void}
102
139
  */
103
140
  addSharedUser(user: any): void;
104
141
  /**
105
142
  * Remove a user from the shared users list
106
- *
107
143
  * @param {String} email The email of the user to remove
108
144
  * @returns {void}
109
145
  */
110
146
  removeSharedUser(email: string): void;
111
147
  telemetry: Telemetry;
148
+ /**
149
+ * Triggered when there is an error in the content
150
+ * @param {Object} param0
151
+ * @param {Error} param0.error The error that occurred
152
+ * @param {Editor} param0.editor The editor that caused the error
153
+ */
112
154
  onContentError({ error, editor }: {
113
- error: any;
114
- editor: any;
155
+ error: Error;
156
+ editor: Editor;
115
157
  }): void;
158
+ /**
159
+ * Triggered when the PDF document is ready
160
+ * @returns {void}
161
+ */
116
162
  broadcastPdfDocumentReady(): void;
163
+ /**
164
+ * Triggered when the superdoc is ready
165
+ * @returns {void}
166
+ */
117
167
  broadcastReady(): void;
118
- broadcastEditorBeforeCreate(editor: any): void;
119
- broadcastEditorCreate(editor: any): void;
168
+ /**
169
+ * Triggered before an editor is created
170
+ * @param {Editor} editor The editor that is about to be created
171
+ * @returns {void}
172
+ */
173
+ broadcastEditorBeforeCreate(editor: Editor): void;
174
+ /**
175
+ * Triggered when an editor is created
176
+ * @param {Editor} editor The editor that was created
177
+ * @returns {void}
178
+ */
179
+ broadcastEditorCreate(editor: Editor): void;
180
+ /**
181
+ * Triggered when an editor is destroyed
182
+ * @returns {void}
183
+ */
120
184
  broadcastEditorDestroy(): void;
121
- broadcastSidebarToggle(isOpened: any): void;
185
+ /**
186
+ * Triggered when the comments sidebar is toggled
187
+ * @param {boolean} isOpened
188
+ */
189
+ broadcastSidebarToggle(isOpened: boolean): void;
122
190
  log(...args: any[]): void;
123
- setActiveEditor(editor: any): void;
191
+ /**
192
+ * Set the active editor
193
+ * @param {Editor} editor The editor to set as active
194
+ * @returns {void}
195
+ */
196
+ setActiveEditor(editor: Editor): void;
124
197
  /**
125
198
  * Toggle the ruler visibility for SuperEditors
126
199
  *
@@ -129,36 +202,101 @@ export class SuperDoc extends EventEmitter<string | symbol, any> {
129
202
  toggleRuler(): void;
130
203
  toolbarElement: any;
131
204
  toolbar: SuperToolbar;
132
- addCommentsList(element: any): void;
205
+ /**
206
+ * Add a comments list to the superdoc
207
+ * Requires the comments module to be enabled
208
+ * @param {Element} element The DOM element to render the comments list in
209
+ * @returns {void}
210
+ */
211
+ addCommentsList(element: Element): void;
133
212
  commentsList: SuperComments;
213
+ /**
214
+ * Remove the comments list from the superdoc
215
+ * @returns {void}
216
+ */
134
217
  removeCommentsList(): void;
218
+ /**
219
+ * Triggered when a toolbar command is executed
220
+ * @param {Object} param0
221
+ * @param {Object} param0.item The toolbar item that was clicked
222
+ * @param {string} param0.argument The argument passed to the command
223
+ */
135
224
  onToolbarCommand({ item, argument }: {
136
225
  item: any;
137
- argument: any;
226
+ argument: string;
138
227
  }): void;
139
- setDocumentMode(type: any): void;
140
- search(text: any): any;
141
- goToSearchResult(match: any): any;
228
+ /**
229
+ * Set the document mode.
230
+ * @param {DocumentMode} type
231
+ * @returns {void}
232
+ */
233
+ setDocumentMode(type: DocumentMode): void;
234
+ /**
235
+ * Search for text or regex in the active editor
236
+ * @param {string | RegExp} text The text or regex to search for
237
+ * @returns {Object[]} The search results
238
+ */
239
+ search(text: string | RegExp): any[];
240
+ /**
241
+ * Go to the next search result
242
+ * @param {Object} match The match object
243
+ * @returns {void}
244
+ */
245
+ goToSearchResult(match: any): void;
142
246
  /**
143
247
  * Set the document to locked or unlocked
144
248
  * @param {boolean} lock
145
249
  */
146
250
  setLocked(lock?: boolean): void;
147
- getHTML(): any[];
251
+ /**
252
+ * Get the HTML content of all editors
253
+ * @returns {Array<string>} The HTML content of all editors
254
+ */
255
+ getHTML(): Array<string>;
148
256
  /**
149
257
  * Lock the current superdoc
150
258
  * @param {Boolean} isLocked
151
259
  * @param {User} lockedBy The user who locked the superdoc
152
260
  */
153
261
  lockSuperdoc(isLocked: boolean, lockedBy: User): void;
154
- export({ exportType, commentsType, exportedName, additionalFiles, additionalFileNames }?: {
262
+ /**
263
+ * Export the superdoc to a file
264
+ * @param {Object} params
265
+ * @param {string[]} [params.exportType]
266
+ * @param {string} [params.commentsType]
267
+ * @param {string} [params.exportedName]
268
+ * @param {Array} [params.additionalFiles]
269
+ * @param {Array} [params.additionalFileNames]
270
+ * @param {boolean} [params.isFinalDoc]
271
+ * @returns {Promise<void>} The exported file
272
+ */
273
+ export({ exportType, commentsType, exportedName, additionalFiles, additionalFileNames, isFinalDoc, }?: {
155
274
  exportType?: string[];
275
+ commentsType?: string;
276
+ exportedName?: string;
156
277
  additionalFiles?: any[];
157
278
  additionalFileNames?: any[];
279
+ isFinalDoc?: boolean;
158
280
  }): Promise<void>;
159
- exportEditorsToDOCX({ commentsType }?: {}): Promise<any[]>;
281
+ /**
282
+ * Export editors to DOCX format.
283
+ * @param {{ commentsType?: string, isFinalDoc?: boolean }} [options]
284
+ * @returns {Promise<Array<Blob>>}
285
+ */
286
+ exportEditorsToDOCX({ commentsType, isFinalDoc }?: {
287
+ commentsType?: string;
288
+ isFinalDoc?: boolean;
289
+ }): Promise<Array<Blob>>;
160
290
  pendingCollaborationSaves: number;
291
+ /**
292
+ * Save the superdoc if in collaboration mode
293
+ * @returns {Promise<void[]>} Resolves when all documents have saved
294
+ */
161
295
  save(): Promise<void[]>;
296
+ /**
297
+ * Destroy the superdoc instance
298
+ * @returns {void}
299
+ */
162
300
  destroy(): void;
163
301
  /**
164
302
  * Focus the active editor or the first editor in the superdoc
@@ -182,12 +320,12 @@ export type User = {
182
320
  /**
183
321
  * The user's photo
184
322
  */
185
- image: string | null;
323
+ image?: string | null;
186
324
  };
187
325
  /**
188
326
  * Telemetry configuration
189
327
  */
190
- export type Telemetry = {
328
+ export type TelemetryConfig = {
191
329
  /**
192
330
  * Whether telemetry is enabled
193
331
  */
@@ -195,17 +333,21 @@ export type Telemetry = {
195
333
  /**
196
334
  * The licence key for telemetry
197
335
  */
198
- licenceKey?: string;
336
+ licenseKey?: string;
199
337
  /**
200
338
  * The endpoint for telemetry
201
339
  */
202
340
  endpoint?: string;
341
+ /**
342
+ * The version of the superdoc
343
+ */
344
+ superdocVersion?: string;
203
345
  };
204
346
  export type Document = {
205
347
  /**
206
348
  * The ID of the document
207
349
  */
208
- id: string;
350
+ id?: string;
209
351
  /**
210
352
  * The type of the document
211
353
  */
@@ -214,6 +356,26 @@ export type Document = {
214
356
  * The initial data of the document
215
357
  */
216
358
  data?: File | null;
359
+ /**
360
+ * The name of the document
361
+ */
362
+ name?: string;
363
+ /**
364
+ * The URL of the document
365
+ */
366
+ url?: string;
367
+ /**
368
+ * Whether the document is a new file
369
+ */
370
+ isNewFile?: boolean;
371
+ /**
372
+ * The Yjs document for collaboration
373
+ */
374
+ ydoc?: import("yjs").Doc;
375
+ /**
376
+ * The provider for collaboration
377
+ */
378
+ provider?: import("@hocuspocus/provider").HocuspocusProvider;
217
379
  };
218
380
  export type Modules = {
219
381
  /**
@@ -227,7 +389,17 @@ export type Modules = {
227
389
  apiKey?: string;
228
390
  endpoint?: string;
229
391
  };
392
+ /**
393
+ * Collaboration module configuration
394
+ */
395
+ collaboration?: any;
396
+ /**
397
+ * Toolbar module configuration
398
+ */
399
+ toolbar?: any;
230
400
  };
401
+ export type Editor = import("@harbour-enterprises/super-editor").Editor;
402
+ export type DocumentMode = string;
231
403
  export type Config = {
232
404
  /**
233
405
  * The ID of the SuperDoc
@@ -240,7 +412,7 @@ export type Config = {
240
412
  /**
241
413
  * The mode of the document
242
414
  */
243
- documentMode: "editing" | "viewing" | "suggesting";
415
+ documentMode: DocumentMode;
244
416
  /**
245
417
  * The role of the user in this SuperDoc
246
418
  */
@@ -292,7 +464,7 @@ export type Config = {
292
464
  /**
293
465
  * Telemetry configuration
294
466
  */
295
- telemetry?: Telemetry;
467
+ telemetry?: TelemetryConfig;
296
468
  /**
297
469
  * Callback before an editor is created
298
470
  */
@@ -313,7 +485,7 @@ export type Config = {
313
485
  editor: Editor;
314
486
  documentId: string;
315
487
  file: File;
316
- }) => any;
488
+ }) => void;
317
489
  /**
318
490
  * Callback when the SuperDoc is ready
319
491
  */
@@ -365,11 +537,62 @@ export type Config = {
365
537
  * Callback when an exception is thrown
366
538
  */
367
539
  onException?: (params: {
368
- error: Exception;
540
+ error: Error;
541
+ }) => void;
542
+ /**
543
+ * Callback when the comments list is rendered
544
+ */
545
+ onCommentsListChange?: (params: {
546
+ isRendered: boolean;
369
547
  }) => void;
548
+ /**
549
+ * The format of the document (docx, pdf, html)
550
+ */
551
+ format?: string;
552
+ /**
553
+ * The extensions to load for the editor
554
+ */
555
+ editorExtensions?: any[];
556
+ /**
557
+ * Whether the SuperDoc is internal
558
+ */
559
+ isInternal?: boolean;
560
+ /**
561
+ * The title of the SuperDoc
562
+ */
563
+ title?: string;
564
+ /**
565
+ * The conversations to load
566
+ */
567
+ conversations?: any[];
568
+ /**
569
+ * Whether the SuperDoc is locked
570
+ */
571
+ isLocked?: boolean;
572
+ /**
573
+ * The PDF viewer configuration
574
+ */
575
+ pdfViewer?: any;
576
+ /**
577
+ * The function to handle image uploads
578
+ */
579
+ handleImageUpload?: (arg0: File) => Promise<string>;
580
+ /**
581
+ * The user who locked the SuperDoc
582
+ */
583
+ lockedBy?: User;
584
+ /**
585
+ * The socket connection for collaboration
586
+ */
587
+ socket?: HocuspocusProviderWebsocket;
588
+ /**
589
+ * Whether to show the ruler in the editor
590
+ */
591
+ rulers?: boolean;
370
592
  };
371
- import EventEmitter from 'eventemitter3';
593
+ import { EventEmitter } from 'eventemitter3';
372
594
  import { Telemetry } from '@harbour-enterprises/common/Telemetry.js';
373
595
  import { SuperToolbar } from '@harbour-enterprises/super-editor';
374
596
  import { SuperComments } from '../components/CommentsLayer/commentsList/super-comments-list.js';
597
+ import { HocuspocusProviderWebsocket } from '@hocuspocus/provider';
375
598
  //# sourceMappingURL=SuperDoc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuperDoc.d.ts","sourceRoot":"","sources":["../../src/core/SuperDoc.js"],"names":[],"mappings":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