Class RichDocumentSnapshot
- Namespace
- RichEdit.Core
- Assembly
- RichEdit.Core.dll
An immutable structured rich-document graph with one body story and document-owned styles.
public sealed class RichDocumentSnapshot
- Inheritance
-
RichDocumentSnapshot
- Inherited Members
Properties
Assets
Gets immutable document-owned image resources.
public ImmutableDictionary<RichAssetId, RichImageAsset> Assets { get; }
Property Value
Body
Gets the body story identity.
public RichNodeId Body { get; }
Property Value
Bookmarks
Gets persistent bookmarks, including orphaned records.
public ImmutableDictionary<RichAnnotationId, RichBookmark> Bookmarks { get; }
Property Value
Comments
Gets persistent comments, including orphaned records.
public ImmutableDictionary<RichAnnotationId, RichComment> Comments { get; }
Property Value
DefaultCharacter
Gets authored document character defaults. Unresolved values remain available for a view fallback.
public RichCharacterStyle DefaultCharacter { get; }
Property Value
DefaultParagraph
Gets authored document paragraph defaults.
public RichParagraphStyle DefaultParagraph { get; }
Property Value
Empty
Gets an immutable empty body containing one empty paragraph.
public static RichDocumentSnapshot Empty { get; }
Property Value
Nodes
Gets structural nodes indexed by their stable identities.
public ImmutableDictionary<RichNodeId, RichNode> Nodes { get; }
Property Value
Revision
Gets the document revision, or an invalid revision for a standalone builder snapshot.
public DocumentRevision Revision { get; }
Property Value
Revisions
Gets pending authored revisions, independent of undo history.
public ImmutableDictionary<long, RichRevision> Revisions { get; }
Property Value
Styles
Gets document-owned reusable styles.
public RichStyleSheet Styles { get; }
Property Value
Methods
Build(Action<RichDocumentEdit>)
Constructs and validates a detached immutable snapshot, suitable for background construction before adoption.
public static RichDocumentSnapshot Build(Action<RichDocumentEdit> build)
Parameters
buildAction<RichDocumentEdit>
Returns
ComparePoints(RichTextPoint, RichTextPoint)
Compares structural text points in document order without materializing a plain-text projection.
public int ComparePoints(RichTextPoint first, RichTextPoint second)
Parameters
firstRichTextPointsecondRichTextPoint
Returns
CreateOriginalReviewSnapshot()
Creates a detached original-content projection by rejecting every pending revision without changing the document or history.
public RichDocumentSnapshot CreateOriginalReviewSnapshot()
Returns
CreateReviewProjection(RichReviewMode, CancellationToken)
Captures final or original review content and snapshot-bound address maps without editing the document or history.
public RichReviewProjection CreateReviewProjection(RichReviewMode mode, CancellationToken cancellationToken = default)
Parameters
modeRichReviewModecancellationTokenCancellationToken
Returns
FromPlainText(string)
Creates semantic paragraphs and soft breaks from plain text. Paragraph terminators normalize to rich structure.
public static RichDocumentSnapshot FromPlainText(string text)
Parameters
textstring
Returns
GetParagraphLength(RichNodeId)
Gets the paragraph-local UTF-16 length, including one position for each soft break.
public int GetParagraphLength(RichNodeId id)
Parameters
idRichNodeId
Returns
GetRevisionResolution(Guid, bool)
Gets the exact pending transactions an atomic group resolution will include.
public ImmutableArray<RichRevision> GetRevisionResolution(Guid group, bool accept)
Parameters
Returns
Remarks
Acceptance includes prerequisites. Rejection includes dependent groups. Whole groups are always resolved together.
GetSelectedBlocks(RichBlockSelection)
Gets complete selected blocks in document order, validating that both endpoints share a text container.
public ImmutableArray<RichNodeId> GetSelectedBlocks(RichBlockSelection selection)
Parameters
selectionRichBlockSelection
Returns
GetSelectedCharacterFormats(RichSelection)
Returns resolved character values for selected runs and empty paragraphs, suitable for mixed-format queries.
public ImmutableArray<ResolvedCharacterStyle> GetSelectedCharacterFormats(RichSelection selection)
Parameters
selectionRichSelection
Returns
GetSelectedText(RichSelection)
Enumerates selected paragraph-local ranges without flattening tables, lists, or object addresses.
public ImmutableArray<RichSelectedText> GetSelectedText(RichSelection selection)
Parameters
selectionRichSelection
Returns
Remarks
Cell rectangles include only their cells, including nested content. A boundary has no text ranges.
GetTableGrid(RichNodeId)
Gets a validated table grid, with every covered position referring to its owning cell identity.
public RichTableGrid GetTableGrid(RichNodeId table)
Parameters
tableRichNodeId
Returns
Get<T>(RichNodeId)
Gets a typed node or rejects a missing node or mismatched structural kind.
public T Get<T>(RichNodeId id) where T : RichNode
Parameters
idRichNodeId
Returns
- T
Type Parameters
T
ProjectBlocks(RichBlockSelection)
Projects a contiguous sequence of complete blocks while retaining their owning story and rich addresses.
public RichTextProjection ProjectBlocks(RichBlockSelection selection)
Parameters
selectionRichBlockSelection
Returns
ProjectText(RichNodeId?)
Explicitly projects a story, block, cell, or list item to text with snapshot-bound rich addresses and structural separators.
public RichTextProjection ProjectText(RichNodeId? root = null)
Parameters
rootRichNodeId?
Returns
Remarks
The default root is the complete body. A cell projection retains the same nodes and owning story; it is not an independent document.
ResolveCharacter(RichNodeId)
Resolves authored character appearance for one inline without rewriting its style references or direct overrides.
public ResolvedCharacterStyle ResolveCharacter(RichNodeId inline)
Parameters
inlineRichNodeId
Returns
ResolveParagraph(RichNodeId)
Resolves authored paragraph appearance, including semantic heading level.
public ResolvedParagraphStyle ResolveParagraph(RichNodeId paragraph)
Parameters
paragraphRichNodeId
Returns
ValidatePoint(RichTextPoint)
Validates a rich point against its exact story, paragraph, UTF-16 length, and affinity.
public void ValidatePoint(RichTextPoint point)
Parameters
pointRichTextPoint