TX Text Control .NET Server

Javascript: TXTextControl.HighlightMode Enumeration

Enumeration|Introduced in 25.0

Description

Contains all possible highlight mode values.

Members

MemberDescription
NeverThe element is never highlighted.
ActivatedThe element is only highlighted, when it contains the current text input position and when the control has the input focus.
AlwaysThe element is always highlighted.
AutoThe element's highlight mode is governed by the global highlight mode property.

Examples

The following example uses TXTextControl.HighlightMode.Always (the element is always highlighted.) in a document-editing workflow.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const comments = mainText.comments;
    comments.getItem(function(commentedText) {
        if (!commentedText) {
            console.warn("No commented text is available at the current input position.");
            return;
        }
    
        commentedText.setHighlightMode(
            TXTextControl.HighlightMode.Always,
            function() {
                console.log("set highlight mode completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);