DS Server

Javascript: TextPartCollection.getItem Method

Method|Introduced in 28.0

Description

Gets the text part with the input focus.

Syntax

<void> TextPartCollection.getItem(<RequestTextPartCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the requested textpart object.

errorCallback

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

Examples

The following example demonstrates TextPartCollection.getItem in a practical document-editing workflow. It gets the text part with the input focus.

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

TXTextControl.textParts.getItem(
    function(textPart) {
        if (!textPart) {
            console.warn("No formatted text was returned.");
            return;
        }
        
        console.log("get item result:", textPart);
    },
    onTxError
);