【发布时间】:2015-06-19 10:13:12
【问题描述】:
我目前正致力于在 HTML 所见即所得/“源代码”并排编辑器中实现 AvalonEdit。当用户从设计模式 (a RichTextBox) 切换到源模式 (AvalonEdit TextEditor) 时,来自 RTB 的 XAML 将转换为 HTML 并写入 TextEditor.Document.Text 属性。
这显然会清除撤消堆栈。
如何将文档的状态推送到UndoStack,以便用户可以“返回”?我尝试将写入操作包装在 RunUpdate() IDisposable 中,但这不起作用:
using (var _ = TextEditor.Document.RunUpdate())
{
TextEditor.Document.Text = html;
}
任何帮助将不胜感激。
【问题讨论】:
标签: avalonedit