feat(ui): add auto-save LostFocus handlers and tag input KeyDown
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using ClaudeDo.Ui.ViewModels;
|
||||||
|
|
||||||
namespace ClaudeDo.Ui.Views;
|
namespace ClaudeDo.Ui.Views;
|
||||||
|
|
||||||
@@ -9,6 +12,23 @@ public partial class TaskDetailView : UserControl
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFieldLostFocus(object? sender, Avalonia.Interactivity.RoutedEventArgs e) { }
|
private async void OnFieldLostFocus(object? sender, RoutedEventArgs e)
|
||||||
private void OnTagInputKeyDown(object? sender, Avalonia.Input.KeyEventArgs e) { }
|
{
|
||||||
|
if (DataContext is TaskDetailViewModel vm)
|
||||||
|
await vm.SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTagInputKeyDown(object? sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter && DataContext is TaskDetailViewModel vm)
|
||||||
|
{
|
||||||
|
vm.AddTagCommand.Execute(null);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FocusTitle()
|
||||||
|
{
|
||||||
|
this.FindControl<TextBox>("TitleBox")?.Focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user