SpiceLogic.HtmlEditor.Avalonia 1.0.14

dotnet add package SpiceLogic.HtmlEditor.Avalonia --version 1.0.14
                    
NuGet\Install-Package SpiceLogic.HtmlEditor.Avalonia -Version 1.0.14
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpiceLogic.HtmlEditor.Avalonia" Version="1.0.14" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpiceLogic.HtmlEditor.Avalonia" Version="1.0.14" />
                    
Directory.Packages.props
<PackageReference Include="SpiceLogic.HtmlEditor.Avalonia" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SpiceLogic.HtmlEditor.Avalonia --version 1.0.14
                    
#r "nuget: SpiceLogic.HtmlEditor.Avalonia, 1.0.14"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SpiceLogic.HtmlEditor.Avalonia@1.0.14
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SpiceLogic.HtmlEditor.Avalonia&version=1.0.14
                    
Install as a Cake Addin
#tool nuget:?package=SpiceLogic.HtmlEditor.Avalonia&version=1.0.14
                    
Install as a Cake Tool

SpiceLogic Avalonia HTML Editor Control

Add visual HTML authoring to Avalonia desktop applications. Give users native toolbars, document context menus, design/source/preview workflows, images, tables, template fields and local spelling review while keeping stored content in your application's workflow.

Install

Use a .NET 8 or newer Avalonia application:

Build with .NET SDK 9.0.300 or newer (SDK 10 recommended). The runtime target can remain .NET 8; Avalonia 12.1.4's analyzers require the newer compiler.

dotnet add package SpiceLogic.HtmlEditor.Avalonia

The package includes the SpiceLogic portable editing core, shared models and embedded resources. Upstream dependencies are declared for restore. Keep Avalonia dependencies compatible with Avalonia 12.1.4 and WebView 12.1.1.

The document surface requires native browser dependencies: WebView2 on Windows, the system WKWebView on macOS, and WebKitGTK on the tested Ubuntu/Xorg configuration. Managed package restore does not install these operating-system libraries. See the tested configurations and platform prerequisites before packaging your application.

Native editor testing has completed on Windows 11 x64, Apple M1 arm64 macOS and Ubuntu 24.04.5 x64 with Xorg. Mac testing includes the complete 63-case native desktop suite as well as focused table-selection, formatting, Undo/Redo, image, source-font and resource-policy checks. The platform guide identifies the tested candidates and remaining qualification limits; these results do not establish coverage of Intel Macs, other Linux desktops or Wayland.

Add the control

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:editor="clr-namespace:SpiceLogic.HtmlEditor.Avalonia;assembly=SpiceLogic.HtmlEditor.Avalonia">
    <editor:AvaloniaHtmlEditor x:Name="HtmlEditor" />
</Window>

Initialize content after the window has opened and the control is attached:

await HtmlEditor.Ready;
await HtmlEditor.SetBodyHtmlAsync("<p>Welcome to your document.</p>");
string bodyHtml = await HtmlEditor.GetBodyHtmlAsync();
string documentHtml = await HtmlEditor.GetDocumentHtmlAsync();

Use body HTML for fragments and complete document HTML for head metadata and styles. BodyHtml and DocumentHtml support Avalonia binding. Await editor operations when completion matters; avoid blocking the UI thread with Wait() or Result.

Connect your workflow

Content, Editor, Caret, Selection, Formatting, StateQuery and Dialog provide replaceable awaited service interfaces with familiar WPF names. MailMerge and TableAuthoringService provide additional authoring operations. The control derives from the native Avalonia Border; its internal layout uses Child. Native toolbar overrides and ContextMenuItems let your application keep the commands it needs.

Source edits apply transactionally. Failed or stale operations retain the draft, including characters typed while an apply operation was pending. Your application chooses when to apply or discard remaining edits.

Customize the source font through the actual native editor. The default fallback includes Windows, macOS and Linux monospace families:

HtmlEditor.GetTheRawHtmlTextEditor().FontFamily = new Avalonia.Media.FontFamily("Menlo");

