I am currently working on implementing AvalonEdit in an HTML WYSIWYG/"Source Code" side-by-side editor. When the user switches from Design Mode (a RichTextBox) to Source Mode (AvalonEdit TextEditor) the XAML from the RTB is converted to HTML and written to the TextEditor.Document.Text property.
This apparently wipes out the undo stack.
How can I push the state of the Document to the UndoStack so the user can "go back"? I tried wrapping the write operation in a RunUpdate() IDisposable, but that didn't work:
using (var _ = TextEditor.Document.RunUpdate())
{
TextEditor.Document.Text = html;
}
Any assistance would be greatly appreciated.