DS Server

RequestHypertextLinkCallback Function

Function

Description

Callback function for requesting a hypertext link.

Syntax

function(<HypertextLink> result)

Examples

The following example demonstrates RequestHypertextLinkCallback in a practical document-editing workflow. Callback function for requesting a hypertext link.

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

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

TXTextControl.textParts.getMainText(function(mainText) {
    const hypertextLinks = mainText.hypertextLinks;
    hypertextLinks.getItem(function(hypertextLink) {
        if (!hypertextLink) {
            console.warn("No hypertext link is available at the current input position.");
            return;
        }
    
        hypertextLink.getTarget(requestHypertextLinkCallback, onTxError);
    }, onTxError);
}, onTxError);