TX Text Control .NET Server

Javascript: TXTextControl.getCanCharacterFormat Method

Method|Introduced in 28.0

Description

Informs whether the currently selected text can be formatted with character formatting attributes. The value depends on whether the formatting is allowed and the currently set edit mode.

Syntax

<void> TXTextControl.getCanCharacterFormat(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

The callback function that receives the requested value.

errorCallback

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

Examples

The following example demonstrates TXTextControl.getCanCharacterFormat in a practical document-editing workflow. Informs whether the currently selected text can be formatted with character formatting attributes. The value depends on whether the formatting is allowed and the currently set edit mode.

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

TXTextControl.getCanCharacterFormat(
    function(result) {
        if (result) {
            console.log("get can character format is available.");
        } else {
            console.warn("get can character format is not available in the current document state.");
        }
    },
    onTxError
);