TX Text Control .NET Server

Javascript: TXTextControl.setEditMode Method

Method|Introduced in 28.0

Description

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

Syntax

<void> TXTextControl.setEditMode(<EditMode> editMode, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
editMode

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

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates TXTextControl.setEditMode in a practical document-editing workflow. It sets 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.setEditMode(
    TXTextControl.EditMode.Edit,
    function() {
        console.log("set edit mode completed.");
    },
    onTxError
);