@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
@@ -1,20 +1,151 @@
1
+ /**
2
+ * @typedef {Object} FieldValue
3
+ * @property {string} input_id The id of the input field
4
+ * @property {string} input_value The value to insert into the field
5
+ */
1
6
  /**
2
7
  * Editor main class.
8
+ *
9
+ * Expects a config object.
10
+ * @class
11
+ */
12
+ /**
13
+ * @typedef {Object} User The current user of this superdoc
14
+ * @property {string} name The user's name
15
+ * @property {string} email The user's email
16
+ * @property {string | null} image The user's photo
17
+ */
18
+ /**
19
+ * @typedef {Object} DocxNode A JSON representation of a docx node
20
+ */
21
+ /**
22
+ * @typedef {Object} EditorOptions
23
+ * @property {HTMLElement} [element] - The container element for the editor
24
+ * @property {string} [selector] - CSS selector for the editor container
25
+ * @property {boolean} [isHeadless=false] - Whether the editor is running in headless mode
26
+ * @property {Document} [mockDocument] - Mock document for testing
27
+ * @property {Window} [mockWindow] - Mock window for testing
28
+ * @property {string} [content=''] - XML content
29
+ * @property {User} [user] - Current user information
30
+ * @property {Array.<User>} [users=[]] - List of users for collaboration
31
+ * @property {Object} [media={}] - Media configuration
32
+ * @property {Object} [mediaFiles={}] - Media files
33
+ * @property {Object} [fonts={}] - Font configuration
34
+ * @property {string} [documentMode='editing'] - Document mode ('editing', 'viewing', 'suggesting')
35
+ * @property {string} [mode='docx'] - Editor mode ('docx', 'text', 'html')
36
+ * @property {string} [role='editor'] - User role ('editor', 'viewer', 'suggester')
37
+ * @property {Array} [colors=[]] - Available colors
38
+ * @property {Object} [converter] - Document converter
39
+ * @property {Object} [fileSource] - Source of the file
40
+ * @property {Object} [initialState] - Initial editor state
41
+ * @property {string} [documentId] - Unique document identifier
42
+ * @property {Array} [extensions=[]] - Editor extensions
43
+ * @property {boolean} [editable=true] - Whether the editor is editable
44
+ * @property {Object} [editorProps={}] - Editor properties
45
+ * @property {Object} [parseOptions={}] - Parsing options
46
+ * @property {Object} [coreExtensionOptions={}] - Core extension options
47
+ * @property {boolean} [enableInputRules=true] - Whether to enable input rules
48
+ * @property {boolean} [isCommentsEnabled=false] - Whether comments are enabled
49
+ * @property {boolean} [isNewFile=false] - Whether this is a new file
50
+ * @property {number} [scale=1] - Editor scale/zoom
51
+ * @property {boolean} [annotations=false] - Whether annotations are enabled
52
+ * @property {boolean} [isInternal=false] - Whether this is an internal editor
53
+ * @property {Array} [externalExtensions=[]] - External extensions
54
+ * @property {Object} [numbering={}] - Numbering configuration
55
+ * @property {Function} [onBeforeCreate] - Called before editor creation
56
+ * @property {Function} [onCreate] - Called after editor creation
57
+ * @property {Function} [onUpdate] - Called when editor content updates
58
+ * @property {Function} [onSelectionUpdate] - Called when selection updates
59
+ * @property {Function} [onTransaction] - Called when a transaction is processed
60
+ * @property {Function} [onFocus] - Called when editor gets focus
61
+ * @property {Function} [onBlur] - Called when editor loses focus
62
+ * @property {Function} [onDestroy] - Called when editor is destroyed
63
+ * @property {Function} [onContentError] - Called when there's a content error
64
+ * @property {Function} [onTrackedChangesUpdate] - Called when tracked changes update
65
+ * @property {Function} [onCommentsUpdate] - Called when comments update
66
+ * @property {Function} [onCommentsLoaded] - Called when comments are loaded
67
+ * @property {Function} [onCommentClicked] - Called when a comment is clicked
68
+ * @property {Function} [onCommentLocationsUpdate] - Called when comment locations update
69
+ * @property {Function} [onDocumentLocked] - Called when document is locked
70
+ * @property {Function} [onFirstRender] - Called on first render
71
+ * @property {Function} [onCollaborationReady] - Called when collaboration is ready
72
+ * @property {Function} [onPaginationUpdate] - Called when pagination updates
73
+ * @property {Function} [onException] - Called when an exception occurs
74
+ * @property {Function} [handleImageUpload] - Handler for image uploads
75
+ * @property {Object} [telemetry] - Telemetry configuration
76
+ */
77
+ /**
78
+ * Main editor class that manages document state, extensions, and user interactions
79
+ * @class
80
+ * @extends EventEmitter
3
81
  */
