DS Server

Javascript: Paragraph.select Method

Method|Introduced in 28.0

Description

Selects the paragraph.

Syntax

<void> Paragraph.select([<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates Paragraph.select in a practical document-editing workflow. It selects the paragraph.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const paragraphs = mainText.paragraphs;
    paragraphs.getItem(function(paragraph) {
        if (!paragraph) {
            console.warn("No paragraph is available at the current input position.");
            return;
        }
    
        paragraph.select(
            function() {
                console.log("select completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);