Fixed spellchecking config for single line dialog (#49)

This commit is contained in:
Thorsten Sommer 2024-07-26 13:41:22 +02:00 committed by GitHub
parent d6bd0dc45b
commit 0f06b96943
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 1 deletions

View File

@ -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>

View File

@ -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();