ReplaceImageAction Class
Definition
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
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
| Name | Description |
|---|---|
| ReplaceImageAction | No summary available. |
ReplaceImageAction Constructor
public ReplaceImageAction()
Methods
| Name | Description |
|---|---|
| CanExecute | No summary available. |
| Execute | No summary available. |
| ExecuteAsync | No summary available. |
| GetState | Gets 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
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
| Name | Description |
|---|---|
| DisplayName | No summary available. |
| Gesture | Gets the optional keyboard gesture for this action. Inherited from EditorAction. |
| Id | No summary available. |
DisplayName Property
public string DisplayName { get; set; }
Id Property
public string Id { get; set; }