Skip to content

Commit e71c5f2

Browse files
committed
fix: can not type in command palette
Signed-off-by: leo <longshuang@msn.cn>
1 parent 4d88ae2 commit e71c5f2

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

src/Views/Launcher.axaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@
127127
<Border Grid.Row="0" Grid.RowSpan="2"
128128
Background="Transparent"
129129
IsVisible="{Binding CommandPalette, Converter={x:Static ObjectConverters.IsNotNull}}"
130-
PointerPressed="OnCloseCommandPalette"
131-
KeyDown="OnCommandPaletteKeyDown"
132-
KeyUp="OnCommandPaletteKeyUp">
130+
PointerPressed="OnCloseCommandPalette">
133131
<Border Width="420" HorizontalAlignment="Center" VerticalAlignment="Center" Effect="drop-shadow(0 0 12 #A0000000)">
134132
<Border Background="{DynamicResource Brush.Popup}" CornerRadius="8">
135133
<ContentControl Margin="16,10,16,12" Content="{Binding CommandPalette}">

src/Views/Launcher.axaml.cs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ protected override async void OnKeyDown(KeyEventArgs e)
189189
}
190190
}
191191

192+
if (vm.CommandPalette != null)
193+
{
194+
if (e.Key == Key.Escape)
195+
vm.CommandPalette = null;
196+
return;
197+
}
198+
192199
if (e.KeyModifiers.HasFlag(OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control))
193200
{
194201
if (e.Key == Key.W)
@@ -395,23 +402,6 @@ private void OnCloseCommandPalette(object sender, PointerPressedEventArgs e)
395402
e.Handled = true;
396403
}
397404

398-
private void OnCommandPaletteKeyDown(object sender, KeyEventArgs e)
399-
{
400-
if (DataContext is ViewModels.Launcher { CommandPalette: { } } vm)
401-
{
402-
if (e.Key == Key.Escape)
403-
vm.CommandPalette = null;
404-
405-
e.Route = RoutingStrategies.Direct;
406-
e.Handled = true;
407-
}
408-
}
409-
410-
private void OnCommandPaletteKeyUp(object sender, KeyEventArgs e)
411-
{
412-
e.Handled = true;
413-
}
414-
415405
private WindowState _lastWindowState = WindowState.Normal;
416406
}
417407
}

0 commit comments

Comments
 (0)