Table of Contents

Class RichDocument

Namespace
RichEdit.Core
Assembly
RichEdit.Core.dll

A structured rich document with one authored state, shared sessions, atomic transactions, and document-owned history.

public sealed class RichDocument
Inheritance
RichDocument
Inherited Members

Constructors

RichDocument()

Creates an empty, clean rich document with no history.

public RichDocument()

RichDocument(RichDocumentSnapshot)

Adopts a validated immutable snapshot into a fresh document identity and clean history.

public RichDocument(RichDocumentSnapshot snapshot)

Parameters

snapshot RichDocumentSnapshot

Properties

CanRedo

Gets whether document redo is available.

public bool CanRedo { get; }

Property Value

bool

CanUndo

Gets whether document undo is available.

public bool CanUndo { get; }

Property Value

bool

CurrentSnapshot

Gets a frozen snapshot suitable for background reads.

public RichDocumentSnapshot CurrentSnapshot { get; }

Property Value

RichDocumentSnapshot

HistoryByteLimit

Gets or sets the estimated history byte budget.

public long HistoryByteLimit { get; set; }

Property Value

long

HistoryLimit

Gets or sets the maximum retained undo and redo units.

public int HistoryLimit { get; set; }

Property Value

int

IsModified

Gets whether current content differs from the acknowledged saved state.

public bool IsModified { get; }

Property Value

bool

IsUndoGroupOpen

Gets whether an explicit document history group is open.

public bool IsUndoGroupOpen { get; }

Property Value

bool

RedoDescription

Gets the next redo description.

public string? RedoDescription { get; }

Property Value

string

RetainedHistoryByteEstimate

Gets an estimate of document history retention, excluding application-held snapshots.

public long RetainedHistoryByteEstimate { get; }

Property Value

long

Revision

Gets document identity and monotonically increasing revision.

public DocumentRevision Revision { get; }

Property Value

DocumentRevision

UndoDescription

Gets the next undo description.

public string? UndoDescription { get; }

Property Value

string

Methods

BeginUndoGroup(string?)

Groups separately published rich transactions into one undo unit. Nested scopes close in reverse order.

public IDisposable BeginUndoGroup(string? description = null)

Parameters

description string

Returns

IDisposable

CaptureSave()

Captures a frozen snapshot paired with the state to acknowledge after successful lossless RTF saving.

public RichSaveCapture CaptureSave()

Returns

RichSaveCapture

ClearHistory()

Clears document history without changing content or saved-state identity.

public void ClearHistory()

CreateSession()

Creates an independent view session without clearing document history.

public RichEditorSession CreateSession()

Returns

RichEditorSession

Edit(Action<RichDocumentEdit>, RichEditOptions)

Commits one schema-validated authored transaction.

public RichDocumentChangedEventArgs? Edit(Action<RichDocumentEdit> edit, RichEditOptions options = default)

Parameters

edit Action<RichDocumentEdit>
options RichEditOptions

Returns

RichDocumentChangedEventArgs

FromPlainText(string)

Creates a document from semantic paragraphs and soft breaks in plain text.

public static RichDocument FromPlainText(string text)

Parameters

text string

Returns

RichDocument

MarkSaved(RichSaveCapture)

Acknowledges the successfully saved capture, keeping intervening edits dirty.

public void MarkSaved(RichSaveCapture capture)

Parameters

capture RichSaveCapture

Redo()

Redoes one document unit while mapping all attached selections.

public void Redo()

TryEdit(DocumentRevision, Action<RichDocumentEdit>, RichEditOptions)

Commits only if the captured rich revision is current.

public RichEditResult TryEdit(DocumentRevision revision, Action<RichDocumentEdit> edit, RichEditOptions options = default)

Parameters

revision DocumentRevision
edit Action<RichDocumentEdit>
options RichEditOptions

Returns

RichEditResult

Undo()

Undoes one document unit while mapping all attached selections.

public void Undo()

Events

Changed

Occurs after the document and all view selections have been synchronized.

public event EventHandler<RichDocumentChangedEventArgs>? Changed

Event Type

EventHandler<RichDocumentChangedEventArgs>

StateChanged

Occurs after history availability or saved state changes without an authored edit.

public event EventHandler? StateChanged

Event Type

EventHandler