What the Core Library Provides

The Core library contains everything needed to build a rich text editor on any platform. It depends only on SkiaSharp (via Topten.RichTextKit) and has no dependency on Avalonia or any other UI framework.

🗂️

DocumentController

The primary API. Owns the document, handles all editing operations, styling, navigation, and rendering.

⚙️

DocumentSettings

Configure page width, margins, default text style, background color, and default paragraph alignment.

📤

DocumentReader / IO

Iterate paragraphs, runs, and styles to export or inspect document content without touching the UI.

🖼️

Inline Images

Insert, display, resize, and export inline images that flow with the text content.

⌨️

Input & Shortcuts

Platform-agnostic key codes and a configurable shortcut handler — translate platform events once, use everywhere.

📐

Geometry Types

Point, Rectangle, Size — lightweight structs that bridge document coordinates and Skia canvas space.

Key Types at a Glance

TypeKindDescription
DocumentControllerclassCentral editing API — owns TextDocument, handles all operations
DocumentSettingsstructImmutable-ish configuration for page layout and default style
DocumentMarginsstructPage margin values (left, right, top, bottom)
DocumentReaderclassRead-only iterator over document paragraphs and runs
ContentBlockclassRepresents one paragraph with alignment, list, and spacing info
ContentRunclassOne styled text span or inline image within a paragraph
InlineImageclassAn SKImage wrapper that implements IInlineObject for RTK
EditorCursorenumPlatform-agnostic cursor hint (Default, ResizeNS, ResizeEW, …)
ResizeHandleTypeenumWhich of the 8 resize handles the user is dragging
Pointstruct2D float point in document space
RectanglestructAxis-aligned rectangle with helpers for inflate/deflate
SizestructWidth × Height pair
KeyInfostructPlatform-agnostic key event (code + modifiers + character)
ShortcutstructKey combination descriptor used by ShortcutHandler
ShortcutHandlerclassMaps Shortcut → async Action and dispatches key events
IClipboardHandlerinterfaceAbstraction over platform clipboard (text + images)
NavigationInfostructSnapshot of caret style and selection, delivered via OnNavigation
DocumentInfostructSnapshot of document size and scroll offset
ViewModifierstructScroll offset + zoom scale for coordinate conversion

Namespace

using ParentElement.RichText.Core;
using ParentElement.RichText.Core.IO;
using ParentElement.RichText.Core.Images;
using ParentElement.RichText.Core.Geometry;
using ParentElement.RichText.Core.Input;