From 1ac441e794a2195cdeb3cd072e9739dcf15371ef Mon Sep 17 00:00:00 2001 From: Ionite Date: Mon, 18 Sep 2023 16:12:48 -0400 Subject: [PATCH] Move editor flyouts to shared resource dictionary --- StabilityMatrix.Avalonia/App.axaml | 1 + .../Controls/EditorCommands.cs | 16 +++++++++++ .../Controls/EditorFlyouts.axaml | 27 ++++++++++++++++++ .../Controls/PromptCard.axaml | 28 +------------------ 4 files changed, 45 insertions(+), 27 deletions(-) create mode 100644 StabilityMatrix.Avalonia/Controls/EditorCommands.cs create mode 100644 StabilityMatrix.Avalonia/Controls/EditorFlyouts.axaml diff --git a/StabilityMatrix.Avalonia/App.axaml b/StabilityMatrix.Avalonia/App.axaml index 9618b1e8..fa522b62 100644 --- a/StabilityMatrix.Avalonia/App.axaml +++ b/StabilityMatrix.Avalonia/App.axaml @@ -19,6 +19,7 @@ + diff --git a/StabilityMatrix.Avalonia/Controls/EditorCommands.cs b/StabilityMatrix.Avalonia/Controls/EditorCommands.cs new file mode 100644 index 00000000..ba2e9097 --- /dev/null +++ b/StabilityMatrix.Avalonia/Controls/EditorCommands.cs @@ -0,0 +1,16 @@ +using AvaloniaEdit; +using CommunityToolkit.Mvvm.Input; + +namespace StabilityMatrix.Avalonia.Controls; + +public static class EditorCommands +{ + public static RelayCommand CopyCommand { get; } = + new(editor => editor?.Copy(), editor => editor?.CanCopy ?? false); + + public static RelayCommand CutCommand { get; } = + new(editor => editor?.Cut(), editor => editor?.CanCut ?? false); + + public static RelayCommand PasteCommand { get; } = + new(editor => editor?.Paste(), editor => editor?.CanPaste ?? false); +} diff --git a/StabilityMatrix.Avalonia/Controls/EditorFlyouts.axaml b/StabilityMatrix.Avalonia/Controls/EditorFlyouts.axaml new file mode 100644 index 00000000..e52851b1 --- /dev/null +++ b/StabilityMatrix.Avalonia/Controls/EditorFlyouts.axaml @@ -0,0 +1,27 @@ + + + + + + + + diff --git a/StabilityMatrix.Avalonia/Controls/PromptCard.axaml b/StabilityMatrix.Avalonia/Controls/PromptCard.axaml index d266d0cd..09206a97 100644 --- a/StabilityMatrix.Avalonia/Controls/PromptCard.axaml +++ b/StabilityMatrix.Avalonia/Controls/PromptCard.axaml @@ -7,7 +7,6 @@ xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity" xmlns:icons="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia" xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData" - xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:vmInference="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Inference" x:DataType="vmInference:PromptCardViewModel"> @@ -21,30 +20,6 @@ - - - - - - - - -