DS Server

Javascript: TextPart.addSubTextPart Method

MethodDeprecated|Introduced in 26.0

Description

Obsolete. This method will be removed in one of the next versions. Inserts a new SubTextPart into the TextPart at the current input position.

Syntax

<void> TextPart.addSubTextPart(<function> callback, <SubTextPartInfo> subTextPart)

Parameters

ParameterDescription
callback

A function with one parameter. Is called with an AddResult object as a parameter, which indicates whether the SubTextPart was succesfully created, as soon as the information has been retrieved from the server.

subTextPart

Specifies the new SubTextPart's properties. The specification of the SubTextPart.name property is required. If the SubTextPart.start and SubTextPart.length properties are available then the SubTextPart will be created at this textrange.

Examples

The following example demonstrates TextPart.addSubTextPart in a practical document-editing workflow. Obsolete. This method will be removed in one of the next versions. Inserts a new SubTextPart into the TextPart at the current input position.

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

function addSubTextPart(subTextPart) {
    TXTextControl.textParts.getMainText(function(textPart) {
        textPart.addSubTextPart(
            function() {
                console.log("add sub text part completed.");
            },
            subTextPart
        );
    }, onTxError);
}