Skip to main content

ReplaceImageAction Class

Definition

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

Replaces the inline Avalonia.Controls.Documents.RichImage at the current selection with a new image chosen from a file picker, preserving the existing display size and alt text.

public class ReplaceImageAction

Inheritance: object -> EditorAction -> ReplaceImageAction

Remarks

The replacement removes the old image node via Avalonia.Controls.Documents.TextModel.TextDocument.DeleteNode(Avalonia.Controls.Documents.TextModel.TextDocumentNode) and inserts a fresh one at the same position, so undo restores the original from immutable snapshot bytes rather than a disposed Avalonia.Controls.Documents.RichImage.Source. A character-range delete of the old image would leave a zero-length orphan node, so node deletion is used.

Constructors

NameDescription
ReplaceImageActionNo summary available.

ReplaceImageAction Constructor

public ReplaceImageAction()

Methods

NameDescription
CanExecuteNo summary available.
ExecuteNo summary available.
ExecuteAsyncNo summary available.
GetStateGets the current state of the action. Inherited from EditorAction.

CanExecute Method

public bool CanExecute(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

Returns

bool

Execute Method

public void Execute(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

ExecuteAsync Method

public System.Threading.Tasks.Task ExecuteAsync(Avalonia.Controls.Documents.Primitives.ITextEditorHost host)

Parameters

host Avalonia.Controls.Documents.Primitives.ITextEditorHost

Returns

System.Threading.Tasks.Task

Properties

NameDescription
DisplayNameNo summary available.
GestureGets the optional keyboard gesture for this action. Inherited from EditorAction.
IdNo summary available.

DisplayName Property

public string DisplayName { get; set; }

Id Property

public string Id { get; set; }