From 735fbfb83dc59c085df176cdb954254b4c167835 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Wed, 5 Mar 2025 09:41:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B8=B2=E6=9F=93=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=92=8C=E7=95=8C=E9=9D=A2=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 `MarkdownWpfRenderer.cs` 中,更新了 `RenderHtmlBlock` 方法以处理以 `` 开头的文本,返回包含进度条和可选择文本块的 `Expander` 控件。更新了 `App.xaml`,移除了 `mu:ThemeDictionary` 的 `ColorMode` 属性。修改了 `AiMessageControll.xaml`,将布局从 `StackPanel` 更改为 `DockPanel`,并添加了 `ButtonGroup`。在 `ImportViewModel.cs` 中,调整了调试模式下的消息处理逻辑,确保正确处理用户输入的消息。 --- .../Markdown/MarkdownWpfRenderer.cs | 23 ++++++++----- src/ExcelHelper/App.xaml | 2 +- .../Views/Components/AiMessageControll.xaml | 34 ++++++++++++------- .../Views/ViewModels/ImportViewModel.cs | 6 ++-- 4 files changed, 41 insertions(+), 24 deletions(-) diff --git a/src/EleCho.MdViewer/src/EleCho.MdViewer/Markdown/MarkdownWpfRenderer.cs b/src/EleCho.MdViewer/src/EleCho.MdViewer/Markdown/MarkdownWpfRenderer.cs index 56d8b8a..79d9ea9 100644 --- a/src/EleCho.MdViewer/src/EleCho.MdViewer/Markdown/MarkdownWpfRenderer.cs +++ b/src/EleCho.MdViewer/src/EleCho.MdViewer/Markdown/MarkdownWpfRenderer.cs @@ -379,15 +379,22 @@ public class MarkdownWpfRenderer if (text.StartsWith("")) { text = text.Replace("", "").Replace("", ""); + var htmlText = new SelectableTextBlock(); + htmlText.Text = text; + var expander = new Expander(); + var header = new StackPanel(); + header.Children.Add(new ProgressBar() { IsIndeterminate = true, Width = 30 }); + expander.Header = header; + expander.Content = htmlText; + return expander; } - var htmlText = new SelectableTextBlock(); - htmlText.Text = text; - var expander = new Expander(); - var header = new StackPanel(); - header.Children.Add(new ProgressBar() { IsIndeterminate = true,Width = 30 }); - expander.Header = header; - expander.Content = htmlText; - return expander; + else + { + var htmlText = new SelectableTextBlock(); + htmlText.Text = text; + return htmlText; + } + } public FrameworkElement RenderMathBlock(MathBlock mathBlock, CancellationToken cancellationToken) diff --git a/src/ExcelHelper/App.xaml b/src/ExcelHelper/App.xaml index 880e27a..350e3ed 100644 --- a/src/ExcelHelper/App.xaml +++ b/src/ExcelHelper/App.xaml @@ -12,7 +12,7 @@ - + diff --git a/src/ExcelHelper/Views/Components/AiMessageControll.xaml b/src/ExcelHelper/Views/Components/AiMessageControll.xaml index f6fb8b7..3de91e0 100644 --- a/src/ExcelHelper/Views/Components/AiMessageControll.xaml +++ b/src/ExcelHelper/Views/Components/AiMessageControll.xaml @@ -88,18 +88,28 @@ - - - - + + +