@docx-editor.dev/editor-api 2.2.1 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -4
- package/dist/browser.d.mts +33 -9
- package/dist/browser.d.ts +33 -9
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{server-C3dcanDU.d.mts → server-BaHNZNu1.d.mts} +285 -219
- package/dist/{server-C3dcanDU.d.ts → server-BaHNZNu1.d.ts} +285 -219
- package/package.json +2 -2
|
@@ -234,19 +234,19 @@ declare class Font extends ModelObject {
|
|
|
234
234
|
static of(context: RequestContext, label: string, owner: ObjectPath, kind: SpanOwner): Font;
|
|
235
235
|
private constructor();
|
|
236
236
|
/** Whether every character agrees it is bold, or `null` where they do not. */
|
|
237
|
-
get bold(): boolean;
|
|
237
|
+
get bold(): boolean | null;
|
|
238
238
|
set bold(value: boolean);
|
|
239
239
|
/** Whether every run in range is italic. `null` where they disagree or none says. */
|
|
240
|
-
get italic(): boolean;
|
|
240
|
+
get italic(): boolean | null;
|
|
241
241
|
set italic(value: boolean);
|
|
242
242
|
/** `#RRGGBB`. `null` where the characters disagree, or where the colour is `auto`. */
|
|
243
|
-
get color(): string;
|
|
243
|
+
get color(): string | null;
|
|
244
244
|
set color(value: string);
|
|
245
245
|
/** The typeface name the characters state, or `null` where they do not agree on one. */
|
|
246
|
-
get name(): string;
|
|
246
|
+
get name(): string | null;
|
|
247
247
|
set name(value: string);
|
|
248
248
|
/** Points. */
|
|
249
|
-
get size(): number;
|
|
249
|
+
get size(): number | null;
|
|
250
250
|
set size(value: number);
|
|
251
251
|
/**
|
|
252
252
|
* One read for every property asked for.
|
|
@@ -308,7 +308,13 @@ declare class Bookmark extends ModelObject implements PromisedItem {
|
|
|
308
308
|
* was loaded.
|
|
309
309
|
*/
|
|
310
310
|
get range(): Range;
|
|
311
|
-
/**
|
|
311
|
+
/**
|
|
312
|
+
* Put the reader's selection on the bookmark and navigate the editor viewport to it.
|
|
313
|
+
*
|
|
314
|
+
* The bookmark's current range is resolved as part of the selection, so callers do not need to
|
|
315
|
+
* read {@link Bookmark.range} first. `Start` and `End` collapse to that endpoint. Refused with
|
|
316
|
+
* `NotSupported` where there is no reader.
|
|
317
|
+
*/
|
|
312
318
|
select(selectionMode_?: SelectionMode): void;
|
|
313
319
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
314
320
|
protected onLoad(request: ResolvedLoadOptions): void;
|
|
@@ -334,6 +340,219 @@ declare class BookmarkCollection extends HandleCollection<Bookmark> {
|
|
|
334
340
|
protected promised(label: string, nullable: boolean): Bookmark & PromisedItem;
|
|
335
341
|
}
|
|
336
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Word's own names for a kind of change.
|
|
345
|
+
*
|
|
346
|
+
* The WHOLE upstream vocabulary, because a declaration says what a caller may be handed and a caller
|
|
347
|
+
* switching on it should not have to be told which subset this engine happens to produce. Seven of
|
|
348
|
+
* these actually occur — insert, delete, replace, the two property kinds and the two move halves —
|
|
349
|
+
* because a change to a row, a cell or a section is structural, and this engine reports only the
|
|
350
|
+
* changes it can also accept or reject. See `compat/manifest.json`.
|
|
351
|
+
*/
|
|
352
|
+
type RevisionType = 'None' | 'Insert' | 'Delete' | 'Property' | 'ParagraphNumber' | 'DisplayField' | 'Reconcile' | 'Conflict' | 'Style' | 'Replace' | 'ParagraphProperty' | 'TableProperty' | 'SectionProperty' | 'StyleDefinition' | 'MovedFrom' | 'MovedTo' | 'CellInsertion' | 'CellDeletion' | 'CellMerge' | 'CellSplit' | 'ConflictInsert' | 'ConflictDelete';
|
|
353
|
+
/** What a comment and a reply both are: an author, a date, an id and a body. */
|
|
354
|
+
declare abstract class CommentBase extends ModelObject implements PromisedItem {
|
|
355
|
+
/** @internal Bind this object to the address the owning read answered. */
|
|
356
|
+
hydrateAddress(address: ObjectAddress): void;
|
|
357
|
+
/** @internal Settle as the null object: the read found nothing to name. */
|
|
358
|
+
hydrateNull(): void;
|
|
359
|
+
/** Who wrote it. Always present: `CT_TrackChange` makes the author mandatory. */
|
|
360
|
+
get authorName(): string;
|
|
361
|
+
/** When it was written, or `null` where the file recorded no valid date. */
|
|
362
|
+
get creationDate(): Date | null;
|
|
363
|
+
/** The document's own id for it (`w:id` in the comments part). */
|
|
364
|
+
get id(): string;
|
|
365
|
+
/**
|
|
366
|
+
* What it says, as plain text.
|
|
367
|
+
*
|
|
368
|
+
* DocxEditor's own member rather than upstream's `content`: upstream declares that one writable,
|
|
369
|
+
* and rewriting a comment body is not an operation this engine offers, so publishing a read-only
|
|
370
|
+
* `content` under the same name would be a quieter divergence than a differently named read.
|
|
371
|
+
*/
|
|
372
|
+
get text(): string;
|
|
373
|
+
/**
|
|
374
|
+
* Delete this comment object.
|
|
375
|
+
*
|
|
376
|
+
* On a top-level comment this removes the whole thread and its anchors. On a reply it removes
|
|
377
|
+
* only that reply, preserving the parent and siblings. Several deletes queued before one
|
|
378
|
+
* `sync()` commit atomically as one undo unit.
|
|
379
|
+
*/
|
|
380
|
+
delete(): void;
|
|
381
|
+
protected loadCommentFields(request: ResolvedLoadOptions, extra: readonly string[]): void;
|
|
382
|
+
protected commentHandle(): AutomationHandle;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* One answer in a comment thread.
|
|
386
|
+
*
|
|
387
|
+
* Authored over the parent comment's own range, because that is where the conversation is
|
|
388
|
+
* anchored and OOXML gives a reply no other place to be. Resolving is a property of the whole
|
|
389
|
+
* thread rather than of any one reply — see {@link Comment.resolved}.
|
|
390
|
+
*
|
|
391
|
+
* @public
|
|
392
|
+
*/
|
|
393
|
+
declare class CommentReply extends CommentBase {
|
|
394
|
+
/** @internal A reply a read has already named. */
|
|
395
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): CommentReply;
|
|
396
|
+
/** @internal A reply a queued operation will name, or report as nothing. */
|
|
397
|
+
static promised(context: RequestContext, label: string, nullable: boolean): CommentReply;
|
|
398
|
+
private constructor();
|
|
399
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
400
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* The replies to one comment, in thread order, as of the batch that loaded them.
|
|
404
|
+
*
|
|
405
|
+
* @public
|
|
406
|
+
*/
|
|
407
|
+
declare class CommentReplyCollection extends HandleCollection<CommentReply> {
|
|
408
|
+
#private;
|
|
409
|
+
/** @internal The replies to one comment, in document order. */
|
|
410
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, plan: () => AutomationOperation): CommentReplyCollection;
|
|
411
|
+
private constructor();
|
|
412
|
+
/** The first reply. `ItemNotFound` at the sync if nobody answered. */
|
|
413
|
+
getFirst(): CommentReply;
|
|
414
|
+
/** @internal The read that answers this collection's members. */
|
|
415
|
+
protected listing(): AutomationOperation;
|
|
416
|
+
/** @internal Build one member from an address the listing answered. */
|
|
417
|
+
protected itemAt(label: string, address: ObjectAddress): CommentReply;
|
|
418
|
+
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
419
|
+
protected promised(label: string, nullable: boolean): CommentReply & PromisedItem;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* A comment: a conversation about a stretch of the document, not a single remark.
|
|
423
|
+
*
|
|
424
|
+
* {@link Comment.replies} holds the answers, and resolving is a property of the whole thread —
|
|
425
|
+
* assigning `resolved` marks this comment and everything answering it, which is what Word's own
|
|
426
|
+
* pane does.
|
|
427
|
+
*
|
|
428
|
+
* `authorEmail` and a writable `content` are absent: `CT_Comment` records only an author and
|
|
429
|
+
* initials (Word's addresses live in `people.xml`, which this API does not read), and a body
|
|
430
|
+
* rewrite is not an operation the canonical write path offers. The comment's text is published
|
|
431
|
+
* as `text`.
|
|
432
|
+
*
|
|
433
|
+
* @public
|
|
434
|
+
*/
|
|
435
|
+
declare class Comment extends CommentBase {
|
|
436
|
+
#private;
|
|
437
|
+
/** @internal A comment a read has already named. */
|
|
438
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): Comment;
|
|
439
|
+
/** @internal A comment a queued operation will name, or report as nothing. */
|
|
440
|
+
static promised(context: RequestContext, label: string, nullable: boolean): Comment;
|
|
441
|
+
private constructor();
|
|
442
|
+
/**
|
|
443
|
+
* Whether the thread is resolved.
|
|
444
|
+
*
|
|
445
|
+
* Assigning it resolves or reopens the WHOLE thread — this comment and its replies — because that
|
|
446
|
+
* is what resolving a conversation means, and marking the parent alone would leave a reply reading
|
|
447
|
+
* as open under a closed remark.
|
|
448
|
+
*/
|
|
449
|
+
get resolved(): boolean;
|
|
450
|
+
set resolved(value: boolean);
|
|
451
|
+
/** The answers to this comment, in document order. */
|
|
452
|
+
get replies(): CommentReplyCollection;
|
|
453
|
+
/** The words the comment is about. */
|
|
454
|
+
getRange(): Range;
|
|
455
|
+
/**
|
|
456
|
+
* Answer the comment, over the same words it is anchored to.
|
|
457
|
+
*
|
|
458
|
+
* The author is the one the request context was opened with: a reply records who wrote it, and
|
|
459
|
+
* `CT_TrackChange` makes that mandatory, so a context with no author refuses here rather than
|
|
460
|
+
* writing an anonymous remark the file cannot represent.
|
|
461
|
+
*/
|
|
462
|
+
reply(replyText: string): CommentReply;
|
|
463
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
464
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* The comments on a document, story or range, as of the batch that loaded them.
|
|
468
|
+
*
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
471
|
+
declare class CommentCollection extends HandleCollection<Comment> {
|
|
472
|
+
#private;
|
|
473
|
+
/** @internal The comments of a scope: a whole story's, or the ones a range overlaps. */
|
|
474
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, plan: () => AutomationOperation): CommentCollection;
|
|
475
|
+
private constructor();
|
|
476
|
+
/** The first comment. `ItemNotFound` at the sync if there are none. */
|
|
477
|
+
getFirst(): Comment;
|
|
478
|
+
/** @internal The read that answers this collection's members. */
|
|
479
|
+
protected listing(): AutomationOperation;
|
|
480
|
+
/** @internal Build one member from an address the listing answered. */
|
|
481
|
+
protected itemAt(label: string, address: ObjectAddress): Comment;
|
|
482
|
+
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
483
|
+
protected promised(label: string, nullable: boolean): Comment & PromisedItem;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* One tracked change, and a decision the engine can act on.
|
|
487
|
+
*
|
|
488
|
+
* Only revisions the engine can actually resolve are answered as objects. Structural ones — a
|
|
489
|
+
* row, a cell, a section, the table grid — are omitted from the collection entirely rather than
|
|
490
|
+
* shipped as objects whose `accept` and `reject` both refuse: code walking the collection would
|
|
491
|
+
* stall on such an item with nothing to read that explains why.
|
|
492
|
+
*
|
|
493
|
+
* @public
|
|
494
|
+
*/
|
|
495
|
+
declare class Revision extends ModelObject implements PromisedItem {
|
|
496
|
+
#private;
|
|
497
|
+
/** @internal A change a read has already named. */
|
|
498
|
+
static at(context: RequestContext, label: string, address: ObjectAddress): Revision;
|
|
499
|
+
/** @internal A change a queued read will name, or report as nothing. */
|
|
500
|
+
static promised(context: RequestContext, label: string, nullable: boolean): Revision;
|
|
501
|
+
private constructor();
|
|
502
|
+
/** @internal Bind this object to the address the owning read answered. */
|
|
503
|
+
hydrateAddress(address: ObjectAddress): void;
|
|
504
|
+
/** @internal Settle as the null object: the read found nothing to name. */
|
|
505
|
+
hydrateNull(): void;
|
|
506
|
+
/** Who proposed the change. */
|
|
507
|
+
get author(): string;
|
|
508
|
+
/** When they proposed it, or `null` where the file recorded no valid date. */
|
|
509
|
+
get date(): Date | null;
|
|
510
|
+
/** What kind of change it is, by Word's own name for it. */
|
|
511
|
+
get type(): RevisionType;
|
|
512
|
+
/** The words the change covers. */
|
|
513
|
+
get range(): Range;
|
|
514
|
+
/** Keep the change, resolving every site that carries its identity in one transaction. */
|
|
515
|
+
accept(): void;
|
|
516
|
+
/** Undo the change, likewise in one transaction. */
|
|
517
|
+
reject(): void;
|
|
518
|
+
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
519
|
+
protected onLoad(request: ResolvedLoadOptions): void;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* The tracked changes on a document, story or range, as of the batch that loaded them.
|
|
523
|
+
*
|
|
524
|
+
* Carries only the revisions the engine can resolve; see {@link Revision} for what is left out
|
|
525
|
+
* and why.
|
|
526
|
+
*
|
|
527
|
+
* @public
|
|
528
|
+
*/
|
|
529
|
+
declare class RevisionCollection extends HandleCollection<Revision> {
|
|
530
|
+
#private;
|
|
531
|
+
/** @internal The pending decisions of one story. */
|
|
532
|
+
static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle, document: AutomationHandle): RevisionCollection;
|
|
533
|
+
private constructor();
|
|
534
|
+
/**
|
|
535
|
+
* Keep every change, as ONE decision and one undo unit.
|
|
536
|
+
*
|
|
537
|
+
* The engine's own whole-document operation rather than a loop over `accept`: a reviewer who
|
|
538
|
+
* accepted a document's changes made one decision, and one undo should take all of them back. It
|
|
539
|
+
* refuses outright where the document holds a change the engine cannot resolve, which is the
|
|
540
|
+
* honest answer — accepting the rest would report a document as reviewed while it still carries
|
|
541
|
+
* pending changes.
|
|
542
|
+
*/
|
|
543
|
+
acceptAll(): void;
|
|
544
|
+
/** Undo every change, likewise as one decision. */
|
|
545
|
+
rejectAll(): void;
|
|
546
|
+
/** @internal The read that answers this collection's members. */
|
|
547
|
+
protected listing(): AutomationOperation;
|
|
548
|
+
/** @internal Build one member from an address the listing answered. */
|
|
549
|
+
protected itemAt(label: string, address: ObjectAddress): Revision;
|
|
550
|
+
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
551
|
+
protected promised(label: string, nullable: boolean): Revision & PromisedItem;
|
|
552
|
+
/** A collection is a `ClientObject` rather than a `ModelObject`, so it queues its own writes. */
|
|
553
|
+
private commandOn;
|
|
554
|
+
}
|
|
555
|
+
|
|
337
556
|
/**
|
|
338
557
|
* How a search is narrowed.
|
|
339
558
|
*
|
|
@@ -435,14 +654,27 @@ declare class Range extends ModelObject implements PromisedItem {
|
|
|
435
654
|
* gets back is a range naming the text that was written, in every case.
|
|
436
655
|
*/
|
|
437
656
|
insertText(text: string, insertLocation: 'Replace' | 'Start' | 'End' | 'Before' | 'After'): Range;
|
|
657
|
+
/**
|
|
658
|
+
* Create a top-level comment anchored to exactly this range.
|
|
659
|
+
*
|
|
660
|
+
* The author is the identity the runtime was opened with. Empty comment text, a missing author,
|
|
661
|
+
* stale endpoints, and ranges crossing a table-cell boundary are refused rather than authored
|
|
662
|
+
* approximately. A collapsed range creates an insertion-point comment.
|
|
663
|
+
*/
|
|
664
|
+
insertComment(commentText: string): Comment;
|
|
438
665
|
/** Add a paragraph before or after the one this range starts or ends in. */
|
|
439
666
|
insertParagraph(paragraphText: string, insertLocation: 'Before' | 'After'): Paragraph;
|
|
440
667
|
/**
|
|
441
|
-
* Put the reader's selection on this range.
|
|
668
|
+
* Put the reader's selection on this range and navigate the editor viewport to it.
|
|
669
|
+
*
|
|
670
|
+
* The whole range is selected by default. `Start` and `End` instead collapse the caret to that
|
|
671
|
+
* endpoint and reveal it. An already-visible endpoint stays still; an offscreen one is brought
|
|
672
|
+
* into view from the editor's layout, including when its page has not been materialized yet.
|
|
442
673
|
*
|
|
443
674
|
* Refused with `NotSupported` where there is no reader — a document opened from bytes on a
|
|
444
|
-
* server has no caret, and moving one would be a claim about a screen nobody is
|
|
445
|
-
* check is at the CALL rather than at the sync, so the mistake is reported where
|
|
675
|
+
* server has no caret or viewport, and moving one would be a claim about a screen nobody is
|
|
676
|
+
* looking at. The check is at the CALL rather than at the sync, so the mistake is reported where
|
|
677
|
+
* it was made.
|
|
446
678
|
*/
|
|
447
679
|
select(selectionMode_?: SelectionMode): void;
|
|
448
680
|
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
@@ -710,6 +942,15 @@ declare class ContentControl extends ModelObject implements PromisedItem {
|
|
|
710
942
|
set title(value: string);
|
|
711
943
|
/** What kind of control it is: `plainText`, `dropDownList`, `checkbox`, `date`, … */
|
|
712
944
|
get subtype(): string;
|
|
945
|
+
/**
|
|
946
|
+
* Whether the control currently declares an OOXML data binding.
|
|
947
|
+
*
|
|
948
|
+
* This is advisory preflight for callers choosing controls to write. A document can change
|
|
949
|
+
* after this property is loaded, so the atomic sync-time refusal remains the final authority.
|
|
950
|
+
* Only binding presence is exposed: XPath, namespace mappings, store ids, and custom XML
|
|
951
|
+
* content remain inside the untrusted-document boundary.
|
|
952
|
+
*/
|
|
953
|
+
get isBound(): boolean;
|
|
713
954
|
/**
|
|
714
955
|
* Whether the control refuses to be deleted.
|
|
715
956
|
*
|
|
@@ -750,7 +991,9 @@ declare class ContentControl extends ModelObject implements PromisedItem {
|
|
|
750
991
|
*
|
|
751
992
|
* The refusals belong to the document, not to this method: a locked control, a control the file
|
|
752
993
|
* bound to custom XML, and a value the control's type does not accept are all refused by the
|
|
753
|
-
* engine's single write path, which is the same path a keystroke takes.
|
|
994
|
+
* engine's single write path, which is the same path a keystroke takes. {@link isBound} is an
|
|
995
|
+
* advisory preflight only; this sync-time check remains authoritative if the document changed
|
|
996
|
+
* after the flag was loaded.
|
|
754
997
|
*/
|
|
755
998
|
setValue(value: ContentControlValue): void;
|
|
756
999
|
/**
|
|
@@ -844,6 +1087,14 @@ declare class NoteItem extends ModelObject implements PromisedItem {
|
|
|
844
1087
|
hydrateNull(): void;
|
|
845
1088
|
/** Whether this is a footnote or an endnote. */
|
|
846
1089
|
get type(): NoteItemType;
|
|
1090
|
+
/**
|
|
1091
|
+
* The note's plain text.
|
|
1092
|
+
*
|
|
1093
|
+
* This is the same value as loading `text` from {@link NoteItem.body}: every paragraph in the
|
|
1094
|
+
* note story, in reading order, joined by one carriage return per paragraph mark. Load it
|
|
1095
|
+
* directly when structured traversal or editing through {@link NoteItem.body} is not needed.
|
|
1096
|
+
*/
|
|
1097
|
+
get text(): string;
|
|
847
1098
|
/** The note's own story. */
|
|
848
1099
|
get body(): Body;
|
|
849
1100
|
/**
|
|
@@ -881,211 +1132,6 @@ declare class NoteItemCollection extends HandleCollection<NoteItem> {
|
|
|
881
1132
|
protected promised(label: string, nullable: boolean): NoteItem & PromisedItem;
|
|
882
1133
|
}
|
|
883
1134
|
|
|
884
|
-
/**
|
|
885
|
-
* Word's own names for a kind of change.
|
|
886
|
-
*
|
|
887
|
-
* The WHOLE upstream vocabulary, because a declaration says what a caller may be handed and a caller
|
|
888
|
-
* switching on it should not have to be told which subset this engine happens to produce. Seven of
|
|
889
|
-
* these actually occur — insert, delete, replace, the two property kinds and the two move halves —
|
|
890
|
-
* because a change to a row, a cell or a section is structural, and this engine reports only the
|
|
891
|
-
* changes it can also accept or reject. See `compat/manifest.json`.
|
|
892
|
-
*/
|
|
893
|
-
type RevisionType = 'None' | 'Insert' | 'Delete' | 'Property' | 'ParagraphNumber' | 'DisplayField' | 'Reconcile' | 'Conflict' | 'Style' | 'Replace' | 'ParagraphProperty' | 'TableProperty' | 'SectionProperty' | 'StyleDefinition' | 'MovedFrom' | 'MovedTo' | 'CellInsertion' | 'CellDeletion' | 'CellMerge' | 'CellSplit' | 'ConflictInsert' | 'ConflictDelete';
|
|
894
|
-
/** What a comment and a reply both are: an author, a date, an id and a body. */
|
|
895
|
-
declare abstract class CommentBase extends ModelObject implements PromisedItem {
|
|
896
|
-
/** @internal Bind this object to the address the owning read answered. */
|
|
897
|
-
hydrateAddress(address: ObjectAddress): void;
|
|
898
|
-
/** @internal Settle as the null object: the read found nothing to name. */
|
|
899
|
-
hydrateNull(): void;
|
|
900
|
-
/** Who wrote it. Always present: `CT_TrackChange` makes the author mandatory. */
|
|
901
|
-
get authorName(): string;
|
|
902
|
-
/** When it was written, or `null` where the file recorded no date. */
|
|
903
|
-
get creationDate(): Date;
|
|
904
|
-
/** The document's own id for it (`w:id` in the comments part). */
|
|
905
|
-
get id(): string;
|
|
906
|
-
/**
|
|
907
|
-
* What it says, as plain text.
|
|
908
|
-
*
|
|
909
|
-
* DocxEditor's own member rather than upstream's `content`: upstream declares that one writable,
|
|
910
|
-
* and rewriting a comment body is not an operation this engine offers, so publishing a read-only
|
|
911
|
-
* `content` under the same name would be a quieter divergence than a differently named read.
|
|
912
|
-
*/
|
|
913
|
-
get text(): string;
|
|
914
|
-
protected loadCommentFields(request: ResolvedLoadOptions, extra: readonly string[]): void;
|
|
915
|
-
protected commentHandle(): AutomationHandle;
|
|
916
|
-
}
|
|
917
|
-
/**
|
|
918
|
-
* One answer in a comment thread.
|
|
919
|
-
*
|
|
920
|
-
* Authored over the parent comment's own range, because that is where the conversation is
|
|
921
|
-
* anchored and OOXML gives a reply no other place to be. Resolving is a property of the whole
|
|
922
|
-
* thread rather than of any one reply — see {@link Comment.resolved}.
|
|
923
|
-
*
|
|
924
|
-
* @public
|
|
925
|
-
*/
|
|
926
|
-
declare class CommentReply extends CommentBase {
|
|
927
|
-
/** @internal A reply a read has already named. */
|
|
928
|
-
static at(context: RequestContext, label: string, address: ObjectAddress): CommentReply;
|
|
929
|
-
/** @internal A reply a queued operation will name, or report as nothing. */
|
|
930
|
-
static promised(context: RequestContext, label: string, nullable: boolean): CommentReply;
|
|
931
|
-
private constructor();
|
|
932
|
-
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
933
|
-
protected onLoad(request: ResolvedLoadOptions): void;
|
|
934
|
-
}
|
|
935
|
-
/**
|
|
936
|
-
* The replies to one comment, in thread order, as of the batch that loaded them.
|
|
937
|
-
*
|
|
938
|
-
* @public
|
|
939
|
-
*/
|
|
940
|
-
declare class CommentReplyCollection extends HandleCollection<CommentReply> {
|
|
941
|
-
#private;
|
|
942
|
-
/** @internal The replies to one comment, in document order. */
|
|
943
|
-
static of(context: RequestContext, label: string, owner: ObjectPath, plan: () => AutomationOperation): CommentReplyCollection;
|
|
944
|
-
private constructor();
|
|
945
|
-
/** The first reply. `ItemNotFound` at the sync if nobody answered. */
|
|
946
|
-
getFirst(): CommentReply;
|
|
947
|
-
/** @internal The read that answers this collection's members. */
|
|
948
|
-
protected listing(): AutomationOperation;
|
|
949
|
-
/** @internal Build one member from an address the listing answered. */
|
|
950
|
-
protected itemAt(label: string, address: ObjectAddress): CommentReply;
|
|
951
|
-
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
952
|
-
protected promised(label: string, nullable: boolean): CommentReply & PromisedItem;
|
|
953
|
-
}
|
|
954
|
-
/**
|
|
955
|
-
* A comment: a conversation about a stretch of the document, not a single remark.
|
|
956
|
-
*
|
|
957
|
-
* {@link Comment.replies} holds the answers, and resolving is a property of the whole thread —
|
|
958
|
-
* assigning `resolved` marks this comment and everything answering it, which is what Word's own
|
|
959
|
-
* pane does.
|
|
960
|
-
*
|
|
961
|
-
* `authorEmail`, a writable `content`, and `delete` are absent: `CT_Comment` records only an
|
|
962
|
-
* author and initials (Word's addresses live in `people.xml`, which this API does not read), and
|
|
963
|
-
* neither a body rewrite nor a marker-pair removal is an operation the canonical write path
|
|
964
|
-
* offers. The comment's text is published as `text`.
|
|
965
|
-
*
|
|
966
|
-
* @public
|
|
967
|
-
*/
|
|
968
|
-
declare class Comment extends CommentBase {
|
|
969
|
-
#private;
|
|
970
|
-
/** @internal A comment a read has already named. */
|
|
971
|
-
static at(context: RequestContext, label: string, address: ObjectAddress): Comment;
|
|
972
|
-
/** @internal A comment a queued operation will name, or report as nothing. */
|
|
973
|
-
static promised(context: RequestContext, label: string, nullable: boolean): Comment;
|
|
974
|
-
private constructor();
|
|
975
|
-
/**
|
|
976
|
-
* Whether the thread is resolved.
|
|
977
|
-
*
|
|
978
|
-
* Assigning it resolves or reopens the WHOLE thread — this comment and its replies — because that
|
|
979
|
-
* is what resolving a conversation means, and marking the parent alone would leave a reply reading
|
|
980
|
-
* as open under a closed remark.
|
|
981
|
-
*/
|
|
982
|
-
get resolved(): boolean;
|
|
983
|
-
set resolved(value: boolean);
|
|
984
|
-
/** The answers to this comment, in document order. */
|
|
985
|
-
get replies(): CommentReplyCollection;
|
|
986
|
-
/** The words the comment is about. */
|
|
987
|
-
getRange(): Range;
|
|
988
|
-
/**
|
|
989
|
-
* Answer the comment, over the same words it is anchored to.
|
|
990
|
-
*
|
|
991
|
-
* The author is the one the request context was opened with: a reply records who wrote it, and
|
|
992
|
-
* `CT_TrackChange` makes that mandatory, so a context with no author refuses here rather than
|
|
993
|
-
* writing an anonymous remark the file cannot represent.
|
|
994
|
-
*/
|
|
995
|
-
reply(replyText: string): CommentReply;
|
|
996
|
-
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
997
|
-
protected onLoad(request: ResolvedLoadOptions): void;
|
|
998
|
-
}
|
|
999
|
-
/**
|
|
1000
|
-
* The comments on a document, story or range, as of the batch that loaded them.
|
|
1001
|
-
*
|
|
1002
|
-
* @public
|
|
1003
|
-
*/
|
|
1004
|
-
declare class CommentCollection extends HandleCollection<Comment> {
|
|
1005
|
-
#private;
|
|
1006
|
-
/** @internal The comments of a scope: a whole story's, or the ones a range overlaps. */
|
|
1007
|
-
static of(context: RequestContext, label: string, owner: ObjectPath, plan: () => AutomationOperation): CommentCollection;
|
|
1008
|
-
private constructor();
|
|
1009
|
-
/** The first comment. `ItemNotFound` at the sync if there are none. */
|
|
1010
|
-
getFirst(): Comment;
|
|
1011
|
-
/** @internal The read that answers this collection's members. */
|
|
1012
|
-
protected listing(): AutomationOperation;
|
|
1013
|
-
/** @internal Build one member from an address the listing answered. */
|
|
1014
|
-
protected itemAt(label: string, address: ObjectAddress): Comment;
|
|
1015
|
-
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
1016
|
-
protected promised(label: string, nullable: boolean): Comment & PromisedItem;
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* One tracked change, and a decision the engine can act on.
|
|
1020
|
-
*
|
|
1021
|
-
* Only revisions the engine can actually resolve are answered as objects. Structural ones — a
|
|
1022
|
-
* row, a cell, a section, the table grid — are omitted from the collection entirely rather than
|
|
1023
|
-
* shipped as objects whose `accept` and `reject` both refuse: code walking the collection would
|
|
1024
|
-
* stall on such an item with nothing to read that explains why.
|
|
1025
|
-
*
|
|
1026
|
-
* @public
|
|
1027
|
-
*/
|
|
1028
|
-
declare class Revision extends ModelObject implements PromisedItem {
|
|
1029
|
-
#private;
|
|
1030
|
-
/** @internal A change a read has already named. */
|
|
1031
|
-
static at(context: RequestContext, label: string, address: ObjectAddress): Revision;
|
|
1032
|
-
/** @internal A change a queued read will name, or report as nothing. */
|
|
1033
|
-
static promised(context: RequestContext, label: string, nullable: boolean): Revision;
|
|
1034
|
-
private constructor();
|
|
1035
|
-
/** @internal Bind this object to the address the owning read answered. */
|
|
1036
|
-
hydrateAddress(address: ObjectAddress): void;
|
|
1037
|
-
/** @internal Settle as the null object: the read found nothing to name. */
|
|
1038
|
-
hydrateNull(): void;
|
|
1039
|
-
/** Who proposed the change. */
|
|
1040
|
-
get author(): string;
|
|
1041
|
-
/** When they proposed it, or `null` where the file recorded no date. */
|
|
1042
|
-
get date(): Date;
|
|
1043
|
-
/** What kind of change it is, by Word's own name for it. */
|
|
1044
|
-
get type(): RevisionType;
|
|
1045
|
-
/** The words the change covers. */
|
|
1046
|
-
get range(): Range;
|
|
1047
|
-
/** Keep the change, resolving every site that carries its identity in one transaction. */
|
|
1048
|
-
accept(): void;
|
|
1049
|
-
/** Undo the change, likewise in one transaction. */
|
|
1050
|
-
reject(): void;
|
|
1051
|
-
/** @internal Plan the read this object's `load(...)` asked for. */
|
|
1052
|
-
protected onLoad(request: ResolvedLoadOptions): void;
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* The tracked changes on a document, story or range, as of the batch that loaded them.
|
|
1056
|
-
*
|
|
1057
|
-
* Carries only the revisions the engine can resolve; see {@link Revision} for what is left out
|
|
1058
|
-
* and why.
|
|
1059
|
-
*
|
|
1060
|
-
* @public
|
|
1061
|
-
*/
|
|
1062
|
-
declare class RevisionCollection extends HandleCollection<Revision> {
|
|
1063
|
-
#private;
|
|
1064
|
-
/** @internal The pending decisions of one story. */
|
|
1065
|
-
static of(context: RequestContext, label: string, owner: ObjectPath, body: AutomationHandle, document: AutomationHandle): RevisionCollection;
|
|
1066
|
-
private constructor();
|
|
1067
|
-
/**
|
|
1068
|
-
* Keep every change, as ONE decision and one undo unit.
|
|
1069
|
-
*
|
|
1070
|
-
* The engine's own whole-document operation rather than a loop over `accept`: a reviewer who
|
|
1071
|
-
* accepted a document's changes made one decision, and one undo should take all of them back. It
|
|
1072
|
-
* refuses outright where the document holds a change the engine cannot resolve, which is the
|
|
1073
|
-
* honest answer — accepting the rest would report a document as reviewed while it still carries
|
|
1074
|
-
* pending changes.
|
|
1075
|
-
*/
|
|
1076
|
-
acceptAll(): void;
|
|
1077
|
-
/** Undo every change, likewise as one decision. */
|
|
1078
|
-
rejectAll(): void;
|
|
1079
|
-
/** @internal The read that answers this collection's members. */
|
|
1080
|
-
protected listing(): AutomationOperation;
|
|
1081
|
-
/** @internal Build one member from an address the listing answered. */
|
|
1082
|
-
protected itemAt(label: string, address: ObjectAddress): Revision;
|
|
1083
|
-
/** @internal A member an edge accessor named before the sync that finds it. */
|
|
1084
|
-
protected promised(label: string, nullable: boolean): Revision & PromisedItem;
|
|
1085
|
-
/** A collection is a `ClientObject` rather than a `ModelObject`, so it queues its own writes. */
|
|
1086
|
-
private commandOn;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
1135
|
/**
|
|
1090
1136
|
* Which way round a page is, in Word's own spelling.
|
|
1091
1137
|
*
|
|
@@ -1215,12 +1261,19 @@ declare class SectionCollection extends HandleCollection<Section> {
|
|
|
1215
1261
|
* ```ts
|
|
1216
1262
|
* await runtime.run(async (context) => {
|
|
1217
1263
|
* const paragraphs = context.document.paragraphs;
|
|
1218
|
-
* paragraphs.load('
|
|
1264
|
+
* paragraphs.load('items');
|
|
1265
|
+
* await context.sync();
|
|
1266
|
+
*
|
|
1267
|
+
* for (const paragraph of paragraphs.items) paragraph.load('text');
|
|
1219
1268
|
* await context.sync();
|
|
1269
|
+
*
|
|
1220
1270
|
* for (const paragraph of paragraphs.items) console.log(paragraph.text);
|
|
1221
1271
|
* });
|
|
1222
1272
|
* ```
|
|
1223
1273
|
*
|
|
1274
|
+
* The first sync retrieves the collection's items. Once those items are available, the second
|
|
1275
|
+
* sync retrieves each paragraph's text.
|
|
1276
|
+
*
|
|
1224
1277
|
* @public
|
|
1225
1278
|
*/
|
|
1226
1279
|
declare class Document extends ModelObject {
|
|
@@ -1484,7 +1537,10 @@ interface RuntimeManagedObject {
|
|
|
1484
1537
|
interface LoadQueryOptions {
|
|
1485
1538
|
/** Which properties to load. */
|
|
1486
1539
|
readonly select?: string | readonly string[];
|
|
1487
|
-
/**
|
|
1540
|
+
/**
|
|
1541
|
+
* Reserved for Office.js source compatibility. Navigation-property expansion is not supported
|
|
1542
|
+
* yet: a non-empty value is refused as `InvalidArgument`. Omit it or pass an empty array.
|
|
1543
|
+
*/
|
|
1488
1544
|
readonly expand?: string | readonly string[];
|
|
1489
1545
|
/** For a collection: at most this many items. */
|
|
1490
1546
|
readonly top?: number;
|
|
@@ -1499,16 +1555,18 @@ interface LoadQueryOptions {
|
|
|
1499
1555
|
* ```ts
|
|
1500
1556
|
* paragraph.load('text');
|
|
1501
1557
|
* paragraph.load(['text', 'style']);
|
|
1502
|
-
* paragraphs.load({ select:
|
|
1558
|
+
* paragraphs.load({ select: 'items', top: 5 });
|
|
1503
1559
|
* ```
|
|
1504
1560
|
*
|
|
1561
|
+
* Collections load their `items`; properties such as `text` are loaded on each item after the
|
|
1562
|
+
* collection has been synced.
|
|
1563
|
+
*
|
|
1505
1564
|
* @public
|
|
1506
1565
|
*/
|
|
1507
1566
|
type LoadOption = string | readonly string[] | LoadQueryOptions;
|
|
1508
1567
|
interface ResolvedLoadOptions {
|
|
1509
1568
|
/** Selected property names. Empty means "this object's default set". */
|
|
1510
1569
|
readonly select: readonly string[];
|
|
1511
|
-
readonly expand: readonly string[];
|
|
1512
1570
|
readonly top?: number;
|
|
1513
1571
|
readonly skip?: number;
|
|
1514
1572
|
}
|
|
@@ -1867,6 +1925,14 @@ declare class Body extends ModelObject {
|
|
|
1867
1925
|
get text(): string;
|
|
1868
1926
|
/** Every paragraph in this story in reading order, at every depth. */
|
|
1869
1927
|
get paragraphs(): ParagraphCollection;
|
|
1928
|
+
/**
|
|
1929
|
+
* Every bookmark declared in this story, in document order.
|
|
1930
|
+
*
|
|
1931
|
+
* This is story-scoped: `document.body.bookmarks` covers only the main body story. A header,
|
|
1932
|
+
* footer or note body answers its own bookmarks through that body's accessor; this collection
|
|
1933
|
+
* does not aggregate bookmarks from other stories.
|
|
1934
|
+
*/
|
|
1935
|
+
get bookmarks(): BookmarkCollection;
|
|
1870
1936
|
/** The character formatting of the whole story: what all of it agrees on, and what a write sets. */
|
|
1871
1937
|
get font(): Font;
|
|
1872
1938
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/editor-api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Document automation for DOCX: a batching object model that drives a document from a server or from an editor already open in a page",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@docx-editor.dev/core": "^2.
|
|
76
|
+
"@docx-editor.dev/core": "^2.3.1"
|
|
77
77
|
}
|
|
78
78
|
}
|