RevisionNEW
Revision:
{}A pending tracked change in the document.
Remarks
Section titled “Remarks”A Revision exposes the imported or transaction-authored metadata for one
pending change. Text revisions include paragraph-local anchors and a preview
formed by concatenating the text of runs carrying the revision ID.
Structural revisions have an empty preview and no anchors.
Anchors use the coordinates of their paragraph’s current text surface. In a review transaction, deleted text is hidden, so a deletion can have a zero-length anchor at its review-visible position. A field’s value is ordinary runs on that surface, so a revision inside one anchors to the text it covers like any other.
withdraw() is mechanically a rejection, but it is permitted only when the
revision author equals the effective transaction author. A transaction
opened with review.author uses that author; otherwise the document author
callback supplies the identity. A different author produces a
not-permitted refusal and leaves the document unchanged.
Example
Section titled “Example”Withdraw a pending suggestion authored by the current reviewer:
const ownSuggestion = draft.revisions().all({ author: 'Bot' })[0];
if (ownSuggestion) { const result = ownSuggestion.withdraw(); console.log(result.decided, result.refused);}Properties
Section titled “Properties”id:
string
Stable identifier for this revision.
type:
RevisionType
Public tracked-change type.
author
Section titled “author”Revision author, or null when the document has no author metadata.
Revision timestamp, or null when the document has no date metadata.
story:
RevisionStory
Document story containing this revision.
preview
Section titled “preview”preview:
string
Concatenated run text carrying this ID, or an empty string for structural revisions.
anchors
Section titled “anchors”anchors:
TextAnchorRange[]
Paragraph-local text ranges carrying this ID, or an empty array for structural revisions.
Methods
Section titled “Methods”accept()
Section titled “accept()”accept(
options?):RevisionDecisionResult
Accepts this revision.
Parameters
Section titled “Parameters”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(
options?):RevisionDecisionResult
Rejects this revision.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional contiguous-expansion behavior
Returns
Section titled “Returns”IDs decided by the operation and any non-throwing refusals
withdraw()
Section titled “withdraw()”withdraw(
options?):RevisionDecisionResult
Withdraws this revision when it belongs to the effective author.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional contiguous-expansion behavior
Returns
Section titled “Returns”IDs decided by the operation and any non-throwing refusals
Remarks
Section titled “Remarks”Withdrawal uses rejection mechanics. An author mismatch returns a
not-permitted refusal and does not mutate the document.