TX Text Control .NET Server

Javascript: SubTextPart.getHighlightMode Method

Method|Introduced in 28.0

Description

Gets a value indicating when the subtextpart is highlighted.

Syntax

<void> SubTextPart.getHighlightMode(<RequestHighlightModeCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the condition for highlighting.

errorCallback

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

Examples

The following example demonstrates SubTextPart.getHighlightMode in a practical document-editing workflow. It gets a value indicating when the subtextpart is highlighted.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const subTextParts = mainText.subTextParts;
    subTextParts.getItem(function(subTextPart) {
        if (!subTextPart) {
            console.warn("No sub text part is available at the current input position.");
            return;
        }
    
        subTextPart.getHighlightMode(
            function(result) {
                if (!result) {
                    console.warn("No highlight mode was returned.");
                    return;
                }
                
                console.log("get highlight mode result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);