DS Server

TrackedChange Object

Object|Introduced in 28.0

Description

A TrackedChange object represents a change made to the document after anyone has revised the document. After tracking changes has been turned on with the setIsTrackChangesEnabled method, a TextControl marks up new changes made to the document. Every change is represented through a TrackedChange object, all of these objects are contained in the TrackedChangeCollection which can be obtained with the trackedChanges property.

Syntax

TrackedChange

Examples

The following example demonstrates TrackedChange in a practical document-editing workflow. A TrackedChange object represents a change made to the document after anyone has revised the document. After tracking changes has been turned on with the setIsTrackChangesEnabled method, a TextControl marks up new changes made to the document. Every change is represented through a TrackedChange object, all of these objects are contained in the TrackedChangeCollection which can be obtained with the trackedChanges property.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

TXTextControl.textParts.getMainText(function(mainText) {
    const trackedChanges = mainText.trackedChanges;
    trackedChanges.getItem(function(trackedChange) {
        if (!trackedChange) {
            console.warn("No tracked change is available at the current input position.");
            return;
        }
    
        trackedChange.getText(
            function(result) {
                console.log("get text result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);

Members

Methods

MethodDescription
getActiveGets a value specifying whether the TrackedChange is currently active or not.
getChangeKindGets the kind of change.
getChangeTimeGets the date and time when the change has been made.
getHighlightColorGets the highlight color for the tracked change.
getHighlightModeGets a value indicating whether the tracked change is highlighted.
getLengthGets the number of changed characters.
getNumberGets the change's number.
getStartGets the index (one-based) of the first changed character.
getTextGets the changed text.
getUserNameGets the name of the user who has done the change.
saveSaves the tracked change in a certain format and sends the result back asynchronously by calling a given callback function.
setActiveSets a value specifying whether the TrackedChange is currently active or not.
setHighlightColorSets the highlight color for the tracked change.
setHighlightModeSets a value indicating whether the tracked change is highlighted.