@nutrient-sdk/document-authoring 1.8.0-preview.202507251710.e00a67d5cf25708016457976a2c49e22de628fa9 → 1.8.0-preview.202507280854.1b78cdd9bb532e41b4114205101c4bd1fd98b1a4

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
@@ -78,7 +78,7 @@ the SDK via `npm`).
78
78
 
79
79
  ### Example
80
80
 
81
- You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.8.0-preview.202507251710.e00a67d5cf25708016457976a2c49e22de628fa9-example.zip), unzip it and run:
81
+ You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.8.0-preview.202507280854.1b78cdd9bb532e41b4114205101c4bd1fd98b1a4-example.zip), unzip it and run:
82
82
 
83
83
  ```bash
84
84
  npm install
@@ -92,7 +92,7 @@ By default, the Document Authoring SDK will fetch the required files (fonts, emo
92
92
 
93
93
  ### Self-hosting the assets
94
94
 
95
- To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.8.0-preview.202507251710.e00a67d5cf25708016457976a2c49e22de628fa9-assets.zip) and deploy them to a suitable location.
95
+ To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.staging.nutrient.io/releases/document-authoring-1.8.0-preview.202507280854.1b78cdd9bb532e41b4114205101c4bd1fd98b1a4-assets.zip) and deploy them to a suitable location.
96
96
  Provide an appropriate base path when initializing the Document Authoring SDK.
97
97
 
98
98
  #### Example:
package/lib/docauth.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const t={type:"default-index"},e=async t=>(await(async t=>{const e=new URL(t??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,a=new URL("docauth-impl-c606a105d9ce72b2.js",e).href;return import(
1
+ const t={type:"default-index"},e=async t=>(await(async t=>{const e=new URL(t??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-95e56181e788b671.js",e).href;return import(
2
2
  /*webpackIgnore: true*/
3
3
  /* @vite-ignore */
4
- a)})(t?.assets?.base)).createDocAuthSystem(t);var a={createDocAuthSystem:e,defaultFontIndex:t};export{e as createDocAuthSystem,a as default,t as defaultFontIndex};
4
+ n)})(t?.assets?.base)).createDocAuthSystem(t);var n={createDocAuthSystem:e,defaultFontIndex:t};export{e as createDocAuthSystem,n as default,t as defaultFontIndex};
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DocAuth={})}(this,(function(e){"use strict";const t={type:"default-index"},n=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-c606a105d9ce72b2.js",t).href;return import(
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DocAuth={})}(this,(function(e){"use strict";const t={type:"default-index"},n=async e=>(await(async e=>{const t=new URL(e??"https://document-authoring.cdn.staging.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-95e56181e788b671.js",t).href;return import(
2
2
  /*webpackIgnore: true*/
3
3
  /* @vite-ignore */
4
4
  n)})(e?.assets?.base)).createDocAuthSystem(e);var o={createDocAuthSystem:n,defaultFontIndex:t};e.createDocAuthSystem=n,e.default=o,e.defaultFontIndex=t,Object.defineProperty(e,"__esModule",{value:!0})}));
package/lib/index.d.cts CHANGED
@@ -191,6 +191,75 @@ export declare type DocAuthEditor = {
191
191
  * @internal
192
192
  */
193
193
  insertTextAtCursor(text: string): void;
194
+ /**
195
+ * Adds an event listener that will be called every time the specified event is emitted.
196
+ *
197
+ * @param event - The event name to listen for
198
+ * @param handler - The function to call when the event is emitted
199
+ * @returns The editor instance for method chaining
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * // Get the latest document content
204
+ * editor.on('content.change', async () => console.log(await editor.currentDocument().saveDocument()));
205
+ * ```
206
+ *
207
+ * @internal
208
+ */
209
+ on: <K extends keyof DocAuthEditorEvents>(event: K, handler: DocAuthEditorEvents[K] extends void ? () => void : (payload: DocAuthEditorEvents[K]) => void) => DocAuthEditor;
210
+ /**
211
+ * Removes an event listener. If no handler is provided, removes all listeners for the event.
212
+ *
213
+ * @param event - The event name to remove listeners from
214
+ * @param handler - The specific handler to remove (optional)
215
+ * @returns The editor instance for method chaining
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * // Remove specific handler
220
+ * editor.off('content.change', myHandler);
221
+ *
222
+ * // Remove all handlers for an event
223
+ * editor.off('content.change');
224
+ * ```
225
+ *
226
+ * @internal
227
+ */
228
+ off: <K extends keyof DocAuthEditorEvents>(event: K, handler?: DocAuthEditorEvents[K] extends void ? () => void : (payload: DocAuthEditorEvents[K]) => void) => DocAuthEditor;
229
+ /**
230
+ * Adds an event listener that will be called only once when the specified event is emitted.
231
+ * The listener is automatically removed after being called.
232
+ *
233
+ * @param event - The event name to listen for
234
+ * @param handler - The function to call when the event is emitted
235
+ * @returns The editor instance for method chaining
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * editor.once('document.load', () => {
240
+ * console.log('Document loaded for the first time');
241
+ * });
242
+ * ```
243
+ *
244
+ * @internal
245
+ */
246
+ once: <K extends keyof DocAuthEditorEvents>(event: K, handler: DocAuthEditorEvents[K] extends void ? () => void : (payload: DocAuthEditorEvents[K]) => void) => DocAuthEditor;
247
+ };
248
+
249
+ /**
250
+ * @internal
251
+ */
252
+ export declare type DocAuthEditorEvents = {
253
+ /**
254
+ * Fired when a document is initially loaded into the editor.
255
+ * This event is triggered once per document load, including when switching documents.
256
+ */
257
+ 'document.load': void;
258
+ /**
259
+ * Fired when the document content has changed due to user editing or programmatic modifications.
260
+ * Use this event to react to document changes, such as saving drafts or updating UI state.
261
+ */
262
+ 'content.change': void;
194
263
  };
