From 1e32ae6723f294840a3097742f299c38f7bb5406 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Thu, 23 Jan 2025 13:25:41 +0100 Subject: [PATCH] Added the spellchecking attribute --- .../Components/TextInfoLine.razor | 3 ++- .../Components/TextInfoLine.razor.cs | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/MindWork AI Studio/Components/TextInfoLine.razor b/app/MindWork AI Studio/Components/TextInfoLine.razor index b3bf2ba..5e5de4d 100644 --- a/app/MindWork AI Studio/Components/TextInfoLine.razor +++ b/app/MindWork AI Studio/Components/TextInfoLine.razor @@ -7,7 +7,8 @@ Variant="Variant.Outlined" Margin="Margin.Dense" Adornment="Adornment.Start" - AdornmentIcon="@this.Icon"/> + AdornmentIcon="@this.Icon" + UserAttributes="@USER_INPUT_ATTRIBUTES" /> @if (this.ShowingCopyButton) { diff --git a/app/MindWork AI Studio/Components/TextInfoLine.razor.cs b/app/MindWork AI Studio/Components/TextInfoLine.razor.cs index a68f25f..4c4e640 100644 --- a/app/MindWork AI Studio/Components/TextInfoLine.razor.cs +++ b/app/MindWork AI Studio/Components/TextInfoLine.razor.cs @@ -1,3 +1,5 @@ +using AIStudio.Settings; + using Microsoft.AspNetCore.Components; namespace AIStudio.Components; @@ -25,6 +27,23 @@ public partial class TextInfoLine : ComponentBase [Inject] private ISnackbar Snackbar { get; init; } = null!; + [Inject] + private SettingsManager SettingsManager { get; init; } = null!; + + #region Overrides of ComponentBase + + protected override async Task OnInitializedAsync() + { + // Configure the spellchecking for the user input: + this.SettingsManager.InjectSpellchecking(USER_INPUT_ATTRIBUTES); + + await base.OnInitializedAsync(); + } + + #endregion + + private static readonly Dictionary USER_INPUT_ATTRIBUTES = new(); + private string ClipboardTooltip => $"Copy {this.ClipboardTooltipSubject} to the clipboard"; private async Task CopyToClipboard(string content) => await this.RustService.CopyText2Clipboard(this.Snackbar, content);