DS Server

Javascript: DocumentLink.getDescriptiveText Method

Method|Introduced in 34.0

Description

Gets the document link's descriptive text. An empty string indicates that the link has no such text.

Syntax

<void> DocumentLink.getDescriptiveText(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the current property value.

errorCallback

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

Examples

The following example demonstrates DocumentLink.getDescriptiveText in a practical document-editing workflow. It gets the document link's descriptive text. An empty string indicates that the link has no such text.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const documentLinks = mainText.documentLinks;
    documentLinks.getItem(function(documentLink) {
        if (!documentLink) {
            console.warn("No document link is available at the current input position.");
            return;
        }
    
        documentLink.getDescriptiveText(
            function(result) {
                console.log("get descriptive text result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);