TX Text Control .NET Server

Javascript: TrackedChange.getLength Method

Method|Introduced in 28.0

Description

Gets the number of changed characters.

Syntax

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

Parameters

ParameterDescription
callback

Receives the number of changed characters.

errorCallback

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

Examples

The following example demonstrates TrackedChange.getLength in a practical document-editing workflow. It gets the number of changed characters.

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