From 7d257cf00c0bd4fec6174719bfbe346085c1ed28 Mon Sep 17 00:00:00 2001 From: Yu Leng <42196638+moooyo@users.noreply.github.com> Date: Mon, 16 Jun 2025 08:36:45 +0800 Subject: [PATCH] [CmdPal][AOT] Replace CommunityToolkit.MarkdownTextBlock with CommunityToolkit.Lab.MarkdownTextBlock (#39974) ## Summary of the Pull Request Why? The old library doesn't support native AOT. They implement the new one but still in the lab project. There are some breaking changes. So, seems we can not 100% to make it align with the old version. https://github.com/CommunityToolkit/Labs-Windows/tree/main/components/MarkdownTextBlock compare: old: ![image](https://github.com/user-attachments/assets/c2d20d1c-77b8-4bd5-a6e9-45ef30e90ea4) new: ![image](https://github.com/user-attachments/assets/f65c1acd-ee91-491e-9efd-08ebd191dc58) old: ![image](https://github.com/user-attachments/assets/129bee49-04c3-4667-88d8-b27718ccd51b) ![image](https://github.com/user-attachments/assets/10c6f845-13ce-4e6b-8fbf-017c8a654fa2) ![image](https://github.com/user-attachments/assets/6f95de3f-e6fb-43a8-9a81-487b20f97f23) new: ![image](https://github.com/user-attachments/assets/f661731a-efc1-4ffd-86d1-f24cbbe3b9c3) ![image](https://github.com/user-attachments/assets/22cf3e24-f27b-4cef-8e80-352451323bb6) ![image](https://github.com/user-attachments/assets/46719831-905a-450e-b789-93bbedd418bd) old: ![image](https://github.com/user-attachments/assets/3dd7713a-f5fa-4e1d-90a1-30a518b5df36) new: ![image](https://github.com/user-attachments/assets/616a176f-a9aa-4f23-9f01-98b30a7c33c4) old: ![image](https://github.com/user-attachments/assets/5758b51c-44a3-4748-9092-c827009ccc8e) new: ![image](https://github.com/user-attachments/assets/8deed4cf-e87e-425f-b5a7-61dcab676e45) ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --------- Co-authored-by: Yu Leng --- .github/actions/spell-check/expect.txt | 1 + Directory.Packages.props | 1 + NOTICE.md | 1 + nuget.config | 4 ++++ .../ShortcutDialogContentControl.xaml | 2 +- .../ShortcutWithTextLabelControl.xaml | 2 +- .../ExtViews/ContentPage.xaml | 19 ++++++++++--------- .../Microsoft.CmdPal.UI.csproj | 3 ++- .../Microsoft.CmdPal.UI/Pages/ShellPage.xaml | 16 ++++++++++------ 9 files changed, 31 insertions(+), 18 deletions(-) diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 68555a02f9..21775f96b1 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -1385,6 +1385,7 @@ riid ringbuffer RKey RNumber +Rns rop ROUNDSMALL ROWSETEXT diff --git a/Directory.Packages.props b/Directory.Packages.props index 06f8e8ddef..d22518f8ef 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -20,6 +20,7 @@ + diff --git a/NOTICE.md b/NOTICE.md index f36311d4ea..d159d4ddfe 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1497,6 +1497,7 @@ SOFTWARE. - Appium.WebDriver 4.4.5 - Azure.AI.OpenAI 1.0.0-beta.17 - CommunityToolkit.Common 8.4.0 +- CommunityToolkit.Labs.WinUI.Controls.MarkdownTextBlock 0.1.250513-build.2126 - CommunityToolkit.Mvvm 8.4.0 - CommunityToolkit.WinUI.Animations 8.2.250402 - CommunityToolkit.WinUI.Collections 8.2.250402 diff --git a/nuget.config b/nuget.config index e6a17ffdfe..0d0e41fa92 100644 --- a/nuget.config +++ b/nuget.config @@ -3,10 +3,14 @@ + + + + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml index 7932a27e91..9ea4599b43 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutDialogContentControl.xaml @@ -5,7 +5,7 @@ xmlns:controls="using:Microsoft.CmdPal.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls" + xmlns:tk7controls="using:CommunityToolkit.Labs.WinUI.MarkdownTextBlock" x:Name="ShortcutContentControl" mc:Ignorable="d"> diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml index e7bc518dee..002fec482f 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml @@ -5,7 +5,7 @@ xmlns:controls="using:Microsoft.CmdPal.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls" + xmlns:tk7controls="using:CommunityToolkit.Labs.WinUI.MarkdownTextBlock" d:DesignHeight="300" d:DesignWidth="400" mc:Ignorable="d"> diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ContentPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ContentPage.xaml index 8cc1174a1b..3b2ed13d72 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ContentPage.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ContentPage.xaml @@ -11,14 +11,21 @@ xmlns:converters="using:CommunityToolkit.WinUI.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:Microsoft.CmdPal.UI" + xmlns:markdownTextBlockRns="using:CommunityToolkit.WinUI.Controls.MarkdownTextBlockRns" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:toolkit="using:CommunityToolkit.WinUI.UI.Controls" + xmlns:toolkit="using:CommunityToolkit.Labs.WinUI.MarkdownTextBlock" xmlns:viewmodels="using:Microsoft.CmdPal.UI.ViewModels" Background="Transparent" mc:Ignorable="d"> + + + @@ -63,10 +67,7 @@ diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj index 0b653d2d0a..6b727c5846 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj @@ -71,7 +71,8 @@ - + + diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml index 2dd0c5b6c4..460cc26cdd 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/ShellPage.xaml @@ -9,8 +9,10 @@ xmlns:cpcontrols="using:Microsoft.CmdPal.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:help="using:Microsoft.CmdPal.UI.Helpers" + xmlns:labToolkit="using:CommunityToolkit.Labs.WinUI.MarkdownTextBlock" + xmlns:markdownTextBlockRns="using:CommunityToolkit.WinUI.Controls.MarkdownTextBlockRns" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:toolkit="using:CommunityToolkit.WinUI.UI.Controls" + xmlns:toolkit="using:CommunityToolkit.WinUI.Controls" xmlns:ui="using:CommunityToolkit.WinUI" xmlns:viewModels="using:Microsoft.CmdPal.UI.ViewModels" Background="Transparent" @@ -144,6 +146,11 @@ + + @@ -408,14 +415,11 @@ TextWrapping="WrapWholeWords" Visibility="{x:Bind ViewModel.Details.Title, Converter={StaticResource StringNotEmptyToVisibilityConverter}, Mode=OneWay}" /> -