Skip to main content

DxRichEdit.UndoAsync(CancellationToken) Method

Cancels the last action.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v24.1.dll

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public ValueTask<bool> UndoAsync(
    CancellationToken cancellationToken = default(CancellationToken)
)

Optional Parameters

Name Type Default Description
cancellationToken CancellationToken null

An object that propagates a cancellation notification.

Returns

Type Description
ValueTask<Boolean>

A structure that stores an awaitable result of an asynchronous operation.

Remarks

The Rich Text editor keeps track of user actions. Click the Undo button to cancel the actions. You can also use the UndoAsync method to undo the last action from code.

The code snippet below adds new text to the documents, and undoes and redoes this operation:

<DxRichEdit @ref=rich />

@code {
    DxRichEdit rich;
    async Task ModifyDocumentContent() {
        Document documentApi = rich.DocumentAPI;
        documentApi.BeginUpdate();
        Paragraph body = await documentApi.Paragraphs.CreateAsync(0);
        TextSpan text = await documentApi.AddTextAsync(0, "New text");
        documentApi.EndUpdate();
        await rich.UndoAsync();
        await rich.RedoAsync();
    }
    @* ... *@
}
See Also