@docx-editor.dev/editor-api 2.31.0 → 2.33.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/OFFICE_JS_GUIDE.md +187 -12
- package/README.md +31 -3
- package/dist/agent.d.mts +243 -0
- package/dist/agent.d.ts +243 -0
- package/dist/agent.js +5 -0
- package/dist/agent.mjs +5 -0
- package/dist/browser.d.mts +7 -3
- package/dist/browser.d.ts +7 -3
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{server-Dw4k9h0p.d.mts → server-CDfqcHfQ.d.mts} +786 -473
- package/dist/{server-Dw4k9h0p.d.ts → server-CDfqcHfQ.d.ts} +786 -473
- package/docs/accept-reject-without-scrolling.md +95 -0
- package/docs/comment-on-found-text.md +72 -0
- package/docs/custom-review-cards.md +178 -0
- package/docs/highlight-ranges.md +48 -0
- package/docs/index.md +36 -0
- package/docs/propose-rewrite.md +247 -0
- package/docs/tracked-replacement.md +68 -0
- package/package.json +11 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, DiagnosticCode, HistoryGroup, AutomationHost, AutomationCapabilities, AutomationPaginationOptions, ByteSizeBucket, DocumentOpenDiagnosticCode, DocumentPartKind, DiagnosticErrorName, EditDiagnosticCode } from '@docx-editor.dev/core/automation';
|
|
1
|
+
import { AutomationHandle, AutomationSpan, AutomationOperation, AutomationValue, AutomationSpanRef, RevisionBatchResult, RevisionAuthorResult, DiagnosticCode, HistoryGroup, AutomationHost, AutomationCapabilities, AutomationPaginationOptions, ByteSizeBucket, DocumentOpenDiagnosticCode, DocumentPartKind, DiagnosticErrorName, EditDiagnosticCode, ReviewDiagnosticCode, ReviewOperation } from '@docx-editor.dev/core/automation';
|
|
2
2
|
import { CollaborationModuleContribution } from '@docx-editor.dev/core/collaboration';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -17,6 +17,15 @@ type ObjectAddress = {
|
|
|
17
17
|
} | {
|
|
18
18
|
readonly kind: 'span';
|
|
19
19
|
readonly span: AutomationSpan;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A field's cached result (`Field.result`). The field is one model character, so its result
|
|
23
|
+
* has no addressable position of its own: only the field's handle names it, and only the
|
|
24
|
+
* members a result supports read or write through it. Every other use refuses.
|
|
25
|
+
*/
|
|
26
|
+
| {
|
|
27
|
+
readonly kind: 'fieldResult';
|
|
28
|
+
readonly field: AutomationHandle;
|
|
20
29
|
};
|
|
21
30
|
type ObjectPathState =
|
|
22
31
|
/** Promised: created by a queued read that has not answered yet. */
|
|
@@ -39,7 +48,14 @@ type ObjectPathState =
|
|
|
39
48
|
declare class ObjectPath {
|
|
40
49
|
#private;
|
|
41
50
|
readonly label: string;
|
|
51
|
+
/** Whether this path names the cached result of the field its parent names. */
|
|
52
|
+
readonly isFieldResult: boolean;
|
|
42
53
|
private constructor();
|
|
54
|
+
/**
|
|
55
|
+
* The cached result of the field `field` names. It shares the field's fate, and resolves when
|
|
56
|
+
* the field does.
|
|
57
|
+
*/
|
|
58
|
+
static fieldResult(label: string, field: ObjectPath): ObjectPath;
|
|
43
59
|
/** A path that is addressable from the moment it exists — a root, or an item just hydrated. */
|
|
44
60
|
static of(label: string, handle: AutomationHandle): ObjectPath;
|
|
45
61
|
/** The same, for an object that IS a stretch of a story. */
|
|
@@ -102,6 +118,11 @@ interface QueuedAction {
|
|
|
102
118
|
readonly nullableLoad?: ObjectPath;
|
|
103
119
|
/** The consumer-facing name of what this action is for, for errors. Never a handle. */
|
|
104
120
|
readonly label: string;
|
|
121
|
+
/**
|
|
122
|
+
* A runtime setting, not a document edit: an agent helper's own first sync may carry it. Set
|
|
123
|
+
* only for tracking-mode assignments the runtime accepts (`Off`, `TrackMineOnly`).
|
|
124
|
+
*/
|
|
125
|
+
readonly runtimeSetting?: true;
|
|
105
126
|
/**
|
|
106
127
|
* The answer queues reads for the same sync: a listing whose items load properties named
|
|
107
128
|
* with `items/`. A sync that writes sends such a listing, and those reads, before its writes.
|
|
@@ -278,6 +299,30 @@ declare enum InsertLocation {
|
|
|
278
299
|
before = "Before",
|
|
279
300
|
after = "After"
|
|
280
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Which part of an object a `getRange` call answers. Each call validates its allowed subset;
|
|
304
|
+
* `Range.getRange` supports `Whole`, `Content`, `Start`, and `End`.
|
|
305
|
+
*
|
|
306
|
+
* @public
|
|
307
|
+
*/
|
|
308
|
+
declare enum RangeLocation {
|
|
309
|
+
whole = "Whole",
|
|
310
|
+
start = "Start",
|
|
311
|
+
end = "End",
|
|
312
|
+
before = "Before",
|
|
313
|
+
after = "After",
|
|
314
|
+
content = "Content"
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Which version of tracked text `getReviewedText` reads: as if every pending revision were
|
|
318
|
+
* rejected (`Original`) or accepted (`Current`).
|
|
319
|
+
*
|
|
320
|
+
* @public
|
|
321
|
+
*/
|
|
322
|
+
declare enum ChangeTrackingVersion {
|
|
323
|
+
original = "Original",
|
|
324
|
+
current = "Current"
|
|
325
|
+
}
|
|
281
326
|
/** Paragraph alignment vocabulary. Mixed and unknown are read states, not authoring modes. @public */
|
|
282
327
|
declare enum Alignment {
|
|
283
328
|
mixed = "Mixed",
|
|
@@ -360,223 +405,16 @@ declare enum RemoveDocInfoType {
|
|
|
360
405
|
versions = "Versions"
|
|
361
406
|
}
|
|
362
407
|
|
|
363
|
-
/** Supported Word bullet styles. @public */
|
|
364
|
-
declare enum ListBullet {
|
|
365
|
-
custom = "Custom",
|
|
366
|
-
solid = "Solid",
|
|
367
|
-
hollow = "Hollow",
|
|
368
|
-
square = "Square",
|
|
369
|
-
diamonds = "Diamonds",
|
|
370
|
-
arrow = "Arrow",
|
|
371
|
-
checkmark = "Checkmark"
|
|
372
|
-
}
|
|
373
|
-
/** Supported Word numbering styles. @public */
|
|
374
|
-
declare enum ListNumbering {
|
|
375
|
-
none = "None",
|
|
376
|
-
arabic = "Arabic",
|
|
377
|
-
upperRoman = "UpperRoman",
|
|
378
|
-
lowerRoman = "LowerRoman",
|
|
379
|
-
upperLetter = "UpperLetter",
|
|
380
|
-
lowerLetter = "LowerLetter"
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* A list: the set of paragraphs sharing one numbering id.
|
|
384
|
-
*
|
|
385
|
-
* A list is not an ELEMENT. OOXML has no list — it has paragraphs that each name a `w:numId`, and
|
|
386
|
-
* a list is the set that name the same one. So {@link List.id} is that number,
|
|
387
|
-
* {@link List.paragraphs} is the set, and a list exists exactly as long as some paragraph is
|
|
388
|
-
* still in it.
|
|
389
|
-
*
|
|
390
|
-
* @public
|
|
391
|
-
*/
|
|
392
|
-
declare class List extends ModelObject implements PromisedItem {
|
|
393
|
-
#private;
|
|
394
|
-
/** @internal A list a read has already named. */
|
|
395
|
-
static at(context: RequestContext, label: string, address: ObjectAddress): List;
|
|
396
|
-
/** @internal A list a queued read will name, or report as nothing. */
|
|
397
|
-
static promised(context: RequestContext, label: string, nullable: boolean): List;
|
|
398
|
-
private constructor();
|
|
399
|
-
/** @internal Bind this object to the address the owning read answered. */
|
|
400
|
-
hydrateAddress(address: ObjectAddress): void;
|
|
401
|
-
/** @internal Settle as the null object: the read found nothing to name. */
|
|
402
|
-
hydrateNull(): void;
|
|
403
|
-
/** The `w:numId` the list's paragraphs share — the document's own identity for the list. */
|
|
404
|
-
get id(): number;
|
|
405
|
-
/** Every paragraph in the list, in reading order. */
|
|
406
|
-
get paragraphs(): ParagraphCollection;
|
|
407
|
-
/** The list's paragraphs at one level, in reading order. */
|
|
408
|
-
getLevelParagraphs(level: number): ParagraphCollection;
|
|
409
|
-
/**
|
|
410
|
-
* Add a numbered paragraph to the list, at its start or its end.
|
|
411
|
-
*
|
|
412
|
-
* All four of Word's locations are accepted and `Before`/`After` land INSIDE the list, at the
|
|
413
|
-
* first and last position — the same places `Start` and `End` name. A list is a set of paragraphs
|
|
414
|
-
* rather than a region, so "before the list" is a position in the story rather than in the list,
|
|
415
|
-
* and `Paragraph#insertParagraph` is what addresses that. The divergence is recorded in
|
|
416
|
-
* `compat/manifest.json`.
|
|
417
|
-
*/
|
|
418
|
-
insertParagraph(paragraphText: string, insertLocation: 'Start' | 'End' | 'Before' | 'After'): Paragraph;
|
|
419
|
-
/** Set a level's bullet glyph. Custom bullets require a Unicode character code. */
|
|
420
|
-
setLevelBullet(level: number, listBullet: ListBullet, charCode?: number, fontName?: string): void;
|
|
421
|
-
setLevelBullet(level: number, listBullet: 'Custom' | 'Solid' | 'Hollow' | 'Square' | 'Diamonds' | 'Arrow' | 'Checkmark', charCode?: number, fontName?: string): void;
|
|
422
|
-
/** Set decimal, letter, Roman, or unnumbered markers. Numeric format entries identify zero-based levels. */
|
|
423
|
-
setLevelNumbering(level: number, listNumbering: ListNumbering, formatString?: (string | number)[]): void;
|
|
424
|
-
setLevelNumbering(level: number, listNumbering: 'None' | 'Arabic' | 'UpperRoman' | 'LowerRoman' | 'UpperLetter' | 'LowerLetter', formatString?: (string | number)[]): void;
|
|
425
|
-
/** Set the starting counter for this list instance without changing other lists. */
|
|
426
|
-
setLevelStartingNumber(level: number, startingNumber: number): void;
|
|
427
|
-
/** Set text indent and relative first-line indent in points. Negative relative values create hanging indents. */
|
|
428
|
-
setLevelIndents(level: number, textIndent: number, bulletNumberPictureIndent: number): void;
|
|
429
|
-
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
430
|
-
protected onLoad(request: ResolvedLoadOptions): void;
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* The lists in a story, as of the batch that loaded them.
|
|
434
|
-
*
|
|
435
|
-
* @public
|
|
436
|
-
*/
|
|
437
|
-
declare class ListCollection extends HandleCollection<List> {
|
|
438
|
-
#private;
|
|
439
|
-
/** @internal The lists of one story, in the order their numbers first appear. */
|
|
440
|
-
static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle): ListCollection;
|
|
441
|
-
private constructor();
|
|
442
|
-
/** The first list. `ItemNotFound` at the sync if the story has none. */
|
|
443
|
-
getFirst(): List;
|
|
444
|
-
/**
|
|
445
|
-
* The list with one `w:numId`, or `ItemNotFound` where the story has none.
|
|
446
|
-
*
|
|
447
|
-
* ONE read, answered by the host: a `w:numId` is a document value, and matching it against a
|
|
448
|
-
* listing on this side would mean asking every list for its id and choosing locally — a batch
|
|
449
|
-
* whose size depends on the document, to answer a question the host can answer directly. A number
|
|
450
|
-
* no paragraph uses names a numbering definition rather than a list, and is refused.
|
|
451
|
-
*/
|
|
452
|
-
getById(id: number): List;
|
|
453
|
-
/** @internal The read that answers this collection's members. */
|
|
454
|
-
protected listing(): AutomationOperation;
|
|
455
|
-
/** @internal Build one member from an address the listing answered. */
|
|
456
|
-
protected itemAt(label: string, address: ObjectAddress): List;
|
|
457
|
-
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
458
|
-
protected promised(label: string, nullable: boolean): List & PromisedItem;
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* A paragraph's membership of a list: which list, and at what level.
|
|
462
|
-
*
|
|
463
|
-
* `listString` (the "3." or "iv)" a reader sees) and `siblingIndex` are absent because they are
|
|
464
|
-
* PAINTED, not authored — computed during layout by a counter that walks the story applying
|
|
465
|
-
* `numbering.xml`, its abstract-numbering indirection, restarts and overrides. Answering them
|
|
466
|
-
* here would mean a second counter that disagrees with the one on screen the first time a
|
|
467
|
-
* document overrides a level.
|
|
468
|
-
*
|
|
469
|
-
* @public
|
|
470
|
-
*/
|
|
471
|
-
declare class ListItem extends ModelObject {
|
|
472
|
-
#private;
|
|
473
|
-
/** @internal The list membership of the paragraph `owner` addresses. */
|
|
474
|
-
static of(context: RequestContext, label: string, owner: ObjectPath): ListItem;
|
|
475
|
-
private constructor();
|
|
476
|
-
/**
|
|
477
|
-
* How deeply the item is nested: zero for a top-level item, up to eight.
|
|
478
|
-
*
|
|
479
|
-
* Writing it is Word's Increase/Decrease Indent on a list item — the paragraph keeps its list and
|
|
480
|
-
* changes its level, which is why this is one property rather than a pair of verbs.
|
|
481
|
-
*/
|
|
482
|
-
get level(): number;
|
|
483
|
-
set level(value: number);
|
|
484
|
-
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
485
|
-
protected onLoad(request: ResolvedLoadOptions): void;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
408
|
/** What the object is, which is what decides how its characters are named. */
|
|
489
409
|
type SpanOwner = 'body' | 'paragraph' | 'span';
|
|
490
410
|
|
|
491
|
-
/** Office.js underline values. Unsupported runtime modes refuse at sync. @public */
|
|
492
|
-
declare enum UnderlineType {
|
|
493
|
-
mixed = "Mixed",
|
|
494
|
-
none = "None",
|
|
495
|
-
hidden = "Hidden",
|
|
496
|
-
dotLine = "DotLine",
|
|
497
|
-
single = "Single",
|
|
498
|
-
word = "Word",
|
|
499
|
-
double = "Double",
|
|
500
|
-
thick = "Thick",
|
|
501
|
-
dotted = "Dotted",
|
|
502
|
-
dottedHeavy = "DottedHeavy",
|
|
503
|
-
dashLine = "DashLine",
|
|
504
|
-
dashLineHeavy = "DashLineHeavy",
|
|
505
|
-
dashLineLong = "DashLineLong",
|
|
506
|
-
dashLineLongHeavy = "DashLineLongHeavy",
|
|
507
|
-
dotDashLine = "DotDashLine",
|
|
508
|
-
dotDashLineHeavy = "DotDashLineHeavy",
|
|
509
|
-
twoDotDashLine = "TwoDotDashLine",
|
|
510
|
-
twoDotDashLineHeavy = "TwoDotDashLineHeavy",
|
|
511
|
-
wave = "Wave",
|
|
512
|
-
waveHeavy = "WaveHeavy",
|
|
513
|
-
waveDouble = "WaveDouble"
|
|
514
|
-
}
|
|
515
411
|
/**
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
* owner's path, so a font reached from a deleted paragraph's range refuses at the same moment the
|
|
520
|
-
* range does rather than holding a stale address.
|
|
521
|
-
*
|
|
522
|
-
* Reading is AGREEMENT, and `null` means "no agreed value": every run the owner covers says bold,
|
|
523
|
-
* or the answer is null. Null is also the answer when nothing in range authors the property at
|
|
524
|
-
* all. Both are one answer on purpose, because this API reads what the document AUTHORS rather
|
|
525
|
-
* than what the style cascade computes — a heading whose bold comes from `styles.xml` reads null.
|
|
526
|
-
* Answering the cascade would let a caller read an inherited value, write it straight back, and
|
|
527
|
-
* silently freeze it into the paragraph as if the author had chosen it.
|
|
528
|
-
*
|
|
529
|
-
* Assignments within one `sync()` are ONE write: `font.bold = true; font.size = 12` accumulates
|
|
530
|
-
* into a single run-property operation. That is required, not an optimisation — a run-property
|
|
531
|
-
* write carries the run's whole property bag, so a second write planned from the same pre-batch
|
|
532
|
-
* tree would carry a bag the first had already superseded, which the host refuses with
|
|
533
|
-
* `ConflictingChanges`.
|
|
412
|
+
* An inert Word field. Code writes and evaluation support PAGE and NUMPAGES. A field inside a
|
|
413
|
+
* pending tracked insertion reads, but refuses code writes and `updateResult` until accepted.
|
|
414
|
+
* Its cached result reads and writes through {@link Field.result}.
|
|
534
415
|
*
|
|
535
416
|
* @public
|
|
536
417
|
*/
|
|
537
|
-
declare class Font extends ModelObject {
|
|
538
|
-
#private;
|
|
539
|
-
/** @internal The font of the object `owner` addresses. */
|
|
540
|
-
static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner): Font;
|
|
541
|
-
private constructor();
|
|
542
|
-
/** Whether every character agrees it is bold, or `null` where they do not. */
|
|
543
|
-
get bold(): boolean | null;
|
|
544
|
-
set bold(value: boolean);
|
|
545
|
-
/** Whether every run in range is italic. `null` where they disagree or none says. */
|
|
546
|
-
get italic(): boolean | null;
|
|
547
|
-
set italic(value: boolean);
|
|
548
|
-
/** `#RRGGBB`. `null` where the characters disagree, or where the colour is `auto`. */
|
|
549
|
-
get color(): string | null;
|
|
550
|
-
set color(value: string);
|
|
551
|
-
/** The typeface name the characters state, or `null` where they do not agree on one. */
|
|
552
|
-
get name(): string | null;
|
|
553
|
-
set name(value: string);
|
|
554
|
-
/** Points. */
|
|
555
|
-
get size(): number | null;
|
|
556
|
-
set size(value: number);
|
|
557
|
-
/** Office underline styles. Mixed, Hidden, and DotLine refuse at sync. */
|
|
558
|
-
get underline(): string | null;
|
|
559
|
-
set underline(value: UnderlineType | 'Mixed' | 'None' | 'Hidden' | 'DotLine' | 'Single' | 'Word' | 'Double' | 'Thick' | 'Dotted' | 'DottedHeavy' | 'DashLine' | 'DashLineHeavy' | 'DashLineLong' | 'DashLineLongHeavy' | 'DotDashLine' | 'DotDashLineHeavy' | 'TwoDotDashLine' | 'TwoDotDashLineHeavy' | 'Wave' | 'WaveHeavy' | 'WaveDouble');
|
|
560
|
-
/** Exact Word palette color, returned as #RRGGBB. Null clears highlighting. */
|
|
561
|
-
get highlightColor(): string | null;
|
|
562
|
-
set highlightColor(value: string);
|
|
563
|
-
get strikeThrough(): boolean | null;
|
|
564
|
-
set strikeThrough(value: boolean);
|
|
565
|
-
get subscript(): boolean | null;
|
|
566
|
-
set subscript(value: boolean);
|
|
567
|
-
get superscript(): boolean | null;
|
|
568
|
-
set superscript(value: boolean);
|
|
569
|
-
/**
|
|
570
|
-
* One read for every property asked for.
|
|
571
|
-
*
|
|
572
|
-
* They all come out of the same runs, so asking for them one at a time would send several
|
|
573
|
-
* operations about the same characters and make a caller's cost depend on how many fields they
|
|
574
|
-
* happened to name.
|
|
575
|
-
*/
|
|
576
|
-
protected onLoad(request: ResolvedLoadOptions): void;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/** An inert Word field. Code writes and evaluation support PAGE and NUMPAGES. @public */
|
|
580
418
|
declare class Field extends ModelObject implements PromisedItem {
|
|
581
419
|
#private;
|
|
582
420
|
/** @internal */
|
|
@@ -589,6 +427,17 @@ declare class Field extends ModelObject implements PromisedItem {
|
|
|
589
427
|
/** @internal */
|
|
590
428
|
hydrateNull(): void;
|
|
591
429
|
get code(): string;
|
|
430
|
+
/**
|
|
431
|
+
* The field's cached result, as a range. Two members work on it: `text` (with
|
|
432
|
+
* `load('text')`, or `field.load('result')`) reads the result, and
|
|
433
|
+
* `insertText(text, 'Replace')` replaces it with plain text and marks the field `w:dirty`, so
|
|
434
|
+
* a reader that evaluates fields recomputes it. The instruction never changes and is never
|
|
435
|
+
* evaluated. Untracked, the field must sit outside every revision. With `TrackMineOnly`, the
|
|
436
|
+
* field must be your own pending insertion, and the result joins it. Every other range
|
|
437
|
+
* member, and every other insert location, refuses with `NotImplemented` and
|
|
438
|
+
* `edit.field-result-unsupported`.
|
|
439
|
+
*/
|
|
440
|
+
get result(): Range;
|
|
592
441
|
set code(value: string);
|
|
593
442
|
/** Remove this field, including its cached result. Other fields remain inert and unchanged. */
|
|
594
443
|
delete(): void;
|
|
@@ -613,7 +462,12 @@ declare class FieldCollection extends ItemCollection<Field> {
|
|
|
613
462
|
protected promised(label: string, nullable: boolean): Field & PromisedItem;
|
|
614
463
|
}
|
|
615
464
|
|
|
616
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* Office field types. This runtime authors Page, NumPages, Ref, PageRef, NoteRef, Seq, StyleRef,
|
|
467
|
+
* Date, Time, TOC, and Empty with an instruction of one of those types.
|
|
468
|
+
*
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
617
471
|
declare enum FieldType {
|
|
618
472
|
addin = "Addin",
|
|
619
473
|
addressBlock = "AddressBlock",
|
|
@@ -750,7 +604,7 @@ declare class InlinePictureCollection extends ItemCollection<InlinePicture> {
|
|
|
750
604
|
protected promised(label: string, nullable: boolean): InlinePicture & PromisedItem;
|
|
751
605
|
}
|
|
752
606
|
|
|
753
|
-
/** A canonical
|
|
607
|
+
/** A canonical table. Reads require load() and sync(). @public */
|
|
754
608
|
declare class Table extends ModelObject implements PromisedItem {
|
|
755
609
|
#private;
|
|
756
610
|
/** @internal */
|
|
@@ -797,6 +651,18 @@ declare class Table extends ModelObject implements PromisedItem {
|
|
|
797
651
|
deleteRows(rowIndex: number, rowCount?: number): void;
|
|
798
652
|
/** Delete consecutive columns from a zero-based index. Defaults to one column. */
|
|
799
653
|
deleteColumns(columnIndex: number, columnCount?: number): void;
|
|
654
|
+
/**
|
|
655
|
+
* Merge the rectangle that the cells at `(topRow, firstCell)` and `(bottomRow, lastCell)`
|
|
656
|
+
* span into one cell. Cell indexes count the cells of each row, as `rows.items[r].cells`
|
|
657
|
+
* lists them, so a merged cell counts once. `bottomRow` must not be above `topRow`; either
|
|
658
|
+
* cell can lie further left. The rectangle grows to whole merged cells; a cell that crosses
|
|
659
|
+
* its edge, or a rectangle of one cell, refuses with `InvalidArgument` and the diagnostic
|
|
660
|
+
* code `edit.table-merge-not-rectangle`. The merged cell keeps every non-empty cell's content
|
|
661
|
+
* in reading order. Edits to the returned cell can share the sync. A pending cell revision
|
|
662
|
+
* refuses with `NotImplemented`; tracking modes refuse with `NotSupported`, because a merge
|
|
663
|
+
* has no tracked form.
|
|
664
|
+
*/
|
|
665
|
+
mergeCells(topRow: number, firstCell: number, bottomRow: number, lastCell: number): TableCell;
|
|
800
666
|
/** Delete this table and its contents through the canonical document transaction. */
|
|
801
667
|
delete(): void;
|
|
802
668
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
@@ -822,7 +688,7 @@ declare class TableRow extends ModelObject implements PromisedItem {
|
|
|
822
688
|
/** Stable cell collection for this row. Load `items` and sync before reading. */
|
|
823
689
|
get cells(): TableCellCollection;
|
|
824
690
|
}
|
|
825
|
-
/**
|
|
691
|
+
/** A table cell. Column width uses points and changes the whole grid column. @public */
|
|
826
692
|
declare class TableCell extends ModelObject implements PromisedItem {
|
|
827
693
|
#private;
|
|
828
694
|
/** @internal */
|
|
@@ -851,6 +717,14 @@ declare class TableCell extends ModelObject implements PromisedItem {
|
|
|
851
717
|
/** Top, Center, or Bottom. Mixed is a read state and cannot be assigned. */
|
|
852
718
|
get verticalAlignment(): VerticalAlignment | 'Top' | 'Center' | 'Bottom' | 'Mixed';
|
|
853
719
|
set verticalAlignment(value: VerticalAlignment | 'Top' | 'Center' | 'Bottom' | 'Mixed');
|
|
720
|
+
/**
|
|
721
|
+
* Split this cell into `rowCount` rows and `columnCount` columns of equal width. Counts run
|
|
722
|
+
* from 1 to 63. A cell merged over several rows splits only into a divisor of them; a
|
|
723
|
+
* one-row cell adds rows to the table. Counts the cell cannot take, such as columns narrower
|
|
724
|
+
* than the minimum width, refuse with `InvalidArgument` and the diagnostic code
|
|
725
|
+
* `edit.table-split-unsupported`. Tracking modes refuse with `NotSupported`.
|
|
726
|
+
*/
|
|
727
|
+
split(rowCount: number, columnCount: number): void;
|
|
854
728
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
855
729
|
}
|
|
856
730
|
/** A loaded collection of Table objects. @public */
|
|
@@ -990,190 +864,92 @@ declare class BookmarkCollection extends HandleCollection<Bookmark> {
|
|
|
990
864
|
protected promised(label: string, nullable: boolean): Bookmark & PromisedItem;
|
|
991
865
|
}
|
|
992
866
|
|
|
867
|
+
/** Office.js underline values. Unsupported runtime modes refuse at sync. @public */
|
|
868
|
+
declare enum UnderlineType {
|
|
869
|
+
mixed = "Mixed",
|
|
870
|
+
none = "None",
|
|
871
|
+
hidden = "Hidden",
|
|
872
|
+
dotLine = "DotLine",
|
|
873
|
+
single = "Single",
|
|
874
|
+
word = "Word",
|
|
875
|
+
double = "Double",
|
|
876
|
+
thick = "Thick",
|
|
877
|
+
dotted = "Dotted",
|
|
878
|
+
dottedHeavy = "DottedHeavy",
|
|
879
|
+
dashLine = "DashLine",
|
|
880
|
+
dashLineHeavy = "DashLineHeavy",
|
|
881
|
+
dashLineLong = "DashLineLong",
|
|
882
|
+
dashLineLongHeavy = "DashLineLongHeavy",
|
|
883
|
+
dotDashLine = "DotDashLine",
|
|
884
|
+
dotDashLineHeavy = "DotDashLineHeavy",
|
|
885
|
+
twoDotDashLine = "TwoDotDashLine",
|
|
886
|
+
twoDotDashLineHeavy = "TwoDotDashLineHeavy",
|
|
887
|
+
wave = "Wave",
|
|
888
|
+
waveHeavy = "WaveHeavy",
|
|
889
|
+
waveDouble = "WaveDouble"
|
|
890
|
+
}
|
|
993
891
|
/**
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
* A discriminated union rather than `unknown`: a dropdown and a checkbox do not take the same
|
|
997
|
-
* kind of thing, and a single `setValue(value: string)` would have to guess what `'true'` means
|
|
998
|
-
* to a date picker.
|
|
999
|
-
*/
|
|
1000
|
-
type ContentControlValue = {
|
|
1001
|
-
readonly kind: 'text';
|
|
1002
|
-
readonly text: string;
|
|
1003
|
-
} | {
|
|
1004
|
-
readonly kind: 'listItem';
|
|
1005
|
-
readonly value: string;
|
|
1006
|
-
} | {
|
|
1007
|
-
readonly kind: 'checkbox';
|
|
1008
|
-
readonly checked: boolean;
|
|
1009
|
-
}
|
|
1010
|
-
/** `YYYY-MM-DD`, or a full ISO-8601 instant. */
|
|
1011
|
-
| {
|
|
1012
|
-
readonly kind: 'date';
|
|
1013
|
-
readonly iso: string;
|
|
1014
|
-
};
|
|
1015
|
-
/** The lock a control carries. `ST_Lock`, spelled as the schema spells it. */
|
|
1016
|
-
type ContentControlLockState = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
|
|
1017
|
-
/** The control types this API can create. Picture and repeating section are deferred. */
|
|
1018
|
-
type ContentControlSubtype = 'richText' | 'plainText' | 'dropDownList' | 'comboBox' | 'date';
|
|
1019
|
-
/**
|
|
1020
|
-
* A part of a document a template marked as a field.
|
|
1021
|
-
*
|
|
1022
|
-
* A control is NOT its `w:id`. The attribute is optional in OOXML and unique nowhere, so a
|
|
1023
|
-
* document may hold one control with no id and two with the same one. This object is addressed by
|
|
1024
|
-
* an opaque host-minted handle instead, and {@link ContentControl.id} is answered as METADATA — a
|
|
1025
|
-
* label the file wrote, empty where it wrote none. `getById` still exists, because a template
|
|
1026
|
-
* author knows their own numbering, and it answers the first match in document order rather than
|
|
1027
|
-
* refusing.
|
|
892
|
+
* The character formatting of whatever it belongs to: a story, a stretch of one, or a paragraph.
|
|
1028
893
|
*
|
|
1029
|
-
* A
|
|
1030
|
-
*
|
|
1031
|
-
*
|
|
1032
|
-
* produce a document whose glyph and whose `w14:checked` disagree.
|
|
894
|
+
* A font has no identity of its own — it is a view onto its owner's characters and shares its
|
|
895
|
+
* owner's path, so a font reached from a deleted paragraph's range refuses at the same moment the
|
|
896
|
+
* range does rather than holding a stale address.
|
|
1033
897
|
*
|
|
1034
|
-
*
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
/** @internal A control a queued read will name, or report as nothing. */
|
|
1041
|
-
static promised(context: RequestContext, label: string, nullable: boolean): ContentControl;
|
|
1042
|
-
private constructor();
|
|
1043
|
-
/** @internal Bind this object to the address the owning read answered. */
|
|
1044
|
-
hydrateAddress(address: ObjectAddress): void;
|
|
1045
|
-
/** @internal Settle as the null object: the read found nothing to name. */
|
|
1046
|
-
hydrateNull(): void;
|
|
1047
|
-
/**
|
|
1048
|
-
* The `w:id` the file wrote, as a string, and `''` where it wrote none.
|
|
1049
|
-
*
|
|
1050
|
-
* A STRING and not a number, deliberately. The identity of this object is its handle; a numeric
|
|
1051
|
-
* `id` invites a caller to key a map on a value the schema lets a document repeat.
|
|
1052
|
-
*/
|
|
1053
|
-
get id(): string;
|
|
1054
|
-
/** `w:tag` — the machine-readable label a template puts on a field. `''` where absent. */
|
|
1055
|
-
get tag(): string;
|
|
1056
|
-
set tag(value: string);
|
|
1057
|
-
/** `w:alias` — what Word's UI calls the control's title. `''` where absent. */
|
|
1058
|
-
get title(): string;
|
|
1059
|
-
set title(value: string);
|
|
1060
|
-
/** What kind of control it is: `plainText`, `dropDownList`, `checkbox`, `date`, … */
|
|
1061
|
-
get subtype(): string;
|
|
1062
|
-
/**
|
|
1063
|
-
* Whether the control currently declares an OOXML data binding.
|
|
1064
|
-
*
|
|
1065
|
-
* This is advisory preflight for callers choosing controls to write. A document can change
|
|
1066
|
-
* after this property is loaded, so the atomic sync-time refusal remains the final authority.
|
|
1067
|
-
* Only binding presence is exposed: XPath, namespace mappings, store ids, and custom XML
|
|
1068
|
-
* content remain inside the untrusted-document boundary.
|
|
1069
|
-
*/
|
|
1070
|
-
get isBound(): boolean;
|
|
1071
|
-
/**
|
|
1072
|
-
* Whether the control refuses to be deleted.
|
|
1073
|
-
*
|
|
1074
|
-
* Reads the lock IN FORCE, so a control an enclosing one protects reports true even when its
|
|
1075
|
-
* own `w:lock` says otherwise — that is what the document does, and reporting the control's own
|
|
1076
|
-
* half would tell a caller an edit will work when the store is about to refuse it.
|
|
1077
|
-
*/
|
|
1078
|
-
get cannotDelete(): boolean;
|
|
1079
|
-
set cannotDelete(value: boolean);
|
|
1080
|
-
/** Whether the control's contents refuse to be edited. Resolved like `cannotDelete`. */
|
|
1081
|
-
get cannotEdit(): boolean;
|
|
1082
|
-
set cannotEdit(value: boolean);
|
|
1083
|
-
/**
|
|
1084
|
-
* Whether the control is showing its prompt rather than a value (`w:showingPlcHdr`).
|
|
1085
|
-
*
|
|
1086
|
-
* STATE, not text. A control showing its placeholder holds the prompt in its runs, and the
|
|
1087
|
-
* first thing written into it replaces the whole prompt — so a caller that treats `text` as a
|
|
1088
|
-
* value must ask this before believing it.
|
|
1089
|
-
*/
|
|
1090
|
-
get placeholderShown(): boolean;
|
|
1091
|
-
/** Whether the control removes its own wrapper on the first content edit (`w:temporary`). */
|
|
1092
|
-
get temporary(): boolean;
|
|
1093
|
-
/** The characters the control encloses, as the document reads them. */
|
|
1094
|
-
get text(): string;
|
|
1095
|
-
/** The paragraphs the control holds. Empty for an inline control, which holds none. */
|
|
1096
|
-
get paragraphs(): ParagraphCollection;
|
|
1097
|
-
/** The controls INSIDE this one, in document order. */
|
|
1098
|
-
get contentControls(): ContentControlCollection;
|
|
1099
|
-
/**
|
|
1100
|
-
* The stretch of the story the control's content covers.
|
|
1101
|
-
*
|
|
1102
|
-
* Read when it is asked for rather than carried by the control, because the content moves as
|
|
1103
|
-
* the document is edited: the range a caller gets is where the control is now.
|
|
1104
|
-
*/
|
|
1105
|
-
getRange(rangeLocation?: 'Whole' | 'Start' | 'End' | 'Before' | 'After' | 'Content'): Range;
|
|
1106
|
-
/**
|
|
1107
|
-
* Write the control's value.
|
|
1108
|
-
*
|
|
1109
|
-
* The refusals belong to the document, not to this method: a locked control, a control the file
|
|
1110
|
-
* bound to custom XML, and a value the control's type does not accept are all refused by the
|
|
1111
|
-
* engine's single write path, which is the same path a keystroke takes. {@link isBound} is an
|
|
1112
|
-
* advisory preflight only; this sync-time check remains authoritative if the document changed
|
|
1113
|
-
* after the flag was loaded.
|
|
1114
|
-
*/
|
|
1115
|
-
setValue(value: ContentControlValue): void;
|
|
1116
|
-
/**
|
|
1117
|
-
* Put text into the control: over what it holds, or at one end of it.
|
|
1118
|
-
* Supports text-like controls. Date, checkbox, and other typed controls refuse with NotSupported.
|
|
1119
|
-
*
|
|
1120
|
-
* `Replace` goes through the control's own value path, so the prompt it was showing and a
|
|
1121
|
-
* `w:temporary` wrapper are dealt with there rather than a second time here. The range comes
|
|
1122
|
-
* back from the WRITE and not from a read beside it: reads answer the document as it is when
|
|
1123
|
-
* the batch is planned, so a read here would name the text the write was about to replace.
|
|
1124
|
-
*/
|
|
1125
|
-
insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
|
|
1126
|
-
/**
|
|
1127
|
-
* Remove the control.
|
|
1128
|
-
*
|
|
1129
|
-
* `keepContent` true is Word's own "Remove content control": the wrapper goes and the text it
|
|
1130
|
-
* held stays exactly where it was. False takes the content with it.
|
|
1131
|
-
*/
|
|
1132
|
-
delete(keepContent: boolean): void;
|
|
1133
|
-
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1134
|
-
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1135
|
-
}
|
|
1136
|
-
/** Where a collection of controls looks: a story, or inside one control. */
|
|
1137
|
-
type ContentControlScope = {
|
|
1138
|
-
readonly body: AutomationHandle;
|
|
1139
|
-
} | {
|
|
1140
|
-
readonly contentControl: AutomationHandle;
|
|
1141
|
-
};
|
|
1142
|
-
/**
|
|
1143
|
-
* The content controls of a document, story or range, as of the batch that loaded them.
|
|
898
|
+
* Reading is AGREEMENT, and `null` means "no agreed value": every run the owner covers says bold,
|
|
899
|
+
* or the answer is null. Null is also the answer when nothing in range authors the property at
|
|
900
|
+
* all. Both are one answer on purpose, because this API reads what the document AUTHORS rather
|
|
901
|
+
* than what the style cascade computes — a heading whose bold comes from `styles.xml` reads null.
|
|
902
|
+
* Answering the cascade would let a caller read an inherited value, write it straight back, and
|
|
903
|
+
* silently freeze it into the paragraph as if the author had chosen it.
|
|
1144
904
|
*
|
|
1145
|
-
* `
|
|
1146
|
-
*
|
|
905
|
+
* Assignments within one `sync()` are ONE write: `font.bold = true; font.size = 12` accumulates
|
|
906
|
+
* into a single run-property operation. That is required, not an optimisation — a run-property
|
|
907
|
+
* write carries the run's whole property bag, so a second write planned from the same pre-batch
|
|
908
|
+
* tree would carry a bag the first had already superseded, which the host refuses with
|
|
909
|
+
* `ConflictingChanges`.
|
|
1147
910
|
*
|
|
1148
911
|
* @public
|
|
1149
912
|
*/
|
|
1150
|
-
declare class
|
|
913
|
+
declare class Font extends ModelObject {
|
|
1151
914
|
#private;
|
|
1152
|
-
/** @internal The
|
|
1153
|
-
static of(context: RequestContext, label: string, owner: ObjectPath,
|
|
915
|
+
/** @internal The font of the object `owner` addresses. */
|
|
916
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner): Font;
|
|
1154
917
|
private constructor();
|
|
1155
|
-
/**
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
918
|
+
/** Whether every character agrees it is bold, or `null` where they do not. */
|
|
919
|
+
get bold(): boolean | null;
|
|
920
|
+
set bold(value: boolean);
|
|
921
|
+
/** Whether every run in range is italic. `null` where they disagree or none says. */
|
|
922
|
+
get italic(): boolean | null;
|
|
923
|
+
set italic(value: boolean);
|
|
924
|
+
/** `#RRGGBB`. `null` where the characters disagree, or where the colour is `auto`. */
|
|
925
|
+
get color(): string | null;
|
|
926
|
+
set color(value: string);
|
|
927
|
+
/** The typeface name the characters state, or `null` where they do not agree on one. */
|
|
928
|
+
get name(): string | null;
|
|
929
|
+
set name(value: string);
|
|
930
|
+
/** Points. */
|
|
931
|
+
get size(): number | null;
|
|
932
|
+
set size(value: number);
|
|
933
|
+
/** Office underline styles. Mixed, Hidden, and DotLine refuse at sync. */
|
|
934
|
+
get underline(): string | null;
|
|
935
|
+
set underline(value: UnderlineType | 'Mixed' | 'None' | 'Hidden' | 'DotLine' | 'Single' | 'Word' | 'Double' | 'Thick' | 'Dotted' | 'DottedHeavy' | 'DashLine' | 'DashLineHeavy' | 'DashLineLong' | 'DashLineLongHeavy' | 'DotDashLine' | 'DotDashLineHeavy' | 'TwoDotDashLine' | 'TwoDotDashLineHeavy' | 'Wave' | 'WaveHeavy' | 'WaveDouble');
|
|
936
|
+
/** Exact Word palette color, returned as #RRGGBB. Null clears highlighting. */
|
|
937
|
+
get highlightColor(): string | null;
|
|
938
|
+
set highlightColor(value: string);
|
|
939
|
+
get strikeThrough(): boolean | null;
|
|
940
|
+
set strikeThrough(value: boolean);
|
|
941
|
+
get subscript(): boolean | null;
|
|
942
|
+
set subscript(value: boolean);
|
|
943
|
+
get superscript(): boolean | null;
|
|
944
|
+
set superscript(value: boolean);
|
|
1159
945
|
/**
|
|
1160
|
-
*
|
|
946
|
+
* One read for every property asked for.
|
|
1161
947
|
*
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
948
|
+
* They all come out of the same runs, so asking for them one at a time would send several
|
|
949
|
+
* operations about the same characters and make a caller's cost depend on how many fields they
|
|
950
|
+
* happened to name.
|
|
1165
951
|
*/
|
|
1166
|
-
|
|
1167
|
-
/** Every control in the scope carrying one tag, in document order. */
|
|
1168
|
-
getByTag(tag: string): ContentControlCollection;
|
|
1169
|
-
/** Every control in the scope carrying one title, in document order. */
|
|
1170
|
-
getByTitle(title: string): ContentControlCollection;
|
|
1171
|
-
/** @internal The read that answers this collection's members. */
|
|
1172
|
-
protected listing(): AutomationOperation;
|
|
1173
|
-
/** @internal Build one member from an address the listing answered. */
|
|
1174
|
-
protected itemAt(label: string, address: ObjectAddress): ContentControl;
|
|
1175
|
-
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
1176
|
-
protected promised(label: string, nullable: boolean): ContentControl & PromisedItem;
|
|
952
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1177
953
|
}
|
|
1178
954
|
|
|
1179
955
|
/**
|
|
@@ -1213,10 +989,11 @@ declare class ClientResult<T> {
|
|
|
1213
989
|
* Word's own names for a kind of change.
|
|
1214
990
|
*
|
|
1215
991
|
* The WHOLE upstream vocabulary, because a declaration says what a caller may be handed and a caller
|
|
1216
|
-
* switching on it should not have to be told which subset this engine happens to produce.
|
|
1217
|
-
* these
|
|
1218
|
-
*
|
|
1219
|
-
* from `items`; collection-wide decisions still resolve every
|
|
992
|
+
* switching on it should not have to be told which subset this engine happens to produce. Nine of
|
|
993
|
+
* these occur as published objects: Insert, Delete, Property, MovedFrom, MovedTo, CellInsertion,
|
|
994
|
+
* CellDeletion, CellMerge and ParagraphNumber. A structural card with no single type, such as
|
|
995
|
+
* table grid history, is omitted from `items`; collection-wide decisions still resolve every
|
|
996
|
+
* store-resolvable revision. See
|
|
1220
997
|
* `compat/manifest.json`.
|
|
1221
998
|
*/
|
|
1222
999
|
type RevisionType = 'None' | 'Insert' | 'Delete' | 'Property' | 'ParagraphNumber' | 'DisplayField' | 'Reconcile' | 'Conflict' | 'Style' | 'Replace' | 'ParagraphProperty' | 'TableProperty' | 'SectionProperty' | 'StyleDefinition' | 'MovedFrom' | 'MovedTo' | 'CellInsertion' | 'CellDeletion' | 'CellMerge' | 'CellSplit' | 'ConflictInsert' | 'ConflictDelete';
|
|
@@ -1327,7 +1104,12 @@ declare class Comment extends CommentBase {
|
|
|
1327
1104
|
*
|
|
1328
1105
|
* The author is the one the request context was opened with: a reply records who wrote it, and
|
|
1329
1106
|
* `CT_TrackChange` makes that mandatory, so a context with no author refuses here rather than
|
|
1330
|
-
* writing an anonymous remark the file cannot represent.
|
|
1107
|
+
* writing an anonymous remark the file cannot represent. The refusal is `NotSupported` with
|
|
1108
|
+
* `debugInfo.innerError.code` `edit.comment-author-required`.
|
|
1109
|
+
*
|
|
1110
|
+
* In a React or Vue host with the review module, use `useReview().reply` from
|
|
1111
|
+
* `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue` instead. It replies as the
|
|
1112
|
+
* editor's author.
|
|
1331
1113
|
*/
|
|
1332
1114
|
reply(replyText: string): CommentReply;
|
|
1333
1115
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
@@ -1353,11 +1135,12 @@ declare class CommentCollection extends HandleCollection<Comment> {
|
|
|
1353
1135
|
protected promised(label: string, nullable: boolean): Comment & PromisedItem;
|
|
1354
1136
|
}
|
|
1355
1137
|
/**
|
|
1356
|
-
* One tracked change
|
|
1138
|
+
* One tracked change.
|
|
1357
1139
|
*
|
|
1358
|
-
*
|
|
1359
|
-
*
|
|
1360
|
-
* `type`. That listing is not the collection decision set: see
|
|
1140
|
+
* A row is listed as `Insert` or `Delete`, and a cell or tracked numbering by its own type. A
|
|
1141
|
+
* structural card with no single type, such as table grid history, is omitted rather than
|
|
1142
|
+
* shipped with an unpublishable `type`. That listing is not the collection decision set: see
|
|
1143
|
+
* {@link RevisionCollection}.
|
|
1361
1144
|
*
|
|
1362
1145
|
* @public
|
|
1363
1146
|
*/
|
|
@@ -1378,11 +1161,31 @@ declare class Revision extends ModelObject implements PromisedItem {
|
|
|
1378
1161
|
get date(): Date | null;
|
|
1379
1162
|
/** What kind of change it is, by Word's own name for it. */
|
|
1380
1163
|
get type(): RevisionType;
|
|
1381
|
-
/** The words the change covers. */
|
|
1164
|
+
/** The words the change covers. Each read returns the same proxy, so a load on it is kept. */
|
|
1382
1165
|
get range(): Range;
|
|
1383
|
-
/**
|
|
1166
|
+
/**
|
|
1167
|
+
* Keep the change, in one transaction, with every part of it: both halves of a move or a cell
|
|
1168
|
+
* merge, and the changes inside content it removes, such as another author's insertion in a
|
|
1169
|
+
* deleted row. Rejecting a formatting change restores the earlier properties, so another
|
|
1170
|
+
* author's change inside the replaced properties, such as tracked numbering, goes with it.
|
|
1171
|
+
*
|
|
1172
|
+
* After a sync resolves this change, another call on the same object fails with
|
|
1173
|
+
* `InvalidObjectPath`, because the change is gone. Within one sync, a decision on a change an
|
|
1174
|
+
* earlier decision removed is skipped. Read `debugInfo.innerError.code` on a refusal, such as
|
|
1175
|
+
* `review.retained-structure` for a row that must stay to keep a nested table, or
|
|
1176
|
+
* `review.locked-content` and `review.bound-content` for a change a content control keeps.
|
|
1177
|
+
*
|
|
1178
|
+
* In a React or Vue host with the review module, use `useReview().accept` from
|
|
1179
|
+
* `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue` for a review UI.
|
|
1180
|
+
*
|
|
1181
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/accept-reject-without-scrolling | Accept or reject without scrolling}
|
|
1182
|
+
*/
|
|
1384
1183
|
accept(): void;
|
|
1385
|
-
/**
|
|
1184
|
+
/**
|
|
1185
|
+
* Undo the change, likewise in one transaction and with the same rules as {@link Revision.accept}.
|
|
1186
|
+
*
|
|
1187
|
+
* In a React or Vue host with the review module, use `useReview().reject` for a review UI.
|
|
1188
|
+
*/
|
|
1386
1189
|
reject(): void;
|
|
1387
1190
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1388
1191
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
@@ -1410,9 +1213,9 @@ interface RevisionAuthorOptions {
|
|
|
1410
1213
|
/**
|
|
1411
1214
|
* The tracked changes on a document, story or range, as of the batch that loaded them.
|
|
1412
1215
|
*
|
|
1413
|
-
* `items` omits structural
|
|
1216
|
+
* `items` omits a structural card with no single revision type; see {@link Revision}.
|
|
1414
1217
|
* On a story's collection, `acceptAll` / `rejectAll` still resolve every store-resolvable
|
|
1415
|
-
* revision in the story and refuse atomically if any
|
|
1218
|
+
* revision in the story and refuse atomically if any read-only or otherwise unsupported
|
|
1416
1219
|
* revision remains. On {@link Range.revisions} and `getReviewItemRevisions`, they resolve the
|
|
1417
1220
|
* changes the range overlaps or the key names, and `resolve` and `setAuthor` refuse with
|
|
1418
1221
|
* `NotSupported`.
|
|
@@ -1422,7 +1225,7 @@ interface RevisionAuthorOptions {
|
|
|
1422
1225
|
declare class RevisionCollection extends HandleCollection<Revision> {
|
|
1423
1226
|
#private;
|
|
1424
1227
|
/** @internal The pending decisions of one story. */
|
|
1425
|
-
static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle): RevisionCollection;
|
|
1228
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, body: () => AutomationHandle): RevisionCollection;
|
|
1426
1229
|
/** @internal The pending decisions a range overlaps, read from the range at plan time. */
|
|
1427
1230
|
static inSpan(context: RequestContext, label: string, owner: ObjectPath, span: () => AutomationSpanRef): RevisionCollection;
|
|
1428
1231
|
/** @internal The pending decisions one review-queue key names. */
|
|
@@ -1431,10 +1234,11 @@ declare class RevisionCollection extends HandleCollection<Revision> {
|
|
|
1431
1234
|
/**
|
|
1432
1235
|
* Keep every change in this story, as ONE decision and one undo unit.
|
|
1433
1236
|
*
|
|
1434
|
-
* Resolves every store-resolvable revision in the story, including
|
|
1435
|
-
*
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1237
|
+
* Resolves every store-resolvable revision in the story, including history omitted from
|
|
1238
|
+
* `items`. Refuses the sync outright where any read-only or otherwise unsupported revision
|
|
1239
|
+
* remains, a row must stay to keep a nested table (`review.retained-structure`), or a content
|
|
1240
|
+
* control keeps a change (`review.locked-content`, `review.bound-content`), rather
|
|
1241
|
+
* than reporting the story as reviewed while pending changes remain.
|
|
1438
1242
|
*
|
|
1439
1243
|
* On a collection from {@link Range.revisions}, resolves every change the range overlaps at
|
|
1440
1244
|
* sync time, structural changes absent from `items` included. A change the range covers in
|
|
@@ -1449,7 +1253,10 @@ declare class RevisionCollection extends HandleCollection<Revision> {
|
|
|
1449
1253
|
rejectAll(): void;
|
|
1450
1254
|
/**
|
|
1451
1255
|
* Resolve eligible revisions in this story and report skipped decisions after sync.
|
|
1452
|
-
* Omit revisions to include unsupported and
|
|
1256
|
+
* Omit revisions to include unsupported decisions and history absent from items. Named
|
|
1257
|
+
* revisions resolve as single `accept()` or `reject()` calls on them would, except that a
|
|
1258
|
+
* row kept for a nested table is reported as `retained-structure` while the other named
|
|
1259
|
+
* changes resolve, where a single call refuses whole.
|
|
1453
1260
|
* Pass an empty array to select nothing. Duplicate objects resolve once; stale targets
|
|
1454
1261
|
* are reported as unknown-revision. This must be the only write in its sync batch.
|
|
1455
1262
|
* Unlike acceptAll/rejectAll, unsupported decisions do not block independent changes.
|
|
@@ -1461,7 +1268,8 @@ declare class RevisionCollection extends HandleCollection<Revision> {
|
|
|
1461
1268
|
* const result = context.document.revisions.resolve('accept');
|
|
1462
1269
|
* await context.sync();
|
|
1463
1270
|
* console.log(result.value.resolved.length, result.value.remaining);
|
|
1464
|
-
* for (const skipped of result.value.skipped)
|
|
1271
|
+
* for (const skipped of result.value.skipped)
|
|
1272
|
+
* console.log(skipped.reason, skipped.detail ?? '');
|
|
1465
1273
|
* ```
|
|
1466
1274
|
*/
|
|
1467
1275
|
resolve(action: 'accept' | 'reject', revisions?: readonly Revision[]): ClientResult<RevisionBatchResult>;
|
|
@@ -1546,6 +1354,8 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1546
1354
|
static at(context: RequestContext, label: string, address: ObjectAddress): Range;
|
|
1547
1355
|
/** @internal A range a queued operation will name, or report as nothing. */
|
|
1548
1356
|
static promised(context: RequestContext, label: string, nullable: boolean): Range;
|
|
1357
|
+
/** @internal The cached result of the field `field` names. */
|
|
1358
|
+
static ofFieldResult(context: RequestContext, label: string, field: ObjectPath): Range;
|
|
1549
1359
|
private constructor();
|
|
1550
1360
|
/** @internal Bind this object to the address the owning read answered. */
|
|
1551
1361
|
hydrateAddress(address: ObjectAddress): void;
|
|
@@ -1586,6 +1396,23 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1586
1396
|
*/
|
|
1587
1397
|
get hyperlink(): string;
|
|
1588
1398
|
set hyperlink(value: string);
|
|
1399
|
+
/**
|
|
1400
|
+
* The content controls this range overlaps, in document order, at any nesting depth.
|
|
1401
|
+
*
|
|
1402
|
+
* A control counts when it shares at least one character with the range, and a control that
|
|
1403
|
+
* holds the whole range counts too, so a word range inside a locked control reports that
|
|
1404
|
+
* control. A block control counts when it holds one of the range's paragraphs. Load
|
|
1405
|
+
* `items/cannotEdit`, `items/tag`, and `items/text` to learn what an edit through the range
|
|
1406
|
+
* would touch.
|
|
1407
|
+
*
|
|
1408
|
+
* @example
|
|
1409
|
+
* ```ts
|
|
1410
|
+
* const controls = range.contentControls;
|
|
1411
|
+
* controls.load('items/cannotEdit,items/tag');
|
|
1412
|
+
* await context.sync();
|
|
1413
|
+
* ```
|
|
1414
|
+
*/
|
|
1415
|
+
get contentControls(): ContentControlCollection;
|
|
1589
1416
|
/** The bookmarks whose text this range overlaps, in document order. */
|
|
1590
1417
|
get bookmarks(): BookmarkCollection;
|
|
1591
1418
|
/**
|
|
@@ -1655,6 +1482,74 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1655
1482
|
get revisions(): RevisionCollection;
|
|
1656
1483
|
/** Every occurrence of `searchText` inside this range, as ranges. */
|
|
1657
1484
|
search(searchText: string, options?: SearchOptions): RangeCollection;
|
|
1485
|
+
/**
|
|
1486
|
+
* Split this range into ranges that each end after one of `endingMarks`, such as `[' ']` for
|
|
1487
|
+
* words or `['.', '!', '?']` for sentences. A paragraph end always ends a range.
|
|
1488
|
+
*
|
|
1489
|
+
* Each range is an exact span of the document, so you can use it as an edit target in a later
|
|
1490
|
+
* sync: `insertText(text, 'Replace')`, `insertText(text, 'After')`, or `delete()`, also with
|
|
1491
|
+
* change tracking on. By default each range keeps the spacing after it, so a deleted word
|
|
1492
|
+
* takes its space with it; plan edits on those ranges by index. Pass `trimSpacing` as `true`
|
|
1493
|
+
* to remove spaces, tabs, and column breaks from the start and end of each range, for reading
|
|
1494
|
+
* words; a range that holds only spacing is then left out.
|
|
1495
|
+
*
|
|
1496
|
+
* A field, an equation, a picture, or a note reference is one character of the range and is
|
|
1497
|
+
* never split, so it joins the word it touches. A field reads as its result text; an equation,
|
|
1498
|
+
* a picture, and a note reference read as U+FFFC. A tab ends a range only when you list `'\t'`
|
|
1499
|
+
* as a mark. An inline content control adds no boundary, so its words join the ranges around
|
|
1500
|
+
* it; an edit of part of a content-locked control refuses with `edit.protected-content`. Pass at most 32 marks of at most 32
|
|
1501
|
+
* UTF-16 code units each, with no unpaired surrogate; other values refuse with
|
|
1502
|
+
* `InvalidArgument`.
|
|
1503
|
+
*
|
|
1504
|
+
* Ranges follow the runtime's `revisionTextView`. Hidden text, such as a pending insertion in
|
|
1505
|
+
* the `original` view, holds no mark, and each range starts and ends at shown characters.
|
|
1506
|
+
* Hidden text between two shown characters stays inside the range, so an edit through it
|
|
1507
|
+
* also changes that text. Read ranges once, before you edit: after tracked edits, a range can
|
|
1508
|
+
* join deleted and inserted text, and an edit that touches your own pending change refuses
|
|
1509
|
+
* with `edit.tracked-own-pending-change`. Read the result with `getReviewedText('Current')`.
|
|
1510
|
+
*
|
|
1511
|
+
* @example
|
|
1512
|
+
* ```ts
|
|
1513
|
+
* const words = paragraph.getTextRanges([' '], true);
|
|
1514
|
+
* words.load('items/text');
|
|
1515
|
+
* await context.sync();
|
|
1516
|
+
* ```
|
|
1517
|
+
*/
|
|
1518
|
+
getTextRanges(endingMarks: string[], trimSpacing?: boolean): RangeCollection;
|
|
1519
|
+
/**
|
|
1520
|
+
* A new range from the start of whichever range starts first to the end of whichever ends
|
|
1521
|
+
* last. This range does not change.
|
|
1522
|
+
*
|
|
1523
|
+
* Use it to address a run of words from {@link Range.getTextRanges}: expand the first word to
|
|
1524
|
+
* the last, then replace the result. Both ranges must be in the same story, such as the body
|
|
1525
|
+
* or one header; ranges in different stories refuse the sync with `InvalidArgument`. A range
|
|
1526
|
+
* that spans paragraphs follows the same `StaleDocument` rule as `Body.getRange`.
|
|
1527
|
+
*/
|
|
1528
|
+
expandTo(range: Range): Range;
|
|
1529
|
+
/**
|
|
1530
|
+
* The whole range, its content, or one of its endpoints, as a range. The default is `Whole`.
|
|
1531
|
+
*
|
|
1532
|
+
* `Whole` and `Content` answer the same span. `Start` and `End` answer a collapsed range at
|
|
1533
|
+
* that endpoint, for an insertion point. `After` refuses with `NotSupported`, because a range
|
|
1534
|
+
* here never owns the position after its end. A text write can use the returned range in the
|
|
1535
|
+
* same sync; sync before you load it.
|
|
1536
|
+
*/
|
|
1537
|
+
getRange(rangeLocation?: RangeLocation.whole | RangeLocation.start | RangeLocation.end | RangeLocation.after | RangeLocation.content | 'Whole' | 'Start' | 'End' | 'After' | 'Content'): Range;
|
|
1538
|
+
/**
|
|
1539
|
+
* This range's text as if every pending tracked change were accepted (`Current`, the default)
|
|
1540
|
+
* or rejected (`Original`). The document does not change.
|
|
1541
|
+
*
|
|
1542
|
+
* Use it to read back a proposed rewrite between syncs: after tracked edits, `text` reads both
|
|
1543
|
+
* the deleted and the inserted words, while `getReviewedText('Current')` reads only the
|
|
1544
|
+
* result. A paragraph mark reads as `\r` when that version keeps it. Fields read as their
|
|
1545
|
+
* displayed results, like `text`. Formatting changes do not change the text.
|
|
1546
|
+
*/
|
|
1547
|
+
getReviewedText(changeTrackingVersion?: ChangeTrackingVersion): ClientResult<string>;
|
|
1548
|
+
/**
|
|
1549
|
+
* This range's text as if every pending tracked change were accepted (`Current`, the default)
|
|
1550
|
+
* or rejected (`Original`). The document does not change.
|
|
1551
|
+
*/
|
|
1552
|
+
getReviewedText(changeTrackingVersion?: 'Original' | 'Current'): ClientResult<string>;
|
|
1658
1553
|
/**
|
|
1659
1554
|
* Write text at or over this range. Answers the range the written text occupies.
|
|
1660
1555
|
* Await `context.sync()` before loading or addressing that returned range.
|
|
@@ -1669,17 +1564,29 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1669
1564
|
* text (`edit.tracked-deleted-text-only`); another author's paragraph mark, formatting, move, or
|
|
1670
1565
|
* structural change, or a link or content control inside their insertion
|
|
1671
1566
|
* (`edit.tracked-foreign-revision-unsupported`); and your own pending change, including a
|
|
1672
|
-
* range a tracked write returned (`edit.tracked-own-pending-change`).
|
|
1673
|
-
*
|
|
1674
|
-
* and edits that start inside or right after one, with `edit.tracked-foreign-revision-unsupported`. Font and paragraph
|
|
1675
|
-
* formatting support property revisions.
|
|
1567
|
+
* range a tracked write returned (`edit.tracked-own-pending-change`). The same edits work in
|
|
1568
|
+
* a collaboration session. Font and paragraph formatting support property revisions.
|
|
1676
1569
|
* Empty text with `Replace` deletes the range; empty text at an insertion point is a no-op.
|
|
1677
1570
|
* Agent tools that intend a replacement should validate non-empty model output first.
|
|
1678
1571
|
*
|
|
1572
|
+
* `\n`, `\r`, and `\r\n` in `text` are paragraph breaks: the text after one starts a new
|
|
1573
|
+
* paragraph with the properties of the paragraph it was written into. With `TrackMineOnly`,
|
|
1574
|
+
* each new paragraph mark is a tracked insertion, and rejecting it joins the paragraphs again.
|
|
1575
|
+
* The answered range then ends after the last segment, in the last new paragraph. Text that
|
|
1576
|
+
* lands inside an inline content control refuses with `NotSupported`
|
|
1577
|
+
* (`edit.indivisible-content`), and a write with a break cannot share a sync with another
|
|
1578
|
+
* text edit in the same paragraph. `\v` is a manual line break.
|
|
1579
|
+
*
|
|
1679
1580
|
* `Before`/`Start` and `After`/`End` land at the SAME position here, and the difference Word
|
|
1680
1581
|
* draws between them — whether the new text becomes part of this range — has no meaning for a
|
|
1681
1582
|
* snapshot. Both pairs are accepted because source-compatible code uses all four; what a caller
|
|
1682
1583
|
* gets back is a range naming the text that was written, in every case.
|
|
1584
|
+
*
|
|
1585
|
+
* In a React or Vue host, replace a found match in the editor itself with
|
|
1586
|
+
* `editor.exec({ type: 'replaceMatch', match, text })` on a match from `editor.findMatches`.
|
|
1587
|
+
* In suggesting mode it records a tracked replacement as the editor's author.
|
|
1588
|
+
*
|
|
1589
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/tracked-replacement | Replace as a tracked change}
|
|
1683
1590
|
*/
|
|
1684
1591
|
insertText(text: string, insertLocation: InsertLocation | 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
|
|
1685
1592
|
/**
|
|
@@ -1695,71 +1602,409 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
1695
1602
|
/** Clear this range's content, preserving the surrounding structure. */
|
|
1696
1603
|
clear(): void;
|
|
1697
1604
|
/**
|
|
1698
|
-
* Create a top-level comment anchored to exactly this range.
|
|
1605
|
+
* Create a top-level comment anchored to exactly this range.
|
|
1606
|
+
*
|
|
1607
|
+
* The author is the identity the runtime was opened with. Empty comment text, a missing author,
|
|
1608
|
+
* stale endpoints, and ranges crossing a table-cell boundary are refused rather than authored
|
|
1609
|
+
* approximately. A collapsed range creates an insertion-point comment. A missing author refuses
|
|
1610
|
+
* with `NotSupported` and `debugInfo.innerError.code` `edit.comment-author-required`.
|
|
1611
|
+
*
|
|
1612
|
+
* In a React or Vue host with the review module, use `useReview().comment` from
|
|
1613
|
+
* `@docx-editor.dev/pro/react` or `@docx-editor.dev/pro/vue` instead. It comments on the
|
|
1614
|
+
* editor's selection as the editor's author.
|
|
1615
|
+
*
|
|
1616
|
+
* @see {@link https://www.docx-editor.dev/docs/2.x/recipes/comment-on-found-text | Comment on found text}
|
|
1617
|
+
*/
|
|
1618
|
+
insertComment(commentText: string): Comment;
|
|
1619
|
+
/**
|
|
1620
|
+
* Wrap this single-paragraph range in a rich-text, plain-text, or date-picker content control.
|
|
1621
|
+
* Await sync before configuring the returned control. Other types explicitly refuse.
|
|
1622
|
+
* TrackMineOnly supports nonempty ordinary text outside collaboration.
|
|
1623
|
+
* Existing revisions and empty tracked ranges refuse with NotSupported.
|
|
1624
|
+
*/
|
|
1625
|
+
insertContentControl(contentControlType?: ContentControlType.richText | ContentControlType.plainText | ContentControlType.buildingBlockGallery | ContentControlType.checkBox | ContentControlType.comboBox | ContentControlType.datePicker | ContentControlType.dropDownList | ContentControlType.group | ContentControlType.picture | ContentControlType.repeatingSection | 'RichText' | 'PlainText' | 'BuildingBlockGallery' | 'CheckBox' | 'ComboBox' | 'DatePicker' | 'DropDownList' | 'Group' | 'Picture' | 'RepeatingSection'): ContentControl;
|
|
1626
|
+
/** Tables contained by this range, in document order. */
|
|
1627
|
+
get tables(): TableCollection;
|
|
1628
|
+
/** Fields fully contained within this range. */
|
|
1629
|
+
get fields(): FieldCollection;
|
|
1630
|
+
/**
|
|
1631
|
+
* Insert an inert field: Page, NumPages, Ref, PageRef, NoteRef, Seq, StyleRef, Date, Time,
|
|
1632
|
+
* Empty with a whole instruction of one of those types, or TOC with supported switches.
|
|
1633
|
+
* `text` holds the field arguments. The instruction is never evaluated, and the cached
|
|
1634
|
+
* result is empty. Fields that fetch, embed, link, run, or prompt refuse with
|
|
1635
|
+
* `InvalidArgument` (`edit.field-unsupported`). With `TrackMineOnly`, the field is one tracked
|
|
1636
|
+
* insertion; tracked TOC creation refuses.
|
|
1637
|
+
*/
|
|
1638
|
+
insertField(insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace', fieldType?: FieldType, text?: string, removeFormatting?: boolean): Field;
|
|
1639
|
+
/**
|
|
1640
|
+
* Insert an inert field: Page, NumPages, Ref, PageRef, NoteRef, Seq, StyleRef, Date, Time,
|
|
1641
|
+
* Empty with a whole instruction of one of those types, or TOC with supported switches.
|
|
1642
|
+
* `text` holds the field arguments. The instruction is never evaluated, and the cached
|
|
1643
|
+
* result is empty. Fields that fetch, embed, link, run, or prompt refuse with
|
|
1644
|
+
* `InvalidArgument` (`edit.field-unsupported`). With `TrackMineOnly`, the field is one tracked
|
|
1645
|
+
* insertion; tracked TOC creation refuses.
|
|
1646
|
+
*/
|
|
1647
|
+
insertField(insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace', fieldType?: FieldTypeLiteral, text?: string, removeFormatting?: boolean): Field;
|
|
1648
|
+
/**
|
|
1649
|
+
* Insert one equation from OOXML: a Flat OPC package (`pkg:package`) whose document part holds
|
|
1650
|
+
* one paragraph with exactly one inline `m:oMath` and, around it, plain runs. Other OOXML
|
|
1651
|
+
* refuses with `NotSupported` or `InvalidArgument` and `edit.ooxml-unsupported`, and nothing is
|
|
1652
|
+
* inserted. With `TrackMineOnly`, the equation is one tracked insertion. Returns the range the
|
|
1653
|
+
* inserted content occupies.
|
|
1654
|
+
*/
|
|
1655
|
+
insertOoxml(ooxml: string, insertLocation: InsertLocation | 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
|
|
1656
|
+
/** Inline pictures fully contained within this snapshot range. */
|
|
1657
|
+
get inlinePictures(): InlinePictureCollection;
|
|
1658
|
+
/**
|
|
1659
|
+
* Insert a bounded PNG/JPEG image. Sync before configuring the returned picture.
|
|
1660
|
+
*
|
|
1661
|
+
* Works on server, browser, and collaborative runtimes; on a collaborative runtime the
|
|
1662
|
+
* picture, its media part, and its relationship replicate to every participant. Insertion
|
|
1663
|
+
* must be the only mutation in its sync, and tracking refuses it.
|
|
1664
|
+
*/
|
|
1665
|
+
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: InsertLocation | 'Before' | 'After' | 'Start' | 'End' | 'Replace'): InlinePicture;
|
|
1666
|
+
/**
|
|
1667
|
+
* Line, page, and next-page section breaks are supported; other break types refuse at sync.
|
|
1668
|
+
* TrackMineOnly records a line break as a tracked insertion. Page and section breaks refuse
|
|
1669
|
+
* while tracking.
|
|
1670
|
+
*/
|
|
1671
|
+
insertBreak(breakType: BreakType | 'Page' | 'SectionNext' | 'Next' | 'Line' | 'SectionContinuous' | 'SectionEven' | 'SectionOdd', insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): void;
|
|
1672
|
+
/**
|
|
1673
|
+
* Insert a rectangular table before or after this range.
|
|
1674
|
+
* TrackMineOnly records native row/cell insertions, including initial values.
|
|
1675
|
+
* Sync before configuring the returned table. Nested table authoring refuses.
|
|
1676
|
+
*/
|
|
1677
|
+
insertTable(rowCount: number, columnCount: number, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After', values?: string[][]): Table;
|
|
1678
|
+
/** Add a paragraph before or after the one this range starts or ends in. */
|
|
1679
|
+
insertParagraph(paragraphText: string, insertLocation: InsertLocation.before | InsertLocation.after | 'Before' | 'After'): Paragraph;
|
|
1680
|
+
/**
|
|
1681
|
+
* Put the reader's selection on this range and navigate the editor viewport to it.
|
|
1682
|
+
*
|
|
1683
|
+
* The whole range is selected by default. `Start` and `End` instead collapse the caret to that
|
|
1684
|
+
* endpoint and reveal it. An already-visible endpoint stays still; an offscreen one is brought
|
|
1685
|
+
* into view from the editor's layout, including when its page has not been materialized yet.
|
|
1686
|
+
*
|
|
1687
|
+
* Refused with `NotSupported` where there is no reader — a document opened from bytes on a
|
|
1688
|
+
* server has no caret or viewport, and moving one would be a claim about a screen nobody is
|
|
1689
|
+
* looking at. The check is at the CALL rather than at the sync, so the mistake is reported where
|
|
1690
|
+
* it was made.
|
|
1691
|
+
*/
|
|
1692
|
+
select(selectionMode_?: SelectionMode): void;
|
|
1693
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1694
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* What a control's own type accepts as a value.
|
|
1699
|
+
*
|
|
1700
|
+
* A discriminated union rather than `unknown`: a dropdown and a checkbox do not take the same
|
|
1701
|
+
* kind of thing, and a single `setValue(value: string)` would have to guess what `'true'` means
|
|
1702
|
+
* to a date picker.
|
|
1703
|
+
*/
|
|
1704
|
+
type ContentControlValue = {
|
|
1705
|
+
readonly kind: 'text';
|
|
1706
|
+
readonly text: string;
|
|
1707
|
+
} | {
|
|
1708
|
+
readonly kind: 'listItem';
|
|
1709
|
+
readonly value: string;
|
|
1710
|
+
} | {
|
|
1711
|
+
readonly kind: 'checkbox';
|
|
1712
|
+
readonly checked: boolean;
|
|
1713
|
+
}
|
|
1714
|
+
/** `YYYY-MM-DD`, or a full ISO-8601 instant. */
|
|
1715
|
+
| {
|
|
1716
|
+
readonly kind: 'date';
|
|
1717
|
+
readonly iso: string;
|
|
1718
|
+
};
|
|
1719
|
+
/** The lock a control carries. `ST_Lock`, spelled as the schema spells it. */
|
|
1720
|
+
type ContentControlLockState = 'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked';
|
|
1721
|
+
/** The control types this API can create. Picture and repeating section are deferred. */
|
|
1722
|
+
type ContentControlSubtype = 'richText' | 'plainText' | 'dropDownList' | 'comboBox' | 'date';
|
|
1723
|
+
/**
|
|
1724
|
+
* A part of a document a template marked as a field.
|
|
1725
|
+
*
|
|
1726
|
+
* A control is NOT its `w:id`. The attribute is optional in OOXML and unique nowhere, so a
|
|
1727
|
+
* document may hold one control with no id and two with the same one. This object is addressed by
|
|
1728
|
+
* an opaque host-minted handle instead, and {@link ContentControl.id} is answered as METADATA — a
|
|
1729
|
+
* label the file wrote, empty where it wrote none. `getById` still exists, because a template
|
|
1730
|
+
* author knows their own numbering, and it answers the first match in document order rather than
|
|
1731
|
+
* refusing.
|
|
1732
|
+
*
|
|
1733
|
+
* A control's contents are not its value. `text` reads the characters; `setValue` writes in the
|
|
1734
|
+
* vocabulary the control's own type accepts — a declared item for a dropdown, an ISO date for a
|
|
1735
|
+
* date picker, a state for a checkbox — because writing `"true"` into a checkbox's runs would
|
|
1736
|
+
* produce a document whose glyph and whose `w14:checked` disagree.
|
|
1737
|
+
*
|
|
1738
|
+
* @public
|
|
1739
|
+
*/
|
|
1740
|
+
declare class ContentControl extends ModelObject implements PromisedItem {
|
|
1741
|
+
#private;
|
|
1742
|
+
/** @internal A control a read has already named. */
|
|
1743
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): ContentControl;
|
|
1744
|
+
/** @internal A control a queued read will name, or report as nothing. */
|
|
1745
|
+
static promised(context: RequestContext, label: string, nullable: boolean): ContentControl;
|
|
1746
|
+
private constructor();
|
|
1747
|
+
/** @internal Bind this object to the address the owning read answered. */
|
|
1748
|
+
hydrateAddress(address: ObjectAddress): void;
|
|
1749
|
+
/** @internal Settle as the null object: the read found nothing to name. */
|
|
1750
|
+
hydrateNull(): void;
|
|
1751
|
+
/**
|
|
1752
|
+
* The `w:id` the file wrote, as a string, and `''` where it wrote none.
|
|
1753
|
+
*
|
|
1754
|
+
* A STRING and not a number, deliberately. The identity of this object is its handle; a numeric
|
|
1755
|
+
* `id` invites a caller to key a map on a value the schema lets a document repeat.
|
|
1756
|
+
*/
|
|
1757
|
+
get id(): string;
|
|
1758
|
+
/** `w:tag` — the machine-readable label a template puts on a field. `''` where absent. */
|
|
1759
|
+
get tag(): string;
|
|
1760
|
+
set tag(value: string);
|
|
1761
|
+
/** `w:alias` — what Word's UI calls the control's title. `''` where absent. */
|
|
1762
|
+
get title(): string;
|
|
1763
|
+
set title(value: string);
|
|
1764
|
+
/** What kind of control it is: `plainText`, `dropDownList`, `checkbox`, `date`, … */
|
|
1765
|
+
get subtype(): string;
|
|
1766
|
+
/**
|
|
1767
|
+
* Whether the control currently declares an OOXML data binding.
|
|
1768
|
+
*
|
|
1769
|
+
* This is advisory preflight for callers choosing controls to write. A document can change
|
|
1770
|
+
* after this property is loaded, so the atomic sync-time refusal remains the final authority.
|
|
1771
|
+
* Only binding presence is exposed: XPath, namespace mappings, store ids, and custom XML
|
|
1772
|
+
* content remain inside the untrusted-document boundary.
|
|
1773
|
+
*/
|
|
1774
|
+
get isBound(): boolean;
|
|
1775
|
+
/**
|
|
1776
|
+
* Whether the control refuses to be deleted.
|
|
1777
|
+
*
|
|
1778
|
+
* Reads the lock IN FORCE, so a control an enclosing one protects reports true even when its
|
|
1779
|
+
* own `w:lock` says otherwise — that is what the document does, and reporting the control's own
|
|
1780
|
+
* half would tell a caller an edit will work when the store is about to refuse it.
|
|
1781
|
+
*/
|
|
1782
|
+
get cannotDelete(): boolean;
|
|
1783
|
+
set cannotDelete(value: boolean);
|
|
1784
|
+
/** Whether the control's contents refuse to be edited. Resolved like `cannotDelete`. */
|
|
1785
|
+
get cannotEdit(): boolean;
|
|
1786
|
+
set cannotEdit(value: boolean);
|
|
1787
|
+
/**
|
|
1788
|
+
* Whether the control is showing its prompt rather than a value (`w:showingPlcHdr`).
|
|
1789
|
+
*
|
|
1790
|
+
* STATE, not text. A control showing its placeholder holds the prompt in its runs, and the
|
|
1791
|
+
* first thing written into it replaces the whole prompt — so a caller that treats `text` as a
|
|
1792
|
+
* value must ask this before believing it.
|
|
1793
|
+
*/
|
|
1794
|
+
get placeholderShown(): boolean;
|
|
1795
|
+
/** Whether the control removes its own wrapper on the first content edit (`w:temporary`). */
|
|
1796
|
+
get temporary(): boolean;
|
|
1797
|
+
/** The characters the control encloses, as the document reads them. */
|
|
1798
|
+
get text(): string;
|
|
1799
|
+
/** The paragraphs the control holds. Empty for an inline control, which holds none. */
|
|
1800
|
+
get paragraphs(): ParagraphCollection;
|
|
1801
|
+
/** The controls INSIDE this one, in document order. */
|
|
1802
|
+
get contentControls(): ContentControlCollection;
|
|
1803
|
+
/**
|
|
1804
|
+
* The stretch of the story the control's content covers.
|
|
1699
1805
|
*
|
|
1700
|
-
*
|
|
1701
|
-
*
|
|
1702
|
-
* approximately. A collapsed range creates an insertion-point comment.
|
|
1806
|
+
* Read when it is asked for rather than carried by the control, because the content moves as
|
|
1807
|
+
* the document is edited: the range a caller gets is where the control is now.
|
|
1703
1808
|
*/
|
|
1704
|
-
|
|
1809
|
+
getRange(rangeLocation?: 'Whole' | 'Start' | 'End' | 'Before' | 'After' | 'Content'): Range;
|
|
1705
1810
|
/**
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
*
|
|
1811
|
+
* Write the control's value.
|
|
1812
|
+
*
|
|
1813
|
+
* The refusals belong to the document, not to this method: a locked control, a control the file
|
|
1814
|
+
* bound to custom XML, and a value the control's type does not accept are all refused by the
|
|
1815
|
+
* engine's single write path, which is the same path a keystroke takes. {@link isBound} is an
|
|
1816
|
+
* advisory preflight only; this sync-time check remains authoritative if the document changed
|
|
1817
|
+
* after the flag was loaded.
|
|
1710
1818
|
*/
|
|
1711
|
-
|
|
1712
|
-
/** Tables contained by this range, in document order. */
|
|
1713
|
-
get tables(): TableCollection;
|
|
1714
|
-
/** Fields fully contained within this range. */
|
|
1715
|
-
get fields(): FieldCollection;
|
|
1819
|
+
setValue(value: ContentControlValue): void;
|
|
1716
1820
|
/**
|
|
1717
|
-
*
|
|
1718
|
-
*
|
|
1821
|
+
* Put text into the control: over what it holds, or at one end of it.
|
|
1822
|
+
* Supports text-like controls. Date, checkbox, and other typed controls refuse with NotSupported.
|
|
1823
|
+
*
|
|
1824
|
+
* `Replace` goes through the control's own value path, so the prompt it was showing and a
|
|
1825
|
+
* `w:temporary` wrapper are dealt with there rather than a second time here. The range comes
|
|
1826
|
+
* back from the WRITE and not from a read beside it: reads answer the document as it is when
|
|
1827
|
+
* the batch is planned, so a read here would name the text the write was about to replace.
|
|
1719
1828
|
*/
|
|
1720
|
-
|
|
1829
|
+
insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
|
|
1721
1830
|
/**
|
|
1722
|
-
*
|
|
1723
|
-
*
|
|
1831
|
+
* Remove the control.
|
|
1832
|
+
*
|
|
1833
|
+
* `keepContent` true is Word's own "Remove content control": the wrapper goes and the text it
|
|
1834
|
+
* held stays exactly where it was. False takes the content with it.
|
|
1724
1835
|
*/
|
|
1725
|
-
|
|
1726
|
-
/**
|
|
1727
|
-
|
|
1836
|
+
delete(keepContent: boolean): void;
|
|
1837
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1838
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1839
|
+
}
|
|
1840
|
+
/** Where a collection of controls looks: a story, or inside one control. */
|
|
1841
|
+
type ScopeValue = {
|
|
1842
|
+
readonly body: AutomationHandle;
|
|
1843
|
+
} | {
|
|
1844
|
+
readonly contentControl: AutomationHandle;
|
|
1845
|
+
} | {
|
|
1846
|
+
readonly span: AutomationSpanRef;
|
|
1847
|
+
};
|
|
1848
|
+
/** A scope now, or one a range or paragraph names when the batch is planned. */
|
|
1849
|
+
type ContentControlScope = ScopeValue | (() => ScopeValue);
|
|
1850
|
+
/**
|
|
1851
|
+
* The content controls of a document, story or range, as of the batch that loaded them.
|
|
1852
|
+
*
|
|
1853
|
+
* `getById` answers the first match in document order, because `w:id` is optional in OOXML and
|
|
1854
|
+
* unique nowhere — see {@link ContentControl} for why choosing predictably beats refusing.
|
|
1855
|
+
*
|
|
1856
|
+
* @public
|
|
1857
|
+
*/
|
|
1858
|
+
declare class ContentControlCollection extends HandleCollection<ContentControl> {
|
|
1859
|
+
#private;
|
|
1860
|
+
/** @internal The controls of a scope, in document order. */
|
|
1861
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, scope: ContentControlScope): ContentControlCollection;
|
|
1862
|
+
private constructor();
|
|
1863
|
+
/** The first control. `ItemNotFound` at the sync if the scope holds none. */
|
|
1864
|
+
getFirst(): ContentControl;
|
|
1865
|
+
/** The first control, or an object that says `isNullObject` where there is none. */
|
|
1866
|
+
getFirstOrNullObject(): ContentControl;
|
|
1728
1867
|
/**
|
|
1729
|
-
*
|
|
1868
|
+
* The first control carrying one `w:id`, or `ItemNotFound` where the scope holds none.
|
|
1730
1869
|
*
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
1733
|
-
*
|
|
1870
|
+
* FIRST in document order, because `w:id` is not unique. The lookup is one read answered by the
|
|
1871
|
+
* host: matching it here would mean asking every control for its id and choosing locally, which
|
|
1872
|
+
* is a batch whose size depends on how many controls the document has.
|
|
1734
1873
|
*/
|
|
1735
|
-
|
|
1874
|
+
getById(id: number): ContentControl;
|
|
1875
|
+
/** Every control in the scope carrying one tag, in document order. */
|
|
1876
|
+
getByTag(tag: string): ContentControlCollection;
|
|
1877
|
+
/** Every control in the scope carrying one title, in document order. */
|
|
1878
|
+
getByTitle(title: string): ContentControlCollection;
|
|
1879
|
+
/** @internal The read that answers this collection's members. */
|
|
1880
|
+
protected listing(): AutomationOperation;
|
|
1881
|
+
/** @internal Build one member from an address the listing answered. */
|
|
1882
|
+
protected itemAt(label: string, address: ObjectAddress): ContentControl;
|
|
1883
|
+
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
1884
|
+
protected promised(label: string, nullable: boolean): ContentControl & PromisedItem;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/** Supported Word bullet styles. @public */
|
|
1888
|
+
declare enum ListBullet {
|
|
1889
|
+
custom = "Custom",
|
|
1890
|
+
solid = "Solid",
|
|
1891
|
+
hollow = "Hollow",
|
|
1892
|
+
square = "Square",
|
|
1893
|
+
diamonds = "Diamonds",
|
|
1894
|
+
arrow = "Arrow",
|
|
1895
|
+
checkmark = "Checkmark"
|
|
1896
|
+
}
|
|
1897
|
+
/** Supported Word numbering styles. @public */
|
|
1898
|
+
declare enum ListNumbering {
|
|
1899
|
+
none = "None",
|
|
1900
|
+
arabic = "Arabic",
|
|
1901
|
+
upperRoman = "UpperRoman",
|
|
1902
|
+
lowerRoman = "LowerRoman",
|
|
1903
|
+
upperLetter = "UpperLetter",
|
|
1904
|
+
lowerLetter = "LowerLetter"
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* A list: the set of paragraphs sharing one numbering id.
|
|
1908
|
+
*
|
|
1909
|
+
* A list is not an ELEMENT. OOXML has no list — it has paragraphs that each name a `w:numId`, and
|
|
1910
|
+
* a list is the set that name the same one. So {@link List.id} is that number,
|
|
1911
|
+
* {@link List.paragraphs} is the set, and a list exists exactly as long as some paragraph is
|
|
1912
|
+
* still in it.
|
|
1913
|
+
*
|
|
1914
|
+
* @public
|
|
1915
|
+
*/
|
|
1916
|
+
declare class List extends ModelObject implements PromisedItem {
|
|
1917
|
+
#private;
|
|
1918
|
+
/** @internal A list a read has already named. */
|
|
1919
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): List;
|
|
1920
|
+
/** @internal A list a queued read will name, or report as nothing. */
|
|
1921
|
+
static promised(context: RequestContext, label: string, nullable: boolean): List;
|
|
1922
|
+
private constructor();
|
|
1923
|
+
/** @internal Bind this object to the address the owning read answered. */
|
|
1924
|
+
hydrateAddress(address: ObjectAddress): void;
|
|
1925
|
+
/** @internal Settle as the null object: the read found nothing to name. */
|
|
1926
|
+
hydrateNull(): void;
|
|
1927
|
+
/** The `w:numId` the list's paragraphs share — the document's own identity for the list. */
|
|
1928
|
+
get id(): number;
|
|
1929
|
+
/** Every paragraph in the list, in reading order. */
|
|
1930
|
+
get paragraphs(): ParagraphCollection;
|
|
1931
|
+
/** The list's paragraphs at one level, in reading order. */
|
|
1932
|
+
getLevelParagraphs(level: number): ParagraphCollection;
|
|
1736
1933
|
/**
|
|
1737
|
-
*
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1934
|
+
* Add a numbered paragraph to the list, at its start or its end.
|
|
1935
|
+
*
|
|
1936
|
+
* All four of Word's locations are accepted and `Before`/`After` land INSIDE the list, at the
|
|
1937
|
+
* first and last position — the same places `Start` and `End` name. A list is a set of paragraphs
|
|
1938
|
+
* rather than a region, so "before the list" is a position in the story rather than in the list,
|
|
1939
|
+
* and `Paragraph#insertParagraph` is what addresses that. The divergence is recorded in
|
|
1940
|
+
* `compat/manifest.json`.
|
|
1740
1941
|
*/
|
|
1741
|
-
|
|
1942
|
+
insertParagraph(paragraphText: string, insertLocation: 'Start' | 'End' | 'Before' | 'After'): Paragraph;
|
|
1943
|
+
/** Set a level's bullet glyph. Custom bullets require a Unicode character code. */
|
|
1944
|
+
setLevelBullet(level: number, listBullet: ListBullet, charCode?: number, fontName?: string): void;
|
|
1945
|
+
setLevelBullet(level: number, listBullet: 'Custom' | 'Solid' | 'Hollow' | 'Square' | 'Diamonds' | 'Arrow' | 'Checkmark', charCode?: number, fontName?: string): void;
|
|
1946
|
+
/** Set decimal, letter, Roman, or unnumbered markers. Numeric format entries identify zero-based levels. */
|
|
1947
|
+
setLevelNumbering(level: number, listNumbering: ListNumbering, formatString?: (string | number)[]): void;
|
|
1948
|
+
setLevelNumbering(level: number, listNumbering: 'None' | 'Arabic' | 'UpperRoman' | 'LowerRoman' | 'UpperLetter' | 'LowerLetter', formatString?: (string | number)[]): void;
|
|
1949
|
+
/** Set the starting counter for this list instance without changing other lists. */
|
|
1950
|
+
setLevelStartingNumber(level: number, startingNumber: number): void;
|
|
1951
|
+
/** Set text indent and relative first-line indent in points. Negative relative values create hanging indents. */
|
|
1952
|
+
setLevelIndents(level: number, textIndent: number, bulletNumberPictureIndent: number): void;
|
|
1953
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1954
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* The lists in a story, as of the batch that loaded them.
|
|
1958
|
+
*
|
|
1959
|
+
* @public
|
|
1960
|
+
*/
|
|
1961
|
+
declare class ListCollection extends HandleCollection<List> {
|
|
1962
|
+
#private;
|
|
1963
|
+
/** @internal The lists of one story, in the order their numbers first appear. */
|
|
1964
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle): ListCollection;
|
|
1965
|
+
private constructor();
|
|
1966
|
+
/** The first list. `ItemNotFound` at the sync if the story has none. */
|
|
1967
|
+
getFirst(): List;
|
|
1742
1968
|
/**
|
|
1743
|
-
*
|
|
1744
|
-
*
|
|
1745
|
-
*
|
|
1969
|
+
* The list with one `w:numId`, or `ItemNotFound` where the story has none.
|
|
1970
|
+
*
|
|
1971
|
+
* ONE read, answered by the host: a `w:numId` is a document value, and matching it against a
|
|
1972
|
+
* listing on this side would mean asking every list for its id and choosing locally — a batch
|
|
1973
|
+
* whose size depends on the document, to answer a question the host can answer directly. A number
|
|
1974
|
+
* no paragraph uses names a numbering definition rather than a list, and is refused.
|
|
1746
1975
|
*/
|
|
1747
|
-
|
|
1748
|
-
/**
|
|
1749
|
-
|
|
1976
|
+
getById(id: number): List;
|
|
1977
|
+
/** @internal The read that answers this collection's members. */
|
|
1978
|
+
protected listing(): AutomationOperation;
|
|
1979
|
+
/** @internal Build one member from an address the listing answered. */
|
|
1980
|
+
protected itemAt(label: string, address: ObjectAddress): List;
|
|
1981
|
+
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
1982
|
+
protected promised(label: string, nullable: boolean): List & PromisedItem;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* A paragraph's membership of a list: which list, and at what level.
|
|
1986
|
+
*
|
|
1987
|
+
* `listString` (the "3." or "iv)" a reader sees) and `siblingIndex` are absent because they are
|
|
1988
|
+
* PAINTED, not authored — computed during layout by a counter that walks the story applying
|
|
1989
|
+
* `numbering.xml`, its abstract-numbering indirection, restarts and overrides. Answering them
|
|
1990
|
+
* here would mean a second counter that disagrees with the one on screen the first time a
|
|
1991
|
+
* document overrides a level.
|
|
1992
|
+
*
|
|
1993
|
+
* @public
|
|
1994
|
+
*/
|
|
1995
|
+
declare class ListItem extends ModelObject {
|
|
1996
|
+
#private;
|
|
1997
|
+
/** @internal The list membership of the paragraph `owner` addresses. */
|
|
1998
|
+
static of(context: RequestContext, label: string, owner: ObjectPath): ListItem;
|
|
1999
|
+
private constructor();
|
|
1750
2000
|
/**
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
* The whole range is selected by default. `Start` and `End` instead collapse the caret to that
|
|
1754
|
-
* endpoint and reveal it. An already-visible endpoint stays still; an offscreen one is brought
|
|
1755
|
-
* into view from the editor's layout, including when its page has not been materialized yet.
|
|
2001
|
+
* How deeply the item is nested: zero for a top-level item, up to eight.
|
|
1756
2002
|
*
|
|
1757
|
-
*
|
|
1758
|
-
*
|
|
1759
|
-
* looking at. The check is at the CALL rather than at the sync, so the mistake is reported where
|
|
1760
|
-
* it was made.
|
|
2003
|
+
* Writing it is Word's Increase/Decrease Indent on a list item — the paragraph keeps its list and
|
|
2004
|
+
* changes its level, which is why this is one property rather than a pair of verbs.
|
|
1761
2005
|
*/
|
|
1762
|
-
|
|
2006
|
+
get level(): number;
|
|
2007
|
+
set level(value: number);
|
|
1763
2008
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1764
2009
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1765
2010
|
}
|
|
@@ -1803,6 +2048,14 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1803
2048
|
hydrateNull(): void;
|
|
1804
2049
|
/** This paragraph's text. Readable after `load('text')` and a `sync()`. */
|
|
1805
2050
|
get text(): string;
|
|
2051
|
+
/**
|
|
2052
|
+
* The content controls in this paragraph, in document order, at any nesting depth.
|
|
2053
|
+
*
|
|
2054
|
+
* Includes every inline control in the paragraph and a block control that holds it. Load
|
|
2055
|
+
* `items/cannotEdit`, `items/tag`, and `items/text` before you plan edits, and keep each locked
|
|
2056
|
+
* control as one unit.
|
|
2057
|
+
*/
|
|
2058
|
+
get contentControls(): ContentControlCollection;
|
|
1806
2059
|
/**
|
|
1807
2060
|
* The document's own identity for this paragraph.
|
|
1808
2061
|
*
|
|
@@ -1881,6 +2134,31 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1881
2134
|
* same `context.sync()` that finds it.
|
|
1882
2135
|
*/
|
|
1883
2136
|
search(searchText: string, searchOptions?: SearchOptions): RangeCollection;
|
|
2137
|
+
/**
|
|
2138
|
+
* Split this paragraph into ranges that each end after one of `endingMarks`, such as `[' ']`
|
|
2139
|
+
* for words. Takes the same arguments and follows the same rules as `Range.getTextRanges`.
|
|
2140
|
+
*
|
|
2141
|
+
* @example
|
|
2142
|
+
* ```ts
|
|
2143
|
+
* const words = paragraph.getTextRanges([' '], true);
|
|
2144
|
+
* words.load('items/text');
|
|
2145
|
+
* await context.sync();
|
|
2146
|
+
* ```
|
|
2147
|
+
*/
|
|
2148
|
+
getTextRanges(endingMarks: string[], trimSpacing?: boolean): RangeCollection;
|
|
2149
|
+
/**
|
|
2150
|
+
* This paragraph's text as if every pending tracked change were accepted (`Current`, the
|
|
2151
|
+
* default) or rejected (`Original`). The document does not change.
|
|
2152
|
+
*
|
|
2153
|
+
* After tracked edits, `text` reads both the deleted and the inserted words. Read
|
|
2154
|
+
* `getReviewedText('Current')` to check the proposed result before the next edit.
|
|
2155
|
+
*/
|
|
2156
|
+
getReviewedText(changeTrackingVersion?: ChangeTrackingVersion): ClientResult<string>;
|
|
2157
|
+
/**
|
|
2158
|
+
* This paragraph's text as if every pending tracked change were accepted (`Current`, the
|
|
2159
|
+
* default) or rejected (`Original`). The document does not change.
|
|
2160
|
+
*/
|
|
2161
|
+
getReviewedText(changeTrackingVersion?: 'Original' | 'Current'): ClientResult<string>;
|
|
1884
2162
|
/** Start a new independent bullet list with this paragraph. Sync before using the returned list. */
|
|
1885
2163
|
startNewList(): List;
|
|
1886
2164
|
/** Join an existing list at a zero-based nesting level. */
|
|
@@ -1910,7 +2188,12 @@ declare class Paragraph extends ModelObject implements PromisedItem {
|
|
|
1910
2188
|
* decision. A refusal refuses the whole sync.
|
|
1911
2189
|
*/
|
|
1912
2190
|
delete(): void;
|
|
1913
|
-
/**
|
|
2191
|
+
/**
|
|
2192
|
+
* Write text over this paragraph or at either edge of it. Answers the written text's range.
|
|
2193
|
+
*
|
|
2194
|
+
* `\n`, `\r`, and `\r\n` in `text` start new paragraphs, tracked with `TrackMineOnly`. See
|
|
2195
|
+
* `Range.insertText` for the rules.
|
|
2196
|
+
*/
|
|
1914
2197
|
insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
|
|
1915
2198
|
/** Add a paragraph beside this one. Answers the new paragraph. */
|
|
1916
2199
|
insertParagraph(paragraphText: string, insertLocation: 'Before' | 'After'): Paragraph;
|
|
@@ -2272,7 +2555,8 @@ declare class Document extends ModelObject {
|
|
|
2272
2555
|
/**
|
|
2273
2556
|
* The tracked changes of the main-body story that this API can publish as typed objects.
|
|
2274
2557
|
*
|
|
2275
|
-
*
|
|
2558
|
+
* A structural card with no single revision type is omitted from `items`, and so are property
|
|
2559
|
+
* changes that leave the resolved formatting unchanged.
|
|
2276
2560
|
* `acceptAll` / `rejectAll` still resolve every store-resolvable revision in the main body
|
|
2277
2561
|
* and refuse atomically if any `readOnly` or otherwise unsupported revision remains. Header,
|
|
2278
2562
|
* footer, and note revisions live on those stories' own `Body.revisions` collections.
|
|
@@ -2341,14 +2625,23 @@ type DocxEditorErrorCode =
|
|
|
2341
2625
|
| 'ResourceLimitExceeded'
|
|
2342
2626
|
/** The collection has no such item — `getFirst()` on an empty one. */
|
|
2343
2627
|
| 'ItemNotFound'
|
|
2344
|
-
/**
|
|
2628
|
+
/**
|
|
2629
|
+
* The call is outside the supported subset for this host, mode, or content, and nothing
|
|
2630
|
+
* changed. Examples: a server has no selection to move; `TrackMineOnly` has no tracked form
|
|
2631
|
+
* for the operation; the OOXML or the field result holds content the subset does not take.
|
|
2632
|
+
*
|
|
2633
|
+
* Never retry the same call. Read `debugInfo.innerError.code` for the rule, then choose a
|
|
2634
|
+
* supported call, another mode, or other content.
|
|
2635
|
+
*/
|
|
2345
2636
|
| 'NotSupported'
|
|
2346
2637
|
/**
|
|
2347
|
-
* The member
|
|
2638
|
+
* The member or rule is one this API does not implement for the target, and nothing changed.
|
|
2639
|
+
* Examples: a range member that a field result does not support; a tracked edit that touches
|
|
2640
|
+
* your own pending change or another author's pending structural change.
|
|
2348
2641
|
*
|
|
2349
|
-
*
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2642
|
+
* Never retry the same call. Read `debugInfo.innerError.code` for the rule, then read the
|
|
2643
|
+
* target again and edit a different range, decide the pending change first, or use another
|
|
2644
|
+
* member.
|
|
2352
2645
|
*/
|
|
2353
2646
|
| 'NotImplemented'
|
|
2354
2647
|
/**
|
|
@@ -2734,10 +3027,13 @@ interface RunOptions {
|
|
|
2734
3027
|
* Pass the handle `editor.beginHistoryGroup()` returns, unchanged.
|
|
2735
3028
|
*
|
|
2736
3029
|
* Browser runtime only. A server or collaborative runtime refuses the run with
|
|
2737
|
-
* `NotSupported` before the callback starts.
|
|
2738
|
-
*
|
|
2739
|
-
*
|
|
2740
|
-
*
|
|
3030
|
+
* `NotSupported` before the callback starts. To make one operation of a collaborative
|
|
3031
|
+
* server runtime one undo step, open `beginUndoGroup()` on its collaboration session.
|
|
3032
|
+
*
|
|
3033
|
+
* A closed handle, or a handle from another editor, refuses with `InvalidArgument` and
|
|
3034
|
+
* `target: 'historyGroup'` before the callback starts. A handle that closes during the run
|
|
3035
|
+
* refuses the next `context.sync()` the same way, and that sync writes nothing. Runs without
|
|
3036
|
+
* this option never join a group.
|
|
2741
3037
|
*
|
|
2742
3038
|
* The run has no `ExecResult`. The whole run is one write of the group: after the callback
|
|
2743
3039
|
* finishes, `historyGroup.lastOutcome` holds its outcome, which is `split` if any sync split
|
|
@@ -3356,7 +3652,7 @@ declare class Body extends ModelObject {
|
|
|
3356
3652
|
*
|
|
3357
3653
|
* DocxEditor's own accessor: upstream reaches revisions from the document, and this story-scoped
|
|
3358
3654
|
* collection is what makes a header's, footer's, or note's changes reachable at all. Recorded in
|
|
3359
|
-
* `compat/manifest.json`. `items` may omit structural
|
|
3655
|
+
* `compat/manifest.json`. `items` may omit a structural card with no single type; collection-wide decisions still
|
|
3360
3656
|
* resolve every store-resolvable revision in this story.
|
|
3361
3657
|
*/
|
|
3362
3658
|
get revisions(): RevisionCollection;
|
|
@@ -3366,7 +3662,12 @@ declare class Body extends ModelObject {
|
|
|
3366
3662
|
search(searchText: string, options?: SearchOptions): RangeCollection;
|
|
3367
3663
|
/** Empty the story, leaving one empty paragraph behind. */
|
|
3368
3664
|
clear(): void;
|
|
3369
|
-
/**
|
|
3665
|
+
/**
|
|
3666
|
+
* Write text over the whole story, or at either edge of it. Answers the text's own range.
|
|
3667
|
+
*
|
|
3668
|
+
* `\n`, `\r`, and `\r\n` in `text` start new paragraphs, tracked with `TrackMineOnly` at
|
|
3669
|
+
* `Start` and `End`. See `Range.insertText` for the rules.
|
|
3670
|
+
*/
|
|
3370
3671
|
insertText(text: string, insertLocation: InsertLocation.replace | InsertLocation.start | InsertLocation.end | 'Replace' | 'Start' | 'End'): Range;
|
|
3371
3672
|
/** Add a paragraph at the start or the end of the story. Answers the new paragraph. */
|
|
3372
3673
|
insertParagraph(paragraphText: string, insertLocation: InsertLocation.start | InsertLocation.end | 'Start' | 'End'): Paragraph;
|
|
@@ -3527,6 +3828,18 @@ type RuntimeDiagnostic = {
|
|
|
3527
3828
|
readonly errorName?: DiagnosticErrorName;
|
|
3528
3829
|
/** `automation` when `cause` is `exception`. */
|
|
3529
3830
|
readonly stage?: 'automation';
|
|
3831
|
+
} | {
|
|
3832
|
+
/** A tracked-change decision the batch refused, with why and in what structure. */
|
|
3833
|
+
readonly kind: 'review.skipped';
|
|
3834
|
+
readonly code: ReviewDiagnosticCode;
|
|
3835
|
+
/** Always 1: a refused batch is one decision. */
|
|
3836
|
+
readonly count: number;
|
|
3837
|
+
readonly operation?: ReviewOperation;
|
|
3838
|
+
/**
|
|
3839
|
+
* The structure behind the skip, such as `paired-change` for the other half of a move,
|
|
3840
|
+
* or `nested-table` for a row kept for its nested table. See `diagnosticCauses()`.
|
|
3841
|
+
*/
|
|
3842
|
+
readonly cause?: string;
|
|
3530
3843
|
});
|
|
3531
3844
|
|
|
3532
3845
|
/**
|
|
@@ -3627,5 +3940,5 @@ interface CreateServerOptions {
|
|
|
3627
3940
|
/** Options for {@link createCollaborative}. @public */
|
|
3628
3941
|
type CreateCollaborativeOptions = CreateServerOptions;
|
|
3629
3942
|
|
|
3630
|
-
export {
|
|
3631
|
-
export type { BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocumentXmlLimits as
|
|
3943
|
+
export { ListItem as $, Alignment as A, DocumentProperties as F, DocxEditorError as J, Field as P, FieldCollection as Q, FieldType as R, Font as T, InlinePicture as V, InlinePictureCollection as W, InsertLocation as X, List as Y, ListBullet as Z, ListCollection as _, ListNumbering as a0, NoteItem as a3, NoteItemCollection as a4, PageOrientation as a6, PageSetup as a7, Paragraph as a8, ShapeType as aA, Table as aB, TableCell as aC, TableCellCollection as aD, TableCollection as aE, TableRow as aF, TableRowCollection as aG, TrackedObjects as aH, UnderlineType as aI, VerticalAlignment as aJ, getReviewItemRange as aK, getReviewItemRangeOrNullObject as aL, getReviewItemRevisions as aM, isDocxEditorError as aN, ParagraphCollection as aa, Range as ae, RangeCollection as af, RangeLocation as ah, RemoveDocInfoType as ai, RequestContext as aj, Revision as ak, RevisionCollection as an, Section as au, SectionCollection as av, Shape as ay, ShapeCollection as az, Body as b, Bookmark as e, BookmarkCollection as f, BreakType as g, ChangeTrackingMode as h, ChangeTrackingVersion as i, ClientObject as j, ClientResult as k, Comment as l, CommentCollection as m, CommentReply as n, CommentReplyCollection as o, ContentControl as q, ContentControlCollection as r, ContentControlType as u, Document as w };
|
|
3944
|
+
export type { BesideLocation as B, CreateServerOptions as C, DocxEditorServerRuntime as D, DocumentPreviewStatus as E, DocumentXmlLimits as G, DocumentZipLimits as H, DocxEditorDebugInfo as I, DocxEditorErrorCode as K, DocxEditorErrorInit as L, DocxEditorInnerError as M, DocxEditorRuntime as N, EditorModule as O, FieldTypeLiteral as S, HeaderFooterType as U, CreateCollaborativeOptions as a, LoadOption as a1, LoadQueryOptions as a2, NoteItemType as a5, ParagraphAlignment as a9, ParagraphInsertTextLocation as ab, ParagraphReadingOrder as ac, PreviewCallback as ad, RangeInsertTextLocation as ag, RevisionAuthorOptions as al, RevisionAuthorSelection as am, RevisionTextView as ao, RevisionType as ap, RunCallback as aq, RunOptions as ar, RuntimeDiagnostic as as, SearchOptions as at, SelectionMode as aw, ServerPaginationOptions as ax, BodyInsertParagraphLocation as c, BodyInsertTextLocation as d, CommitPreviewOptions as p, ContentControlLockState as s, ContentControlSubtype as t, ContentControlValue as v, DocumentCapabilities as x, DocumentLimits as y, DocumentPreview as z };
|