Apply local document CSS with HeaderStyleContent and ordinary class attributes:

await HtmlEditor.Ready;
HtmlEditor.HeaderStyleContent = "p.redtext { color: #dd0000; }";
await HtmlEditor.SynchronizeDocumentPropertiesAsync();
await HtmlEditor.SetBodyHtmlAsync("<p class=\"redtext\">Red text</p>");

Use Content.GetBodyHtmlAsync(true) for a well-formed XHTML fragment, Content.GetDocumentHtmlAsync(true) for the complete XHTML document, or Content.GetDocumentXmlAsync() to include a UTF-8 XML declaration. These exports apply a pending source draft and retain the current export policy. Unsupported XML characters, namespaces or internal DTD subsets report an error without replacing the document.

Content.EmbedLocalImagesAsBase64Async() embeds authorized local images in one Design undo operation. Content.GetEmailMessageWithLocalImagesEmbeddedAsync() builds an unsent message with plain text, an HTML alternate view and validated linked image resources; dispose the returned message after use. Both honor the configured local-resource policy. External stylesheet links remain unsupported; use HeaderStyleContent for local document CSS.

Loaded HTML is sanitized. Document rasters display through validated data/blob transport. AllowExternalResources permits bounded native HTTPS hydration from the configured BaseUrl and supported trusted YouTube preview; the browser does not fetch raw HTTPS raster or CSS image URLs. Explicitly accepted URL bytes can remain available offline. Embedded raster images travel with exported HTML.

Authored JavaScript, forms and form controls are removed. External stylesheet links, including Google Fonts stylesheets, are unsupported; a font name uses fonts available on the destination system. Insecure HTTP image sources are removed while the image element and its supported attributes can remain. A broken HTTPS source can remain in exported HTML without implying that the image was fetched or loaded.

Recognized CSS url(...) and legacy background attributes participate in resource projection. Quoted image-set(...) sources remain authored but blocked and unprojected, and are not included in print missing-resource reports. During actual Office cleanup, PasteAsync() durably embeds only approved cached or configured-base rasters and canonical operating-system temporary msohtmlclip raster references, unless local selection is disabled. This paste path does not create persistent file-import grants.

Source-view fonts

Set the source font directly with editor.SourceFontFamily = "Roboto Mono,Consolas,Menlo,DejaVu Sans Mono";. The first installed family wins; an empty string restores the automatic platform fallback. This bindable property has the same name and string contract in Avalonia, WPF and WinForms. It changes only source presentation, preserving text, selection, undo history and zoom. Install a Google Font on the target machine before selecting it; this property does not download fonts. Configure authored document fonts separately with DefaultFontFamily.

License and notices

This is a commercial control governed by the included SpiceLogic license. Assign the signed Avalonia key before constructing controls:

SpiceLogic.HtmlEditor.Avalonia.AvaloniaHtmlEditor.LicenseKey = "your-signed-Avalonia-key";

The key is process-wide. Later assignment refreshes existing controls while preserving documents. LicenseStatus, LicenseStatusChanged and ValidateLicenseAsync() expose validation state. Avalonia entitlements are separate from WPF and WinForms entitlements. Third-party notices and the corresponding bundled dictionary source files are included in the package.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.14 0 11/5/2026
1.0.13 70 11/5/2026
1.0.12 114 10/31/2026
1.0.11 96 10/30/2026
1.0.10 106 10/27/2026
1.0.9 104 10/24/2026
1.0.8 265 10/22/2026
1.0.7 94 10/22/2026
1.0.6 102 10/22/2026
1.0.5 96 10/21/2026
1.0.4 108 10/21/2026
1.0.3 104 10/21/2026
1.0.2 111 10/18/2026
1.0.1 106 10/18/2026
1.0.0 96 10/17/2026

Native dialogs fit their settled frame inside the monitor working area after initial sizing, keeping title bars and close controls reachable at high display scaling. Scrollable content and separate action buttons remain available. No public API changes.