📄

Rich Document Model

Paragraph-based document model with full text styling: bold, italic, color, font family/size, subscript, superscript, and more.

🖼️

Inline Images

Images flow with text as first-class inline objects, complete with live resize handles and undo/redo support.

📋

Lists & Indentation

Bullet and numbered lists with multi-level nesting, block indent, first-line indent, and line spacing controls.

↕️

Import & Export

Import and export HTML, RTF, and DOCX (OpenXML) documents via the companion ParentElement.RichText.Export library.

⌨️

Keyboard Shortcuts

Fully configurable shortcut system. Map any key combination to any editor action using the fluent ShortcutHandler API.

♻️

Undo / Redo

Deep undo/redo built into the document model. All editing operations — including image resize — are fully undoable.

Solution Structure

RichTextKit is split into focused libraries so you can take only what you need.

ProjectPurpose
ParentElement.RichText.Core Platform-agnostic document model, controller, IO types, input handling
ParentElement.RichText.Avalonia Avalonia controls: WordProcessor, RichTextEditor, DocumentToolBar, and rendering/clipboard platform layer
ParentElement.RichText.Export HTML, RTF, and DOCX exporters (and importers) built on the Core IO layer
Topten.RichTextKit Underlying text layout engine (Skia-based, external dependency)

Quick Start

The fastest path to a working rich text editor is to add WordProcessor to your Avalonia window — it bundles the toolbar, editor canvas, and scrollbars.

<!-- In your AXAML -->
<Window xmlns:pe="clr-namespace:ParentElement.RichText.Avalonia;assembly=ParentElement.RichText.Avalonia">
    <pe:WordProcessor x:Name="Editor" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Window>

For lower-level control, use RichTextEditor directly and wire up a DocumentToolBar:

// code-behind
var controller = Editor.DocumentController;

// Apply styles programmatically
await controller.ApplyBold();
await controller.ApplyFontColor(SKColors.DodgerBlue);

// React to cursor/selection changes
controller.OnNavigation += info => UpdateMyToolbar(info);

// Export the document
var reader = controller.GetContentReader();
await new HtmlExporter(reader).ExportAsync("output.html");