TX Text Control .NET Server

Javascript: TXTextControl.beginUndoAction Method

Method|Introduced in 30.0

Description

Begins a user-defined undo operation. All editing and fomatting changes made between beginUndoAction and endUndoAction belong to the undo operation. These changes are undone or redone in a single step. The specified user-defined name is available via getUndoActionName.

Syntax

<void> TXTextControl.beginUndoAction(<string> actionName, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
actionName

Specifies the undo action's name. If an action name is not necessary, this parameter can be null or an empty string.

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.beginUndoAction in a practical document-editing workflow. Begins a user-defined undo operation. All editing and fomatting changes made between beginUndoAction and endUndoAction belong to the undo operation. These changes are undone or redone in a single step. The specified user-defined name is available via getUndoActionName.

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

TXTextControl.beginUndoAction(
    "QuarterlyReport",
    function() {
        console.log("begin undo action completed.");
    },
    onTxError
);