TX Text Control .NET Server

Javascript: TXTextControl.getEditMode Method

Method|Introduced in 28.0

Description

Gets a value indicating whether the document's text is protected, or can be freely edited and formatted.

Syntax

<void> TXTextControl.getEditMode(<RequestEditModeCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives whether the document's text is protected, or can be freely edited and formatted.

errorCallback

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

Examples

The following example demonstrates TXTextControl.getEditMode in a practical document-editing workflow. It gets a value indicating whether the document's text is protected, or can be freely edited and formatted.

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

TXTextControl.getEditMode(
    function(editMode) {
        if (!editMode) {
            console.warn("No edit mode was returned.");
            return;
        }
        
        console.log("get edit mode result:", editMode);
    },
    onTxError
);