DS Server

RequestHighlightModeCallback Function

Function

Description

Callback function for requesting a highlighting mode.

Syntax

function(<HighlightMode> result)

Examples

The following example demonstrates RequestHighlightModeCallback in a practical document-editing workflow. Callback function for requesting a highlighting mode.

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

function requestHighlightModeCallback(result) {
    console.log("result:", result);
}

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.getHighlightMode(requestHighlightModeCallback, onTxError);
    }, onTxError);
}, onTxError);