DS Server

Javascript: TrackedChange.getStart Method

Method|Introduced in 28.0

Description

Gets the index (one-based) of the first changed character.

Syntax

<void> TrackedChange.getStart(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the index of the first changed character.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TrackedChange.getStart in a practical document-editing workflow. It gets the index (one-based) of the first changed character.

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.getStart(
            function(result) {
                console.log("get start result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);