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
snapshotRichDocumentSnapshot
Properties
CanRedo
Gets whether document redo is available.
public bool CanRedo { get; }
Property Value
CanUndo
Gets whether document undo is available.
public bool CanUndo { get; }
Property Value
CurrentSnapshot
Gets a frozen snapshot suitable for background reads.
public RichDocumentSnapshot CurrentSnapshot { get; }
Property Value
HistoryByteLimit
Gets or sets the estimated history byte budget.
public long HistoryByteLimit { get; set; }
Property Value
HistoryLimit
Gets or sets the maximum retained undo and redo units.
public int HistoryLimit { get; set; }
Property Value
IsModified
Gets whether current content differs from the acknowledged saved state.
public bool IsModified { get; }
Property Value
IsUndoGroupOpen
Gets whether an explicit document history group is open.
public bool IsUndoGroupOpen { get; }
Property Value
RedoDescription
Gets the next redo description.
public string? RedoDescription { get; }
Property Value
RetainedHistoryByteEstimate
Gets an estimate of document history retention, excluding application-held snapshots.
public long RetainedHistoryByteEstimate { get; }
Property Value
Revision
Gets document identity and monotonically increasing revision.
public DocumentRevision Revision { get; }
Property Value
UndoDescription
Gets the next undo description.
public string? UndoDescription { get; }
Property Value
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
descriptionstring
Returns
CaptureSave()
Captures a frozen snapshot paired with the state to acknowledge after successful lossless RTF saving.
public RichSaveCapture CaptureSave()
Returns
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
Edit(Action<RichDocumentEdit>, RichEditOptions)
Commits one schema-validated authored transaction.
public RichDocumentChangedEventArgs? Edit(Action<RichDocumentEdit> edit, RichEditOptions options = default)
Parameters
editAction<RichDocumentEdit>optionsRichEditOptions
Returns
FromPlainText(string)
Creates a document from semantic paragraphs and soft breaks in plain text.
public static RichDocument FromPlainText(string text)
Parameters
textstring
Returns
MarkSaved(RichSaveCapture)
Acknowledges the successfully saved capture, keeping intervening edits dirty.
public void MarkSaved(RichSaveCapture capture)
Parameters
captureRichSaveCapture
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
revisionDocumentRevisioneditAction<RichDocumentEdit>optionsRichEditOptions
Returns
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
StateChanged
Occurs after history availability or saved state changes without an authored edit.
public event EventHandler? StateChanged