195
264
 
196
265
  /**
package/lib/index.d.mts CHANGED
@@ -191,6 +191,75 @@ export declare type DocAuthEditor = {
191
191
  * @internal
192
192
  */
193
193
  insertTextAtCursor(text: string): void;
194
+ /**
195
+ * Adds an event listener that will be called every time the specified event is emitted.
196
+ *
197
+ * @param event - The event name to listen for
198
+ * @param handler - The function to call when the event is emitted
199
+ * @returns The editor instance for method chaining
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * // Get the latest document content
204
+ * editor.on('content.change', async () => console.log(await editor.currentDocument().saveDocument()));
205
+ * ```
206
+ *
207
+ * @internal
208
+ */
209
+ on: <K extends keyof DocAuthEditorEvents>(event: K, handler: DocAuthEditorEvents[K] extends void ? () => void : (payload: DocAuthEditorEvents[K]) => void) => DocAuthEditor;
210
+ /**
211
+ * Removes an event listener. If no handler is provided, removes all listeners for the event.
212
+ *
213
+ * @param event - The event name to remove listeners from
214
+ * @param handler - The specific handler to remove (optional)
215
+ * @returns The editor instance for method chaining
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * // Remove specific handler
220
+ * editor.off('content.change', myHandler);
221
+ *
222
+ * // Remove all handlers for an event
223
+ * editor.off('content.change');
224
+ * ```
225
+ *
226
+ * @internal
227
+ */
228
+ off: <K extends keyof DocAuthEditorEvents>(event: K, handler?: DocAuthEditorEvents[K] extends void ? () => void : (payload: DocAuthEditorEvents[K]) => void) => DocAuthEditor;
229
+ /**
230
+ * Adds an event listener that will be called only once when the specified event is emitted.
231
+ * The listener is automatically removed after being called.
232
+ *
233
+ * @param event - The event name to listen for
234
+ * @param handler - The function to call when the event is emitted
235
+ * @returns The editor instance for method chaining
236
+ *
237
+ * @example
238
+ * ```typescript
239
+ * editor.once('document.load', () => {
240
+ * console.log('Document loaded for the first time');
241
+ * });
242
+ * ```
243
+ *
244
+ * @internal
245
+ */
246
+ once: <K extends keyof DocAuthEditorEvents>(event: K, handler: DocAuthEditorEvents[K] extends void ? () => void : (payload: DocAuthEditorEvents[K]) => void) => DocAuthEditor;
247
+ };
248
+
249
+ /**
250
+ * @internal
251
+ */
252
+ export declare type DocAuthEditorEvents = {
253
+ /**
254
+ * Fired when a document is initially loaded into the editor.
255
+ * This event is triggered once per document load, including when switching documents.
256
+ */
257
+ 'document.load': void;
258
+ /**
259
+ * Fired when the document content has changed due to user editing or programmatic modifications.
260
+ * Use this event to react to document changes, such as saving drafts or updating UI state.
261
+ */
262
+ 'content.change': void;
194
263
  };
195
264
 
196
265
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nutrient-sdk/document-authoring",
3
- "version": "1.8.0-preview.202507251710.e00a67d5cf25708016457976a2c49e22de628fa9",
3
+ "version": "1.8.0-preview.202507280854.1b78cdd9bb532e41b4114205101c4bd1fd98b1a4",
4
4
  "description": "A web SDK for word processing and rich text capabilities.",
5
5
  "type": "commonjs",
6
6
  "main": "lib/docauth.umd.js",