SpiceLogic.HtmlEditor.Avalonia
1.0.2
dotnet add package SpiceLogic.HtmlEditor.Avalonia --version 1.0.2
NuGet\Install-Package SpiceLogic.HtmlEditor.Avalonia -Version 1.0.2
<PackageReference Include="SpiceLogic.HtmlEditor.Avalonia" Version="1.0.2" />
<PackageVersion Include="SpiceLogic.HtmlEditor.Avalonia" Version="1.0.2" />
<PackageReference Include="SpiceLogic.HtmlEditor.Avalonia" />
paket add SpiceLogic.HtmlEditor.Avalonia --version 1.0.2
#r "nuget: SpiceLogic.HtmlEditor.Avalonia, 1.0.2"
#:package SpiceLogic.HtmlEditor.Avalonia@1.0.2
#addin nuget:?package=SpiceLogic.HtmlEditor.Avalonia&version=1.0.2
#tool nuget:?package=SpiceLogic.HtmlEditor.Avalonia&version=1.0.2
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 --version 1.0.2
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 the native browser dependencies for the deployed operating system: WebView2 on Windows, WKWebView on macOS, and Avalonia WebView's supported WPE/WebKitGTK backend on Linux. Include those prerequisites in your application's installation and qualification workflow. See Avalonia's native WebView prerequisites.
The desktop architecture targets Windows, macOS and Linux. Native qualification for this initial edition is being completed on Windows; macOS and Linux native operation has not yet been exercised. Managed package restore does not install the operating system's browser libraries.
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.
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.
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.
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 | Versions 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. |
-
net8.0
- Avalonia (>= 12.1.4)
- Avalonia.AvaloniaEdit (>= 12.0.0)
- Avalonia.Controls.ColorPicker (>= 12.1.4)
- Avalonia.Controls.WebView (>= 12.1.1)
- Avalonia.Skia (>= 12.1.4)
- System.Text.Encoding.CodePages (>= 8.0.0)
- WeCantSpell.Hunspell (>= 7.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.