4
82
  export class Editor extends EventEmitter {
5
83
  /**
6
84
  * Load the data from DOCX to be used in the schema.
7
85
  * Expects a DOCX file.
86
+ * @static
87
+ * @async
88
+ * @param {File|Blob|Buffer} fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
89
+ * @param {boolean} [isNode=false] - Whether the method is being called in a Node.js environment
90
+ * @returns {Promise<Array>} - A promise that resolves to an array containing:
91
+ * - [0] xmlFiles - Array of XML files extracted from the DOCX
92
+ * - [1] mediaFiles - Object containing media files with URLs (browser only)
93
+ * - [2] mediaFiles - Object containing media files with base64 data
94
+ * - [3] fonts - Object containing font files from the DOCX
95
+ */
96
+ static loadXmlData(fileSource: File | Blob | Buffer, isNode?: boolean): Promise<any[]>;
97
+ /**
98
+ * Get the document version
99
+ * @static
100
+ * @param {Object} doc - Document object
101
+ * @returns {string} Document version
102
+ */
103
+ static getDocumentVersion(doc: any): string;
104
+ /**
105
+ * Update the document version
106
+ * @static
107
+ * @param {Object} doc - Document object
108
+ * @param {string} version - New version
109
+ * @returns {Object}
110
+ */
111
+ static updateDocumentVersion(doc: any, version: string): any;
112
+ /**
113
+ * Check if migrations are needed for the data
114
+ * @static
115
+ * @param {Object} data - Document data
116
+ * @returns {boolean} Whether migrations are needed
117
+ */
118
+ static checkIfMigrationsNeeded(data: any): boolean;
119
+ /**
120
+ * Create a new Editor instance
121
+ * @param {EditorOptions} options - Editor configuration options
122
+ * @returns {void}
123
+ */
124
+ constructor(options: EditorOptions);
125
+ /**
126
+ * Service for managing extensions
127
+ * @type {Object}
8
128
  */
9
- static loadXmlData(fileSource: any, isNode?: boolean): Promise<any[]>;
10
- static getDocumentVersion(content: any): any;
11
- static updateDocumentVersion(content: any, version: any): any;
12
- static checkIfMigrationsNeeded(version: any): boolean;
13
- constructor(options: any);
14
129
  extensionService: any;
15
- extensionStorage: {};
130
+ /**
131
+ * Storage for extension data
132
+ * @type {Object}
133
+ */
134
+ extensionStorage: any;
135
+ /**
136
+ * ProseMirror schema for the editor
137
+ * @type {Object}
138
+ */
16
139
  schema: any;
140
+ /**
141
+ * ProseMirror view instance
142
+ * @type {Object}
143
+ */
17
144
  view: any;
145
+ /**
146
+ * Whether the editor currently has focus
147
+ * @type {boolean}
148
+ */
18
149
  isFocused: boolean;
19
150
  options: {
20
151
  element: any;
@@ -73,120 +204,170 @@ export class Editor extends EventEmitter {
73
204
  handleImageUpload: any;
74
205
  telemetry: any;
75
206
  };
207
+ /**
208
+ * Set the toolbar for this editor
209
+ * @param {Object} toolbar - The toolbar instance
210
+ * @returns {void}
211
+ */
76
212
  setToolbar(toolbar: any): void;
77
213
  toolbar: any;
78
214
  /**
79
215
  * Focus the editor.
216
+ * @returns {void}
80
217
  */
81
218
  focus(): void;
82
219
  /**
83
- * Get the editor state.
220
+ * Get the editor state
221
+ * @returns {Object} ProseMirror state
84
222
  */
85
223
  get state(): any;
86
224
  /**
87
225
  * Get the editor storage.
226
+ * @returns {Object} Editor storage object
88
227
  */
89
- get storage(): {};
228
+ get storage(): any;
90
229
  /**
91
230
  * Get object of registered commands.
231
+ * @returns {Object} Commands object
92
232
  */
93
233
  get commands(): any;
94
234
  /**
95
235
  * Check if the editor is editable.
236
+ * @returns {boolean}
96
237
  */
97
- get isEditable(): any;
238
+ get isEditable(): boolean;
98
239
  /**
99
240
  * Check if editor is destroyed.
241
+ * @returns {boolean}
100
242
  */
101
- get isDestroyed(): any;
243
+ get isDestroyed(): boolean;
102
244
  /**
103
245
  * Get the editor element
246
+ * @returns {HTMLElement} The editor element
104
247
  */
105
- get element(): any;
248
+ get element(): HTMLElement;
106
249
  /**
107
250
  * Get possible users of the editor.
251
+ * @returns {Array.<User>} List of users
108
252
  */
109
- get users(): any[];
253
+ get users(): Array<User>;
110
254
  /**
111
255
  * Create a chain of commands to call multiple commands at once.
256
+ * @returns {Object} Command chain
112
257
  */
113
258
  chain(): any;
114
259
  /**
115
260
  * Check if a command or a chain of commands can be executed. Without executing it.
261
+ * @returns {Object} Object with methods to check command availability
116
262
  */
117
263
  can(): any;
118
- setDocumentMode(documentMode: any): void;
119
264
  /**
265
+ * Set the document mode
266
+ * @param {string} documentMode - The document mode ('editing', 'viewing', 'suggesting')
267
+ */
268
+ setDocumentMode(documentMode: string): void;
269
+ /**
270
+ * Initialize data for collaborative editing
120
271
  * If we are replacing data and have a valid provider, listen for synced event
121
272
  * so that we can initialize the data
273
+ * @returns {void}
122
274
  */
123
275
  initializeCollaborationData(): void;
124
276
  /**
125
277
  * Set editor options and update state.
126
- * @param options List of options.
278
+ * @param {EditorOptions} options - Editor options
279
+ * @returns {void}
127
280
  */
128
- setOptions(options: any): void;
281
+ setOptions(options?: EditorOptions): void;
129
282
  /**
130
- * Updates editable state.
131
- * @param editable Editable value.
132
- * @param emitUpdate Emit 'update' event or not.
283
+ * Set whether the editor is editable
284
+ * @param {boolean} [editable=true] - Whether the editor is editable
285
+ * @param {boolean} [emitUpdate=true] - Whether to emit an update event
286
+ * @returns {void}
133
287
  */
134
- setEditable(editable: any, emitUpdate?: boolean): void;
288
+ setEditable(editable?: boolean, emitUpdate?: boolean): void;
135
289
  /**
136
290
  * Register PM plugin.
137
291
  * @param plugin PM plugin.
138
292
  * @param handlePlugins Optional function for handling plugin merge.
293
+ * @returns {void}
139
294
  */
140
295
  registerPlugin(plugin: any, handlePlugins: any): void;
141
296
  /**
142
- * Unregister PM plugin.
143
- * @param nameOrPluginKey Plugin name.
297
+ * Unregister a PM plugin
298
+ * @param {string|Object} nameOrPlugin - Plugin name or plugin instance
299
+ * @returns {void}
144
300
  */
145
- unregisterPlugin(nameOrPluginKey: any): void;
301
+ unregisterPlugin(nameOrPlugin: string | any): void;
146
302
  converter: any;
147
303
  /**
148
304
  * Creates all node views.
305
+ * @returns {void}
149
306
  */
150
307
  createNodeViews(): void;
151
- getMaxContentSize(): {
152
- width?: undefined;
153
- height?: undefined;
154
- } | {
155
- width: number;
156
- height: number;
157
- };
158
308
  /**
159
- * Initialize default styles for the editor container and ProseMirror.
160
- * Get page size and margins from the converter.
161
- * Set document default font and font size.
309
+ * Get the maximum content size
310
+ * @returns {Object} Size object with width and height
162
311
  */
163
- initDefaultStyles(element?: any): void;
164
- initMobileStyles(element: any): void;
312
+ getMaxContentSize(): any;
313
+ /**
314
+ * Initialize default styles for the editor container and ProseMirror.
315
+ * Get page size and margins from the converter.
316
+ * Set document default font and font size.
317
+ *
318
+ * @param {HTMLElement} [element=this.element] - The DOM element to apply styles to
319
+ * @returns {void}
320
+ */
321
+ initDefaultStyles(element?: HTMLElement): void;
322
+ /**
323
+ * Initializes responsive styles for mobile devices.
324
+ * Sets up scaling based on viewport width and handles orientation changes.
325
+ *
326
+ * @param {HTMLElement|void} element - The DOM element to apply mobile styles to
327
+ * @returns {void}
328
+ */
329
+ initMobileStyles(element: HTMLElement | void): void;
165
330
  /**
166
331
  * Get attrs of the currently selected node or mark.
332
+ * @param {String} nameOrType
167
333
  * @example
168
334
  * editor.getAttributes('textStyle').color
169
335
  */
170
- getAttributes(nameOrType: any): any;
336
+ getAttributes(nameOrType: string): any;
171
337
  /**
172
338
  * Returns if the currently selected node or mark is active.
339
+ * @param {String|Object} nameOrAttributes - The name of the node/mark or an attributes object
340
+ * @param {Object} [attributesOrUndefined] - Optional attributes to check when first parameter is a name
341
+ * @returns {Boolean} Whether the node or mark is active with the specified attributes
173
342
  * @example
174
343
  * editor.isActive('bold')
175
344
  * editor.isActive('textStyle', { color: 'purple' })
176
345
  * editor.isActive({ textAlign: 'center' })
177
346
  */
178
- isActive(nameOrAttributes: any, attributesOrUndefined: any): boolean;
347
+ isActive(nameOrAttributes: string | any, attributesOrUndefined?: any): boolean;
179
348
  /**
180
349
  * Get the document as JSON.
181
350
  */
351
+ /**
352
+ * Get the editor content as JSON
353
+ * @returns {Object} Editor content as JSON
354
+ */
182
355
  getJSON(): any;
183
356
  /**
184
357
  * Get HTML string of the document
185
358
  */
359
+ /**
360
+ * Get the editor content as HTML
361
+ * @returns {string} Editor content as HTML
362
+ */
186
363
  getHTML(): string;
187
364
  /**
188
365
  * Get page styles
189
366
  */
367
+ /**
368
+ * Get page styles
369
+ * @returns {Object} Page styles
370
+ */
190
371
  getPageStyles(): any;
191
372
  /**
192
373
  * Update page styles
@@ -200,34 +381,312 @@ export class Editor extends EventEmitter {
200
381
  }): void;
201
382
  /**
202
383
  * Export the editor document to DOCX.
384
+ * @async
385
+ * @param {Object} options - The export options
386
+ * @param {boolean} [options.isFinalDoc=false] - Whether this is the final document version
387
+ * @param {string} [options.commentsType] - The type of comments to include
388
+ * @param {Array} [options.comments=[]] - Array of comments to include in the document
389
+ * @returns {Promise<Blob|ArrayBuffer>} The exported DOCX file
203
390
  */
204
- exportDocx({ isFinalDoc, commentsType, comments }?: {
391
+ exportDocx({ isFinalDoc, commentsType, exportJsonOnly, exportXmlOnly, comments }?: {
205
392
  isFinalDoc?: boolean;
393
+ commentsType?: string;
206
394
  comments?: any[];
207
- }): Promise<any>;
395
+ }): Promise<Blob | ArrayBuffer>;
208
396
  /**
209
- * Destroy the editor.
397
+ * Destroy the editor and clean up resources
398
+ * @returns {void}
210
399
  */
211
400
  destroy(): void;
212
401
  /**
213
- * Check for any necessary document migrations in collaboration mode
214
- *
215
- * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
402
+ * Process collaboration migrations
403
+ * @returns {Object | void} Migration results
404
+ */
405
+ processCollaborationMigrations(): any | void;
406
+ /**
407
+ * Replace the current file
408
+ * @async
409
+ * @param {Object} file - New file data
410
+ * @returns {Promise<void>}
411
+ */
412
+ replaceFile(file: any): Promise<void>;
413
+ /**
414
+ * Get all nodes of a specific type
415
+ * @param {string} type - Node type
416
+ * @returns {Array} Array of nodes
216
417
  */
217
- processCollaborationMigrations(): Y.Doc | undefined;
218
- replaceFile(newFile: any): Promise<void>;
219
- getNodesOfType(type: any): any;
220
- replaceNodeWithHTML(targetNode: any, html: any): void;
418
+ getNodesOfType(type: string): any[];
419
+ /**
420
+ * Replace a node with HTML content
421
+ * @param {Object} targetNode - The node to replace
422
+ * @param {string} html - HTML content to replace with
423
+ * @returns {void}
424
+ */
425
+ replaceNodeWithHTML(targetNode: any, html: string): void;
221
426
  /**
222
427
  * A command to prepare the editor to receive annotations. This will
223
428
  * pre-process the document as needed prior to running in the annotator.
224
429
  *
225
430
  * Currently this is only used for table generation but additional pre-processing can be done here.
226
- * @param {Array[Object]} annotationValues
431
+ *
432
+ * @param {FieldValue[]} annotationValues
433
+ * @returns {void}
434
+ */
435
+ prepareForAnnotations(annotationValues?: FieldValue[]): void;
436
+ /**
437
+ * Annotate the document with the given annotation values.
438
+ *
439
+ * @param {FieldValue[]} annotationValues List of field values to apply.
440
+ * @param {String[]} hiddenIds List of field ids to remove from the document.
227
441
  * @returns {void}
228
442
  */
229
- prepareForAnnotations(annotationValues?: any): void;
443
+ annotate(annotationValues?: FieldValue[], hiddenIds?: string[]): void;
230
444
  #private;
231
445
  }
446
+ export type FieldValue = {
447
+ /**
448
+ * The id of the input field
449
+ */
450
+ input_id: string;
451
+ /**
452
+ * The value to insert into the field
453
+ */
454
+ input_value: string;
455
+ };
456
+ /**
457
+ * The current user of this superdoc
458
+ */
459
+ export type User = {
460
+ /**
461
+ * The user's name
462
+ */
463
+ name: string;
464
+ /**
465
+ * The user's email
466
+ */
467
+ email: string;
468
+ /**
469
+ * The user's photo
470
+ */
471
+ image: string | null;
472
+ };
473
+ /**
474
+ * A JSON representation of a docx node
475
+ */
476
+ export type DocxNode = any;
477
+ export type EditorOptions = {
478
+ /**
479
+ * - The container element for the editor
480
+ */
481
+ element?: HTMLElement;
482
+ /**
483
+ * - CSS selector for the editor container
484
+ */
485
+ selector?: string;
486
+ /**
487
+ * - Whether the editor is running in headless mode
488
+ */
489
+ isHeadless?: boolean;
490
+ /**
491
+ * - Mock document for testing
492
+ */
493
+ mockDocument?: Document;
494
+ /**
495
+ * - Mock window for testing
496
+ */
497
+ mockWindow?: Window;
498
+ /**
499
+ * - XML content
500
+ */
501
+ content?: string;
502
+ /**
503
+ * - Current user information
504
+ */
505
+ user?: User;
506
+ /**
507
+ * - List of users for collaboration
508
+ */
509
+ users?: Array<User>;
510
+ /**
511
+ * - Media configuration
512
+ */
513
+ media?: any;
514
+ /**
515
+ * - Media files
516
+ */
517
+ mediaFiles?: any;
518
+ /**
519
+ * - Font configuration
520
+ */
521
+ fonts?: any;
522
+ /**
523
+ * - Document mode ('editing', 'viewing', 'suggesting')
524
+ */
525
+ documentMode?: string;
526
+ /**
527
+ * - Editor mode ('docx', 'text', 'html')
528
+ */
529
+ mode?: string;
530
+ /**
531
+ * - User role ('editor', 'viewer', 'suggester')
532
+ */
533
+ role?: string;
534
+ /**
535
+ * - Available colors
536
+ */
537
+ colors?: any[];
538
+ /**
539
+ * - Document converter
540
+ */
541
+ converter?: any;
542
+ /**
543
+ * - Source of the file
544
+ */
545
+ fileSource?: any;
546
+ /**
547
+ * - Initial editor state
548
+ */
549
+ initialState?: any;
550
+ /**
551
+ * - Unique document identifier
552
+ */
553
+ documentId?: string;
554
+ /**
555
+ * - Editor extensions
556
+ */
557
+ extensions?: any[];
558
+ /**
559
+ * - Whether the editor is editable
560
+ */
561
+ editable?: boolean;
562
+ /**
563
+ * - Editor properties
564
+ */
565
+ editorProps?: any;
566
+ /**
567
+ * - Parsing options
568
+ */
569
+ parseOptions?: any;
570
+ /**
571
+ * - Core extension options
572
+ */
573
+ coreExtensionOptions?: any;
574
+ /**
575
+ * - Whether to enable input rules
576
+ */
577
+ enableInputRules?: boolean;
578
+ /**
579
+ * - Whether comments are enabled
580
+ */
581
+ isCommentsEnabled?: boolean;
582
+ /**
583
+ * - Whether this is a new file
584
+ */
585
+ isNewFile?: boolean;
586
+ /**
587
+ * - Editor scale/zoom
588
+ */
589
+ scale?: number;
590
+ /**
591
+ * - Whether annotations are enabled
592
+ */
593
+ annotations?: boolean;
594
+ /**
595
+ * - Whether this is an internal editor
596
+ */
597
+ isInternal?: boolean;
598
+ /**
599
+ * - External extensions
600
+ */
601
+ externalExtensions?: any[];
602
+ /**
603
+ * - Numbering configuration
604
+ */
605
+ numbering?: any;
606
+ /**
607
+ * - Called before editor creation
608
+ */
609
+ onBeforeCreate?: Function;
610
+ /**
611
+ * - Called after editor creation
612
+ */
613
+ onCreate?: Function;
614
+ /**
615
+ * - Called when editor content updates
616
+ */
617
+ onUpdate?: Function;
618
+ /**
619
+ * - Called when selection updates
620
+ */
621
+ onSelectionUpdate?: Function;
622
+ /**
623
+ * - Called when a transaction is processed
624
+ */
625
+ onTransaction?: Function;
626
+ /**
627
+ * - Called when editor gets focus
628
+ */
629
+ onFocus?: Function;
630
+ /**
631
+ * - Called when editor loses focus
632
+ */
633
+ onBlur?: Function;
634
+ /**
635
+ * - Called when editor is destroyed
636
+ */
637
+ onDestroy?: Function;
638
+ /**
639
+ * - Called when there's a content error
640
+ */
641
+ onContentError?: Function;
642
+ /**
643
+ * - Called when tracked changes update
644
+ */
645
+ onTrackedChangesUpdate?: Function;
646
+ /**
647
+ * - Called when comments update
648
+ */
649
+ onCommentsUpdate?: Function;
650
+ /**
651
+ * - Called when comments are loaded
652
+ */
653
+ onCommentsLoaded?: Function;
654
+ /**
655
+ * - Called when a comment is clicked
656
+ */
657
+ onCommentClicked?: Function;
658
+ /**
659
+ * - Called when comment locations update
660
+ */
661
+ onCommentLocationsUpdate?: Function;
662
+ /**
663
+ * - Called when document is locked
664
+ */
665
+ onDocumentLocked?: Function;
666
+ /**
667
+ * - Called on first render
668
+ */
669
+ onFirstRender?: Function;
670
+ /**
671
+ * - Called when collaboration is ready
672
+ */
673
+ onCollaborationReady?: Function;
674
+ /**
675
+ * - Called when pagination updates
676
+ */
677
+ onPaginationUpdate?: Function;
678
+ /**
679
+ * - Called when an exception occurs
680
+ */
681
+ onException?: Function;
682
+ /**
683
+ * - Handler for image uploads
684
+ */
685
+ handleImageUpload?: Function;
686
+ /**
687
+ * - Telemetry configuration
688
+ */
689
+ telemetry?: any;
690
+ };
232
691
  import { EventEmitter } from './EventEmitter.js';
233
692
  //# sourceMappingURL=Editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../src/core/Editor.js"],"names":[],"mappings":"AA0BA;;GAEG;AACH;IAwgBE;;;OAGG;IACH,sEAQC;IAED,6CAGC;IAED,8DAGC;IAsiBD,sDAKC;IA7/BD,0BAmBC;IA5FD,sBAAiB;IAEjB,qBAAsB;IAEtB,YAAO;IAEP,UAAK;IAEL,mBAAkB;IAIlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2DE;IAmIF,+BAEC;IADC,aAAsB;IAgBxB;;OAEG;IACH,cAEC;IAED;;OAEG;IACH,iBAEC;IAED;;OAEG;IACH,kBAEC;IAED;;OAEG;IACH,oBAEC;IAED;;OAEG;IACH,sBAEC;IAED;;OAEG;IACH,uBAEC;IAED;;OAEG;IACH,mBAEC;IAED;;OAEG;IACH,mBAEC;IAED;;OAEG;IACH,aAEC;IAED;;OAEG;IACH,WAEC;IAED,yCA8BC;IAED;;;OAGG;IACH,oCAYC;IA0BD;;;OAGG;IACH,+BA0BC;IAED;;;;OAIG;IACH,uDAMC;IAED;;;;OAIG;IACH,sDAQC;IAED;;;OAGG;IACH,6CAUC;IAgCG,eAAuC;IAiK3C;;OAEG;IACH,wBAIC;IAED;;;;;;MAeC;IAED;;;;OAIG;IACH,uCAgDC;IAED,qCAkDC;IA2HD;;;;OAIG;IACH,oCAEC;IAED;;;;;;OAMG;IACH,qEAKC;IAED;;OAEG;IACH,eAEC;IAED;;OAEG;IACH,kBAMC;IAED;;OAEG;IACH,qBAEC;IAED;;;;;;OAMG;IACH,iCAHG;QAAuB,WAAW;KAClC,GAAU,IAAI,CAiBhB;IA6CD;;OAEG;IACH;;;qBA+DC;IAcD;;OAEG;IACH,gBAKC;IASD;;;;OAIG;IACH,kCAFa,CAAC,CAAC,GAAG,GAAG,SAAS,CA8B7B;IAED,yCA4BC;IAED,+BAGC;IAED,sDAUC;IAED;;;;;;;OAOG;IACH,+CAFa,IAAI,CAIhB;;CAEF;6BAjsC4B,mBAAmB"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../src/core/Editor.js"],"names":[],"mappings":"AA0BA;;;;GAIG;AAEH;;;;;GAKG;AACH;;;;;EAKE;AAEF;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH;;;;GAIG;AACH;IA6nBE;;;;;;;;;;;;OAYG;IACH,+BARW,IAAI,GAAC,IAAI,GAAC,MAAM,WAChB,OAAO,GACL,OAAO,OAAO,CAc1B;IA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