Fixed spellchecking config for single line dialog (#49)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2024-07-26 13:41:22 +02:00
1 parent d6bd0dc45b
commit 0f06b96943
2 files changed
+19 -1

No files matched your search

@@ -1,7 +1,7 @@
<MudDialog>
<DialogContent>
<MudText Typo="Typo.body1">@this.Message</MudText>
<MudTextField T="string" @bind-Text="@this.UserInput" Variant="Variant.Outlined" AutoGrow="@false" Lines="1" Label="Chat name" AutoFocus="@true"/>
<MudTextField T="string" @bind-Text="@this.UserInput" Variant="Variant.Outlined" AutoGrow="@false" Lines="1" Label="Chat name" AutoFocus="@true" UserAttributes="@USER_INPUT_ATTRIBUTES"/>
</DialogContent>
<DialogActions>
<MudButton OnClick="@this.Cancel" Variant="Variant.Filled">Cancel</MudButton>
@@ -1,3 +1,5 @@
using AIStudio.Settings;
using Microsoft.AspNetCore.Components;
namespace AIStudio.Components.CommonDialogs;
@@ -18,6 +20,22 @@ public partial class SingleInputDialog : ComponentBase
[Parameter]
public Color ConfirmColor { get; set; } = Color.Error;
[Inject]
private SettingsManager SettingsManager { get; set; } = null!;
private static readonly Dictionary<string, object?> USER_INPUT_ATTRIBUTES = new();
#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 void Cancel() => this.MudDialog.Cancel();