Editor service
Control editing commands, clipboard operations, history, search, scrolling and printing through an awaited facade. The current view supplies its own history and selection.
The facade is available as editor.Editor; its interface can be replaced by an application implementation.

Use it in your application
Run commands on the UI thread after readiness. Read-only state, selection changes and document ownership are checked at application boundaries; handle rejected or cancelled operations in your host.
All examples assume an editor named editor, already attached to a visible window, and an awaited editor.Ready. Keep operations asynchronous instead of blocking the UI thread.
bool canUndo = await editor.StateQuery.CanUndoAsync();
if (canUndo) await editor.Editor.UndoAsync();
Members
These declarations come from the package's own XML documentation. Await operations and supply cancellation tokens where your application needs them.
ClearUndoStackAsync Method
Clears undo and redo history in the current source or design view without changing its content or selection. Read-only views are permitted; preview is rejected.
Syntax
Task ClearUndoStackAsync(CancellationToken cancellationToken = default)
CopyAsync Method
Copies the current visible selection through the native clipboard.
Syntax
Task CopyAsync(CancellationToken cancellationToken = default)
CutAsync Method
Copies and removes the writable current visible selection.
Syntax
Task CutAsync(CancellationToken cancellationToken = default)
DeleteAsync Method
Deletes the current visible selection or the character ahead of the caret, without using the clipboard.
Syntax
Task DeleteAsync(CancellationToken cancellationToken = default)
DeleteTextAsync Method
Deletes a body plain-text UTF-16 range in editable design mode. Zero length deletes forward; partial graphemes and protected atoms are rejected.
Syntax
Task DeleteTextAsync(int startIndex, int length, CancellationToken cancellationToken = default)
FocusAsync Method
Requests acknowledged keyboard focus in the actual current editor view.
Syntax
Task<bool> FocusAsync(CancellationToken cancellationToken = default)
GetScrollBarSettingAsync Method
Reads the authored body's overflow policy; source mode returns Auto.
Syntax
Task<SpiceLogic.HtmlEditor.Abstractions.ScrollBarVisibility> GetScrollBarSettingAsync(CancellationToken cancellationToken = default)
GetScrollPositionAsync Method
Reads the actual current view's scroll offset in device-independent pixels.
Syntax
Avalonia.Point> GetScrollPositionAsync(CancellationToken cancellationToken = default)
GetScrollStateAsync Method
Reads actual current-view scroll offsets, extents and overflow. An unlaid-out source view is unavailable.
Syntax
Task<EditorScrollState> GetScrollStateAsync(CancellationToken cancellationToken = default)
JustifyCenterAsync Method
Centers the current rendered selection through the current formatting facade.
Syntax
Task JustifyCenterAsync(CancellationToken cancellationToken = default)
JustifyLeftAsync Method
Left-aligns the current rendered selection through the current formatting facade.
Syntax
Task JustifyLeftAsync(CancellationToken cancellationToken = default)
JustifyRightAsync Method
Right-aligns the current rendered selection through the current formatting facade.
Syntax
Task JustifyRightAsync(CancellationToken cancellationToken = default)
PasteAsync Method
Pastes approved clipboard content into the current writable view.
Syntax
Task PasteAsync(CancellationToken cancellationToken = default)
PasteFromMsWordAsync Method
Pastes Office content through the canonical shared cleaner and native resource policy.
Syntax
Task PasteFromMsWordAsync(CancellationToken cancellationToken = default)
PrintAsync Method
Opens the complete-document native print preview without claiming printer completion.
Syntax
Task PrintAsync(CancellationToken cancellationToken = default)
RedoAsync Method
Redoes one operation in the actual visible source or design history.
Syntax
Task RedoAsync(CancellationToken cancellationToken = default)
ReplaceAllAsync Method
Replaces bounded original-snapshot matches in one history operation and returns their count.
Syntax
Task<int> ReplaceAllAsync(string replaceWhat, string replaceWith, bool matchWholeWord = false, bool matchCase = false, CancellationToken cancellationToken = default)
ReplaceAsync Method
Replaces a complete currently selected match and reports whether it changed.
Syntax
Task<bool> ReplaceAsync(string searchString, string replacement, bool matchWholeWord = false, bool matchCase = false, CancellationToken cancellationToken = default)
ReplaceTextAsync Method
Replaces a body plain-text UTF-16 range in editable design mode, retaining surviving rich nodes and without deliberately selecting that range.
Syntax
Task ReplaceTextAsync(int startIndex, int length, string replacementText, CancellationToken cancellationToken = default)
SearchAsync Method
Finds forward or backward from the current visible selection, without wrapping.
Syntax
Task<bool> SearchAsync(string text, bool forward = true, bool matchWholeWord = false, bool matchCase = false, CancellationToken cancellationToken = default)
SetScrollBarSettingAsync Method
Awaits an ordered authored body overflow change in editable design mode. Custom leaves authored declarations intact; source ignores the setter.
Syntax
Task SetScrollBarSettingAsync(SpiceLogic.HtmlEditor.Abstractions.ScrollBarVisibility scrollbarValue, CancellationToken cancellationToken = default)
SetScrollPositionAsync Method
Sets the actual current view's scroll offset, clamped by its measured scrolling surface. Read-only and preview views are supported.
Syntax
Task SetScrollPositionAsync(int x, int y, CancellationToken cancellationToken = default)
ShowPrintPreviewDialogAsync Method
Opens the same complete-document native print-preview workflow.
Syntax
Task ShowPrintPreviewDialogAsync(CancellationToken cancellationToken = default)
ShowSearchDialogAsync Method
Opens the actual native find/replace workflow.
Syntax
Task ShowSearchDialogAsync(CancellationToken cancellationToken = default)
UndoAsync Method
Undoes one operation in the actual visible source or design history.
Syntax
Task UndoAsync(CancellationToken cancellationToken = default)
UnFocusAsync Method
Removes actual editor focus using the host's mode and owner guards.
Syntax
Task UnFocusAsync(CancellationToken cancellationToken = default)