Back to Devexpress

DxRichEdit.UndoAsync(CancellationToken) Method

blazor-devexpress-dot-blazor-dot-richedit-dot-dxrichedit-dot-undoasync-x28-system-dot-threading-dot-cancellationtoken-x29.md

latest2.0 KB
Original Source

DxRichEdit.UndoAsync(CancellationToken) Method

Cancels the last action.

Namespace : DevExpress.Blazor.RichEdit

Assembly : DevExpress.Blazor.RichEdit.v25.2.dll

NuGet Package : DevExpress.Blazor.RichEdit

Declaration

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

Optional Parameters

NameTypeDefaultDescription
cancellationTokenCancellationTokennull

An object that propagates a cancellation notification.

|

Returns

TypeDescription
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:

razor
<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

DxRichEdit Class

DxRichEdit Members

DevExpress.Blazor.RichEdit Namespace