Class DocumentEdit
The record of one text edit (TextEditingExtensions): where a caret was and goes, which paragraphs changed, and how to take the edit back exactly.
public sealed class DocumentEdit
- Inheritance
-
DocumentEdit
- Inherited Members
Remarks
Undo() puts back the very node instances the edit removed and detaches the ones it created, so every node that existed before the edit has its place, its content and its NodeId again. Redo() re-applies the edit with the same created instances, so their ids come back too, and a later record that addresses a run this one created stays valid.
Records are undone in the reverse of the order they were made, and redone in the order they were made, as an undo stack does. A record checks that the nodes it touches are as it left them before it changes anything; when the document has been changed since in a way that contradicts it, Undo() and Redo() throw and leave the document as it was.
Properties
- After
Gets where a caret goes after the edit.
- Before
Gets where a caret was: the edit's position, or the start of the span it changed.
- ChangedParagraphKeys
Gets the NodeId value of every paragraph whose content or existence the edit changed, removed and created ones included: what a layout cache must invalidate. Empty for an edit that changed nothing.
- IsEmpty
Gets a value indicating whether the edit changed nothing (for example, merging a container's first paragraph).
- IsUndone
Gets a value indicating whether the edit is currently undone.
Methods
- Redo()
Re-applies an undone edit with the same node instances it created the first time.
- Undo()
Takes the edit back.