mirror of
https://github.com/Stone-Red-Code/Decho.git
synced 2026-09-04 00:46:11 +02:00
Add spell checker for message input box
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="GHSoftware.Avalonia.SpellChecker.Avalonia11" Version="0.3.3" />
|
||||||
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
|
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
|
||||||
<PackageReference Include="NetCoreAudio" Version="2.0.1" />
|
<PackageReference Include="NetCoreAudio" Version="2.0.1" />
|
||||||
<PackageReference Include="OsNotifications" Version="1.1.5" />
|
<PackageReference Include="OsNotifications" Version="1.1.5" />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Avalonia.Input;
|
|||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
|
using Avalonia.SpellChecker;
|
||||||
|
|
||||||
using Decho.Models;
|
using Decho.Models;
|
||||||
using Decho.ViewModels;
|
using Decho.ViewModels;
|
||||||
@@ -15,6 +16,8 @@ namespace Decho.Views;
|
|||||||
|
|
||||||
public partial class MessageComposerView : UserControl
|
public partial class MessageComposerView : UserControl
|
||||||
{
|
{
|
||||||
|
private readonly TextBoxSpellChecker _spellChecker;
|
||||||
|
|
||||||
public MessageComposerView()
|
public MessageComposerView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -25,6 +28,9 @@ public partial class MessageComposerView : UserControl
|
|||||||
|
|
||||||
// Intercept Enter before the TextBox processes it (AcceptsReturn=True would insert a newline)
|
// Intercept Enter before the TextBox processes it (AcceptsReturn=True would insert a newline)
|
||||||
MessageTextBox.AddHandler(InputElement.KeyDownEvent, OnTextBoxTunnelingKeyDown, RoutingStrategies.Tunnel);
|
MessageTextBox.AddHandler(InputElement.KeyDownEvent, OnTextBoxTunnelingKeyDown, RoutingStrategies.Tunnel);
|
||||||
|
|
||||||
|
_spellChecker = new TextBoxSpellChecker(SpellCheckerConfig.Create("en_GB"));
|
||||||
|
_spellChecker.Initialize(MessageTextBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDataContextChanged(object? sender, EventArgs e)
|
private void OnDataContextChanged(object? sender, EventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user