Skip to main content

TextEditorKeyboard Class

Definition​

Assembly:Avalonia.Controls.RichTextEditor
Package:Avalonia.Controls.RichTextEditor

Extends Avalonia.Controls.Documents.Primitives.Components.TextViewKeyboard with editing commands (delete, cut, paste, undo/redo, formatting).

public class TextEditorKeyboard

Inheritance: object -> TextViewComponentBase -> TextViewKeyboard -> TextEditorKeyboard

Constructors​

NameDescription
TextEditorKeyboardNo summary available.

TextEditorKeyboard Constructor​

public TextEditorKeyboard()

Methods​

NameDescription
CopyCopies the current selection to the clipboard without waiting for the clipboard write. Inherited from TextViewKeyboard.
CopyAsyncCopies the current selection to the clipboard, including the RTF rich-format payload, by delegating to Avalonia.Controls.Documents.Primitives.Actions.EditorActions.Copy.
CutCuts the current selection to the clipboard without waiting for the clipboard write.
CutAsyncCuts the current selection to the clipboard.

CopyAsync Method​

Copies the current selection to the clipboard, including the RTF rich-format payload, by delegating to Avalonia.Controls.Documents.Primitives.Actions.EditorActions.Copy.

public System.Threading.Tasks.Task CopyAsync(System.Threading.CancellationToken cancellationToken)

Parameters​

cancellationToken System.Threading.CancellationToken

Abandons the copy before the clipboard is written.

Returns​

System.Threading.Tasks.Task

Cut Method​

Cuts the current selection to the clipboard without waiting for the clipboard write.

public void Cut()

Remarks​

Await Avalonia.Controls.Documents.Primitives.Components.TextEditorKeyboard.CutAsync instead. The clipboard is a platform resource another process can hold, so the write can fail after this method has already returned, and a caller here cannot sequence anything after it.

CutAsync Method​

Cuts the current selection to the clipboard.

public System.Threading.Tasks.Task CutAsync()

Returns​

System.Threading.Tasks.Task

A task that completes when the cut has finished.

Remarks​

Delegates to Avalonia.Controls.Documents.Primitives.Actions.EditorActions.Cut so the keyboard shortcut and toolbar/menu paths share one implementation, including the rich-format (RTF) clipboard payload published by Avalonia.Controls.Documents.Primitives.Components.ClipboardOperations.CutAsync(Avalonia.Controls.TextSelection,Avalonia.Visual,System.Collections.Generic.IReadOnlyList{Avalonia.Controls.Documents.Serialization.IDocumentSerializer},System.Threading.CancellationToken). The clipboard is a platform resource another process can hold, so the cut can fail: awaiting the returned task is how a caller sees that, and how it sequences work after the clipboard write.

Properties​

NameDescription
IsAttachedGets whether this component is currently attached to a host. Inherited from TextViewComponentBase.