@nutrient-sdk/document-authoring 1.8.0-preview.202508151329.7a5d7a0d885b97d8830cdf8f8bea103465486842 → 1.8.0
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 +2 -2
- package/lib/docauth.mjs +2 -2
- package/lib/docauth.umd.js +1 -1
- package/lib/index.d.cts +12 -220
- package/lib/index.d.mts +12 -220
- package/package.json +1 -1
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.
|
|
81
|
+
You can download an example project demoing both TypeScript and JavaScript integration from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.8.0-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.
|
|
95
|
+
To host the assets on your own infrastructure you can download them from [here](https://document-authoring.cdn.nutrient.io/releases/document-authoring-1.8.0-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.
|
|
1
|
+
const t={type:"default-index"},e=async t=>(await(async t=>{const e=new URL(t??"https://document-authoring.cdn.nutrient.io/2025/1/",window.location.href).href,a=new URL("docauth-impl-2e14989b0a9b1796.js",e).href;return import(
|
|
2
2
|
/*webpackIgnore: true*/
|
|
3
3
|
/* @vite-ignore */
|
|
4
|
-
|
|
4
|
+
a)})(t?.assets?.base)).createDocAuthSystem(t);var a={createDocAuthSystem:e,defaultFontIndex:t};export{e as createDocAuthSystem,a as default,t as defaultFontIndex};
|
package/lib/docauth.umd.js
CHANGED
|
@@ -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.
|
|
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.nutrient.io/2025/1/",window.location.href).href,n=new URL("docauth-impl-2e14989b0a9b1796.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
|
@@ -80,14 +80,8 @@ export declare type CreateEditorOptions = {
|
|
|
80
80
|
* See {@link UIOptions}
|
|
81
81
|
*/
|
|
82
82
|
ui?: UIOptions;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*/
|
|
86
|
-
__hideDOCXDownload?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
__hidePDFDownload?: boolean;
|
|
83
|
+
|
|
84
|
+
|
|
91
85
|
};
|
|
92
86
|
|
|
93
87
|
/**
|
|
@@ -142,10 +136,7 @@ export declare type DocAuthDocument = {
|
|
|
142
136
|
* Exports a snapshot of the current document as a DOCX file.
|
|
143
137
|
*/
|
|
144
138
|
exportDOCX(options?: ExportDOCXOptions): Promise<ArrayBuffer>;
|
|
145
|
-
|
|
146
|
-
* @alpha
|
|
147
|
-
*/
|
|
148
|
-
transaction<T = void>(callback: TransactionCallback<T>): Promise<T>;
|
|
139
|
+
|
|
149
140
|
/**
|
|
150
141
|
* The `DocAuthSystem` this document is bound to.
|
|
151
142
|
*/
|
|
@@ -182,15 +173,7 @@ export declare type DocAuthEditor = {
|
|
|
182
173
|
* Retrieves the `DocAuthSystem` instance this editor is bound to.
|
|
183
174
|
*/
|
|
184
175
|
docAuthSystem(): DocAuthSystem;
|
|
185
|
-
|
|
186
|
-
* Inserts text at the current cursor position.
|
|
187
|
-
* If there's a selection, it will be replaced with the provided text.
|
|
188
|
-
*
|
|
189
|
-
* @param text - The text to insert at the cursor position
|
|
190
|
-
*
|
|
191
|
-
* @internal
|
|
192
|
-
*/
|
|
193
|
-
insertTextAtCursor(text: string): void;
|
|
176
|
+
|
|
194
177
|
/**
|
|
195
178
|
* Adds an event listener that will be called every time the specified event is emitted.
|
|
196
179
|
*
|
|
@@ -204,7 +187,7 @@ export declare type DocAuthEditor = {
|
|
|
204
187
|
* editor.on('content.change', async () => console.log(await editor.currentDocument().saveDocument()));
|
|
205
188
|
* ```
|
|
206
189
|
*
|
|
207
|
-
* @
|
|
190
|
+
* @eventMap DocAuthEditorEvents
|
|
208
191
|
*/
|
|
209
192
|
on: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
210
193
|
/**
|
|
@@ -223,7 +206,7 @@ export declare type DocAuthEditor = {
|
|
|
223
206
|
* editor.off('content.change');
|
|
224
207
|
* ```
|
|
225
208
|
*
|
|
226
|
-
* @
|
|
209
|
+
* @eventMap DocAuthEditorEvents
|
|
227
210
|
*/
|
|
228
211
|
off: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler?: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
229
212
|
/**
|
|
@@ -241,18 +224,20 @@ export declare type DocAuthEditor = {
|
|
|
241
224
|
* });
|
|
242
225
|
* ```
|
|
243
226
|
*
|
|
244
|
-
* @
|
|
227
|
+
* @eventMap DocAuthEditorEvents
|
|
245
228
|
*/
|
|
246
229
|
once: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
247
230
|
};
|
|
248
231
|
|
|
249
232
|
/**
|
|
250
|
-
* @
|
|
233
|
+
* @public
|
|
234
|
+
* @excludeFromDocs
|
|
251
235
|
*/
|
|
252
236
|
export declare type DocAuthEditorEventHandler<EventName extends keyof DocAuthEditorEvents> = DocAuthEditorEvents[EventName] extends void ? () => void : (payload: DocAuthEditorEvents[EventName]) => void;
|
|
253
237
|
|
|
254
238
|
/**
|
|
255
|
-
* @
|
|
239
|
+
* @public
|
|
240
|
+
* @excludeFromDocs
|
|
256
241
|
*/
|
|
257
242
|
export declare type DocAuthEditorEvents = {
|
|
258
243
|
/**
|
|
@@ -435,190 +420,6 @@ export declare type ImportDOCXOptions = {
|
|
|
435
420
|
*/
|
|
436
421
|
export declare type Locale = 'en' | 'fr' | 'de';
|
|
437
422
|
|
|
438
|
-
/**
|
|
439
|
-
* @alpha
|
|
440
|
-
*/
|
|
441
|
-
export declare namespace Programmatic {
|
|
442
|
-
export type Range = {
|
|
443
|
-
begin: number;
|
|
444
|
-
end?: number;
|
|
445
|
-
};
|
|
446
|
-
export type Formatting = {
|
|
447
|
-
font: string | null;
|
|
448
|
-
fontSize: number | null;
|
|
449
|
-
bold: boolean | null;
|
|
450
|
-
italic: boolean | null;
|
|
451
|
-
color: string | null;
|
|
452
|
-
highlight: string | null;
|
|
453
|
-
strikeout: boolean | null;
|
|
454
|
-
underline: boolean | null;
|
|
455
|
-
};
|
|
456
|
-
export type SearchFor = string | RegExp;
|
|
457
|
-
export type Replacement = {
|
|
458
|
-
text?: string;
|
|
459
|
-
formatting?: Partial<Formatting>;
|
|
460
|
-
};
|
|
461
|
-
export type ReplaceFn = (value: string) => Replacement | string;
|
|
462
|
-
export type ReplacementOrReplaceFn = Replacement | ReplaceFn | string;
|
|
463
|
-
export type ReplaceTextSignature = (searchFor: SearchFor, replace: ReplacementOrReplaceFn) => number;
|
|
464
|
-
export type SearchResult = {
|
|
465
|
-
range: Range;
|
|
466
|
-
text: string;
|
|
467
|
-
};
|
|
468
|
-
export type TextView = {
|
|
469
|
-
getPlainText(range?: Range): string;
|
|
470
|
-
searchText(searchFor: SearchFor, after?: Range): SearchResult | undefined;
|
|
471
|
-
replaceText: ReplaceTextSignature;
|
|
472
|
-
setText(value: string, range?: Range): Range;
|
|
473
|
-
setFormatting(formatting: Partial<Formatting>, range?: Range): void;
|
|
474
|
-
inlines(): RangeInline[];
|
|
475
|
-
addLineBreak(insertionPoint?: {
|
|
476
|
-
placement: 'before' | 'after';
|
|
477
|
-
range: Range;
|
|
478
|
-
}): LineBreak;
|
|
479
|
-
addInlineText(text: string, insertionPoint?: {
|
|
480
|
-
placement: 'before' | 'after';
|
|
481
|
-
range: Range;
|
|
482
|
-
}): InlineText;
|
|
483
|
-
removeInline(index?: number): Inline | undefined;
|
|
484
|
-
};
|
|
485
|
-
export type Extent = {
|
|
486
|
-
width: number;
|
|
487
|
-
height: number;
|
|
488
|
-
};
|
|
489
|
-
export type Image = {
|
|
490
|
-
type: 'image';
|
|
491
|
-
extent(): Extent;
|
|
492
|
-
setExtent(extent: Partial<Extent>): void;
|
|
493
|
-
};
|
|
494
|
-
export type Field = {
|
|
495
|
-
type: 'field';
|
|
496
|
-
};
|
|
497
|
-
export type Footnote = {
|
|
498
|
-
type: 'footnote';
|
|
499
|
-
};
|
|
500
|
-
export type FootnoteRef = {
|
|
501
|
-
type: 'footnote/ref';
|
|
502
|
-
};
|
|
503
|
-
export type Endnote = {
|
|
504
|
-
type: 'endnote';
|
|
505
|
-
};
|
|
506
|
-
export type EndnoteRef = {
|
|
507
|
-
type: 'endnote/ref';
|
|
508
|
-
};
|
|
509
|
-
export type LineBreak = {
|
|
510
|
-
type: 'line-break';
|
|
511
|
-
};
|
|
512
|
-
export type PageBreak = {
|
|
513
|
-
type: 'page-break';
|
|
514
|
-
};
|
|
515
|
-
export type Tab = {
|
|
516
|
-
type: 'tab';
|
|
517
|
-
};
|
|
518
|
-
export type Separator = {
|
|
519
|
-
type: 'sep';
|
|
520
|
-
};
|
|
521
|
-
export type InlineText = {
|
|
522
|
-
type: 'text';
|
|
523
|
-
plainText(): string;
|
|
524
|
-
formatting(): Formatting;
|
|
525
|
-
};
|
|
526
|
-
export type Inline = InlineText | Tab | Separator | LineBreak | PageBreak | Image | Field | Footnote | FootnoteRef | Endnote | EndnoteRef;
|
|
527
|
-
export type RangeInline = {
|
|
528
|
-
range: Range;
|
|
529
|
-
inline: Inline;
|
|
530
|
-
};
|
|
531
|
-
export type Paragraph = {
|
|
532
|
-
type: 'paragraph';
|
|
533
|
-
asTextView(): TextView;
|
|
534
|
-
replaceText: ReplaceTextSignature;
|
|
535
|
-
};
|
|
536
|
-
export type TableCell = BlockLevelContainer;
|
|
537
|
-
export type TableRow = {
|
|
538
|
-
cells(): TableCell[];
|
|
539
|
-
addCell(index?: number): TableCell;
|
|
540
|
-
removeCell(index: number): TableCell | undefined;
|
|
541
|
-
replaceText: ReplaceTextSignature;
|
|
542
|
-
};
|
|
543
|
-
export type Table = {
|
|
544
|
-
type: 'table';
|
|
545
|
-
rows(): TableRow[];
|
|
546
|
-
addRow(index?: number): TableRow;
|
|
547
|
-
removeRow(index: number): TableRow | undefined;
|
|
548
|
-
replaceText: ReplaceTextSignature;
|
|
549
|
-
};
|
|
550
|
-
export type BlockLevel = Paragraph | Table;
|
|
551
|
-
export type BlockLevelContainer = {
|
|
552
|
-
blocklevels(): BlockLevel[];
|
|
553
|
-
addParagraph(index?: number): Paragraph;
|
|
554
|
-
addTable(index?: number): Table;
|
|
555
|
-
removeElement(index: number): BlockLevel | undefined;
|
|
556
|
-
replaceText: ReplaceTextSignature;
|
|
557
|
-
};
|
|
558
|
-
export type PageSize = {
|
|
559
|
-
width: number;
|
|
560
|
-
height: number;
|
|
561
|
-
};
|
|
562
|
-
export type PageMargins = {
|
|
563
|
-
left: number;
|
|
564
|
-
right: number;
|
|
565
|
-
top: number;
|
|
566
|
-
bottom: number;
|
|
567
|
-
};
|
|
568
|
-
export type PageSetup = {
|
|
569
|
-
setPageSize(size: Partial<PageSize>): void;
|
|
570
|
-
setPageMargins(margins: Partial<PageMargins>): void;
|
|
571
|
-
pageSize(): PageSize;
|
|
572
|
-
pageMargins(): PageMargins;
|
|
573
|
-
};
|
|
574
|
-
export type HeaderFooter = BlockLevelContainer;
|
|
575
|
-
export type HeadersFooters = {
|
|
576
|
-
default(): HeaderFooter | null;
|
|
577
|
-
first(): HeaderFooter | null;
|
|
578
|
-
even(): HeaderFooter | null;
|
|
579
|
-
replaceText: ReplaceTextSignature;
|
|
580
|
-
};
|
|
581
|
-
export type HeadersAndFooters = {
|
|
582
|
-
headers(): HeadersFooters;
|
|
583
|
-
footers(): HeadersFooters;
|
|
584
|
-
replaceText: ReplaceTextSignature;
|
|
585
|
-
};
|
|
586
|
-
export type Section = {
|
|
587
|
-
pageSetup(): PageSetup;
|
|
588
|
-
headersAndFooters(): HeadersAndFooters;
|
|
589
|
-
content(): BlockLevelContainer;
|
|
590
|
-
};
|
|
591
|
-
export type Body = {
|
|
592
|
-
sections(): Section[];
|
|
593
|
-
addSection(index?: number): Section;
|
|
594
|
-
removeSection(index: number): Section | undefined;
|
|
595
|
-
replaceText: ReplaceTextSignature;
|
|
596
|
-
};
|
|
597
|
-
export type Document = {
|
|
598
|
-
body(): Body;
|
|
599
|
-
replaceText: ReplaceTextSignature;
|
|
600
|
-
};
|
|
601
|
-
{};
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* @alpha
|
|
606
|
-
*/
|
|
607
|
-
export declare type TransactionCallback<T = void> = (context: {
|
|
608
|
-
draft: Programmatic.Document;
|
|
609
|
-
}) => Promise<TransactionResult<T>>;
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* @alpha
|
|
613
|
-
*/
|
|
614
|
-
export declare type TransactionResult<T = void> = undefined | boolean | {
|
|
615
|
-
commit: boolean;
|
|
616
|
-
result: T;
|
|
617
|
-
} | Promise<undefined | boolean | {
|
|
618
|
-
commit: boolean;
|
|
619
|
-
result: T;
|
|
620
|
-
}>;
|
|
621
|
-
|
|
622
423
|
/**
|
|
623
424
|
* Configuration options for the user interface.
|
|
624
425
|
*
|
|
@@ -650,16 +451,7 @@ export declare type UIOptions = {
|
|
|
650
451
|
*/
|
|
651
452
|
enabled: boolean;
|
|
652
453
|
};
|
|
653
|
-
|
|
654
|
-
* @internal
|
|
655
|
-
*
|
|
656
|
-
* Initial zoom level for the editor.
|
|
657
|
-
*
|
|
658
|
-
* Valid range is 0.5 to 4.0.
|
|
659
|
-
*
|
|
660
|
-
* @defaultValue `1`
|
|
661
|
-
*/
|
|
662
|
-
initialZoom?: number;
|
|
454
|
+
|
|
663
455
|
};
|
|
664
456
|
|
|
665
457
|
/**
|
package/lib/index.d.mts
CHANGED
|
@@ -80,14 +80,8 @@ export declare type CreateEditorOptions = {
|
|
|
80
80
|
* See {@link UIOptions}
|
|
81
81
|
*/
|
|
82
82
|
ui?: UIOptions;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*/
|
|
86
|
-
__hideDOCXDownload?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* @internal
|
|
89
|
-
*/
|
|
90
|
-
__hidePDFDownload?: boolean;
|
|
83
|
+
|
|
84
|
+
|
|
91
85
|
};
|
|
92
86
|
|
|
93
87
|
/**
|
|
@@ -142,10 +136,7 @@ export declare type DocAuthDocument = {
|
|
|
142
136
|
* Exports a snapshot of the current document as a DOCX file.
|
|
143
137
|
*/
|
|
144
138
|
exportDOCX(options?: ExportDOCXOptions): Promise<ArrayBuffer>;
|
|
145
|
-
|
|
146
|
-
* @alpha
|
|
147
|
-
*/
|
|
148
|
-
transaction<T = void>(callback: TransactionCallback<T>): Promise<T>;
|
|
139
|
+
|
|
149
140
|
/**
|
|
150
141
|
* The `DocAuthSystem` this document is bound to.
|
|
151
142
|
*/
|
|
@@ -182,15 +173,7 @@ export declare type DocAuthEditor = {
|
|
|
182
173
|
* Retrieves the `DocAuthSystem` instance this editor is bound to.
|
|
183
174
|
*/
|
|
184
175
|
docAuthSystem(): DocAuthSystem;
|
|
185
|
-
|
|
186
|
-
* Inserts text at the current cursor position.
|
|
187
|
-
* If there's a selection, it will be replaced with the provided text.
|
|
188
|
-
*
|
|
189
|
-
* @param text - The text to insert at the cursor position
|
|
190
|
-
*
|
|
191
|
-
* @internal
|
|
192
|
-
*/
|
|
193
|
-
insertTextAtCursor(text: string): void;
|
|
176
|
+
|
|
194
177
|
/**
|
|
195
178
|
* Adds an event listener that will be called every time the specified event is emitted.
|
|
196
179
|
*
|
|
@@ -204,7 +187,7 @@ export declare type DocAuthEditor = {
|
|
|
204
187
|
* editor.on('content.change', async () => console.log(await editor.currentDocument().saveDocument()));
|
|
205
188
|
* ```
|
|
206
189
|
*
|
|
207
|
-
* @
|
|
190
|
+
* @eventMap DocAuthEditorEvents
|
|
208
191
|
*/
|
|
209
192
|
on: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
210
193
|
/**
|
|
@@ -223,7 +206,7 @@ export declare type DocAuthEditor = {
|
|
|
223
206
|
* editor.off('content.change');
|
|
224
207
|
* ```
|
|
225
208
|
*
|
|
226
|
-
* @
|
|
209
|
+
* @eventMap DocAuthEditorEvents
|
|
227
210
|
*/
|
|
228
211
|
off: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler?: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
229
212
|
/**
|
|
@@ -241,18 +224,20 @@ export declare type DocAuthEditor = {
|
|
|
241
224
|
* });
|
|
242
225
|
* ```
|
|
243
226
|
*
|
|
244
|
-
* @
|
|
227
|
+
* @eventMap DocAuthEditorEvents
|
|
245
228
|
*/
|
|
246
229
|
once: <EventName extends keyof DocAuthEditorEvents>(event: EventName, handler: DocAuthEditorEventHandler<EventName>) => DocAuthEditor;
|
|
247
230
|
};
|
|
248
231
|
|
|
249
232
|
/**
|
|
250
|
-
* @
|
|
233
|
+
* @public
|
|
234
|
+
* @excludeFromDocs
|
|
251
235
|
*/
|
|
252
236
|
export declare type DocAuthEditorEventHandler<EventName extends keyof DocAuthEditorEvents> = DocAuthEditorEvents[EventName] extends void ? () => void : (payload: DocAuthEditorEvents[EventName]) => void;
|
|
253
237
|
|
|
254
238
|
/**
|
|
255
|
-
* @
|
|
239
|
+
* @public
|
|
240
|
+
* @excludeFromDocs
|
|
256
241
|
*/
|
|
257
242
|
export declare type DocAuthEditorEvents = {
|
|
258
243
|
/**
|
|
@@ -435,190 +420,6 @@ export declare type ImportDOCXOptions = {
|
|
|
435
420
|
*/
|
|
436
421
|
export declare type Locale = 'en' | 'fr' | 'de';
|
|
437
422
|
|
|
438
|
-
/**
|
|
439
|
-
* @alpha
|
|
440
|
-
*/
|
|
441
|
-
export declare namespace Programmatic {
|
|
442
|
-
export type Range = {
|
|
443
|
-
begin: number;
|
|
444
|
-
end?: number;
|
|
445
|
-
};
|
|
446
|
-
export type Formatting = {
|
|
447
|
-
font: string | null;
|
|
448
|
-
fontSize: number | null;
|
|
449
|
-
bold: boolean | null;
|
|
450
|
-
italic: boolean | null;
|
|
451
|
-
color: string | null;
|
|
452
|
-
highlight: string | null;
|
|
453
|
-
strikeout: boolean | null;
|
|
454
|
-
underline: boolean | null;
|
|
455
|
-
};
|
|
456
|
-
export type SearchFor = string | RegExp;
|
|
457
|
-
export type Replacement = {
|
|
458
|
-
text?: string;
|
|
459
|
-
formatting?: Partial<Formatting>;
|
|
460
|
-
};
|
|
461
|
-
export type ReplaceFn = (value: string) => Replacement | string;
|
|
462
|
-
export type ReplacementOrReplaceFn = Replacement | ReplaceFn | string;
|
|
463
|
-
export type ReplaceTextSignature = (searchFor: SearchFor, replace: ReplacementOrReplaceFn) => number;
|
|
464
|
-
export type SearchResult = {
|
|
465
|
-
range: Range;
|
|
466
|
-
text: string;
|
|
467
|
-
};
|
|
468
|
-
export type TextView = {
|
|
469
|
-
getPlainText(range?: Range): string;
|
|
470
|
-
searchText(searchFor: SearchFor, after?: Range): SearchResult | undefined;
|
|
471
|
-
replaceText: ReplaceTextSignature;
|
|
472
|
-
setText(value: string, range?: Range): Range;
|
|
473
|
-
setFormatting(formatting: Partial<Formatting>, range?: Range): void;
|
|
474
|
-
inlines(): RangeInline[];
|
|
475
|
-
addLineBreak(insertionPoint?: {
|
|
476
|
-
placement: 'before' | 'after';
|
|
477
|
-
range: Range;
|
|
478
|
-
}): LineBreak;
|
|
479
|
-
addInlineText(text: string, insertionPoint?: {
|
|
480
|
-
placement: 'before' | 'after';
|
|
481
|
-
range: Range;
|
|
482
|
-
}): InlineText;
|
|
483
|
-
removeInline(index?: number): Inline | undefined;
|
|
484
|
-
};
|
|
485
|
-
export type Extent = {
|
|
486
|
-
width: number;
|
|
487
|
-
height: number;
|
|
488
|
-
};
|
|
489
|
-
export type Image = {
|
|
490
|
-
type: 'image';
|
|
491
|
-
extent(): Extent;
|
|
492
|
-
setExtent(extent: Partial<Extent>): void;
|
|
493
|
-
};
|
|
494
|
-
export type Field = {
|
|
495
|
-
type: 'field';
|
|
496
|
-
};
|
|
497
|
-
export type Footnote = {
|
|
498
|
-
type: 'footnote';
|
|
499
|
-
};
|
|
500
|
-
export type FootnoteRef = {
|
|
501
|
-
type: 'footnote/ref';
|
|
502
|
-
};
|
|
503
|
-
export type Endnote = {
|
|
504
|
-
type: 'endnote';
|
|
505
|
-
};
|
|
506
|
-
export type EndnoteRef = {
|
|
507
|
-
type: 'endnote/ref';
|
|
508
|
-
};
|
|
509
|
-
export type LineBreak = {
|
|
510
|
-
type: 'line-break';
|
|
511
|
-
};
|
|
512
|
-
export type PageBreak = {
|
|
513
|
-
type: 'page-break';
|
|
514
|
-
};
|
|
515
|
-
export type Tab = {
|
|
516
|
-
type: 'tab';
|
|
517
|
-
};
|
|
518
|
-
export type Separator = {
|
|
519
|
-
type: 'sep';
|
|
520
|
-
};
|
|
521
|
-
export type InlineText = {
|
|
522
|
-
type: 'text';
|
|
523
|
-
plainText(): string;
|
|
524
|
-
formatting(): Formatting;
|
|
525
|
-
};
|
|
526
|
-
export type Inline = InlineText | Tab | Separator | LineBreak | PageBreak | Image | Field | Footnote | FootnoteRef | Endnote | EndnoteRef;
|
|
527
|
-
export type RangeInline = {
|
|
528
|
-
range: Range;
|
|
529
|
-
inline: Inline;
|
|
530
|
-
};
|
|
531
|
-
export type Paragraph = {
|
|
532
|
-
type: 'paragraph';
|
|
533
|
-
asTextView(): TextView;
|
|
534
|
-
replaceText: ReplaceTextSignature;
|
|
535
|
-
};
|
|
536
|
-
export type TableCell = BlockLevelContainer;
|
|
537
|
-
export type TableRow = {
|
|
538
|
-
cells(): TableCell[];
|
|
539
|
-
addCell(index?: number): TableCell;
|
|
540
|
-
removeCell(index: number): TableCell | undefined;
|
|
541
|
-
replaceText: ReplaceTextSignature;
|
|
542
|
-
};
|
|
543
|
-
export type Table = {
|
|
544
|
-
type: 'table';
|
|
545
|
-
rows(): TableRow[];
|
|
546
|
-
addRow(index?: number): TableRow;
|
|
547
|
-
removeRow(index: number): TableRow | undefined;
|
|
548
|
-
replaceText: ReplaceTextSignature;
|
|
549
|
-
};
|
|
550
|
-
export type BlockLevel = Paragraph | Table;
|
|
551
|
-
export type BlockLevelContainer = {
|
|
552
|
-
blocklevels(): BlockLevel[];
|
|
553
|
-
addParagraph(index?: number): Paragraph;
|
|
554
|
-
addTable(index?: number): Table;
|
|
555
|
-
removeElement(index: number): BlockLevel | undefined;
|
|
556
|
-
replaceText: ReplaceTextSignature;
|
|
557
|
-
};
|
|
558
|
-
export type PageSize = {
|
|
559
|
-
width: number;
|
|
560
|
-
height: number;
|
|
561
|
-
};
|
|
562
|
-
export type PageMargins = {
|
|
563
|
-
left: number;
|
|
564
|
-
right: number;
|
|
565
|
-
top: number;
|
|
566
|
-
bottom: number;
|
|
567
|
-
};
|
|
568
|
-
export type PageSetup = {
|
|
569
|
-
setPageSize(size: Partial<PageSize>): void;
|
|
570
|
-
setPageMargins(margins: Partial<PageMargins>): void;
|
|
571
|
-
pageSize(): PageSize;
|
|
572
|
-
pageMargins(): PageMargins;
|
|
573
|
-
};
|
|
574
|
-
export type HeaderFooter = BlockLevelContainer;
|
|
575
|
-
export type HeadersFooters = {
|
|
576
|
-
default(): HeaderFooter | null;
|
|
577
|
-
first(): HeaderFooter | null;
|
|
578
|
-
even(): HeaderFooter | null;
|
|
579
|
-
replaceText: ReplaceTextSignature;
|
|
580
|
-
};
|
|
581
|
-
export type HeadersAndFooters = {
|
|
582
|
-
headers(): HeadersFooters;
|
|
583
|
-
footers(): HeadersFooters;
|
|
584
|
-
replaceText: ReplaceTextSignature;
|
|
585
|
-
};
|
|
586
|
-
export type Section = {
|
|
587
|
-
pageSetup(): PageSetup;
|
|
588
|
-
headersAndFooters(): HeadersAndFooters;
|
|
589
|
-
content(): BlockLevelContainer;
|
|
590
|
-
};
|
|
591
|
-
export type Body = {
|
|
592
|
-
sections(): Section[];
|
|
593
|
-
addSection(index?: number): Section;
|
|
594
|
-
removeSection(index: number): Section | undefined;
|
|
595
|
-
replaceText: ReplaceTextSignature;
|
|
596
|
-
};
|
|
597
|
-
export type Document = {
|
|
598
|
-
body(): Body;
|
|
599
|
-
replaceText: ReplaceTextSignature;
|
|
600
|
-
};
|
|
601
|
-
{};
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* @alpha
|
|
606
|
-
*/
|
|
607
|
-
export declare type TransactionCallback<T = void> = (context: {
|
|
608
|
-
draft: Programmatic.Document;
|
|
609
|
-
}) => Promise<TransactionResult<T>>;
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* @alpha
|
|
613
|
-
*/
|
|
614
|
-
export declare type TransactionResult<T = void> = undefined | boolean | {
|
|
615
|
-
commit: boolean;
|
|
616
|
-
result: T;
|
|
617
|
-
} | Promise<undefined | boolean | {
|
|
618
|
-
commit: boolean;
|
|
619
|
-
result: T;
|
|
620
|
-
}>;
|
|
621
|
-
|
|
622
423
|
/**
|
|
623
424
|
* Configuration options for the user interface.
|
|
624
425
|
*
|
|
@@ -650,16 +451,7 @@ export declare type UIOptions = {
|
|
|
650
451
|
*/
|
|
651
452
|
enabled: boolean;
|
|
652
453
|
};
|
|
653
|
-
|
|
654
|
-
* @internal
|
|
655
|
-
*
|
|
656
|
-
* Initial zoom level for the editor.
|
|
657
|
-
*
|
|
658
|
-
* Valid range is 0.5 to 4.0.
|
|
659
|
-
*
|
|
660
|
-
* @defaultValue `1`
|
|
661
|
-
*/
|
|
662
|
-
initialZoom?: number;
|
|
454
|
+
|
|
663
455
|
};
|
|
664
456
|
|
|
665
457
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nutrient-sdk/document-authoring",
|
|
3
|
-
"version": "1.8.0
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "A web SDK for word processing and rich text capabilities.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "lib/docauth.umd.js",
|