RevisionCollectionNEW
RevisionCollection:
{}Document-root collection for querying and deciding pending revisions.
Remarks
Section titled “Remarks”RevisionCollection is the entry point for programmatic tracked-change
workflows. all() returns pending revisions in document order: body first,
followed by effective headers and footers in revision-engine enumeration
order. Decided revisions leave the collection; there is no status field.
Collection decisions apply directly even inside a review transaction.
Adjudication is not itself tracked. Select by ID, author, paragraph-local
text range, or all pending revisions. A range selects revision IDs whose
anchors overlap the input range on the same text surface; omitting its range
uses the whole TextView.
A deletion hidden by a review transaction has a zero-length anchor and does
not overlap a non-empty range. Select such a revision by item, ID, author,
or { all: true }.
Pass expand: 'contiguous' to use the engine’s contiguity expansion. IDs
added by expansion appear in the returned decided array. Refusals are
returned as data and never throw.
Move revisions do not appear in the collection because DOCX import maps moves to insertion and deletion pairs.
Examples
Section titled “Examples”Inspect and accept all pending insertions from one author:
const revisions = draft.revisions();const insertions = revisions.all({ author: 'Ana', type: 'insertion' });
for (const revision of insertions) { console.log(revision.preview, revision.story, revision.anchors);}
const result = revisions.accept({ ids: insertions.map(({ id }) => id) });console.log(result.decided, result.refused);Accept revisions intersecting a text range and expand to contiguous changes:
const firstBlock = draft.body().content().blocklevels()[0];
if (firstBlock?.type === 'paragraph') { const textView = firstBlock.asTextView(); const match = textView.searchText('review this clause');
if (match) { draft.revisions().accept( { range: { textView, range: match.range } }, { expand: 'contiguous' }, ); }}Methods
Section titled “Methods”all(
options?):Revision[]
Returns pending revisions in document order.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional author, type, and story filters
Returns
Section titled “Returns”Revision[]
Pending revisions matching the query options
Remarks
Section titled “Remarks”Results contain body revisions first, followed by effective headers and footers. Supplied query filters are combined. Decided revisions are absent.
accept()
Section titled “accept()”accept(
selector,options?):RevisionDecisionResult
Accepts the selected pending revisions.
Parameters
Section titled “Parameters”selector
Section titled “selector”Revision IDs, author, text range, or all pending revisions
options?
Section titled “options?”Optional contiguous-expansion behavior
Returns
Section titled “Returns”IDs decided by the operation and any non-throwing refusals
reject()
Section titled “reject()”reject(
selector,options?):RevisionDecisionResult
Rejects the selected pending revisions.
Parameters
Section titled “Parameters”selector
Section titled “selector”Revision IDs, author, text range, or all pending revisions
options?
Section titled “options?”Optional contiguous-expansion behavior
Returns
Section titled “Returns”IDs decided by the operation and any non-throwing refusals