Added the ability to send commands using the Enter key and not clicking the button

Was about time lol
This commit is contained in:
Marcel Baumgartner 2024-04-15 18:40:53 +02:00
parent e25b005643
commit e3f040c978

View file

@ -18,7 +18,7 @@
<Terminal @ref="Terminal"/>
<div class="mt-3">
<div class="input-group">
<input @bind="CommandInput" class="form-control form-control-transparent text-white" placeholder="Enter command"/>
<input @bind="CommandInput" @bind:event="onchange" @onkeyup="OnEnterPressed" class="form-control form-control-transparent text-white" placeholder="Enter command"/>
<WButton CssClasses="btn btn-secondary rounded-start" Text="Execute" OnClick="SendCommand"/>
</div>
</div>
@ -118,6 +118,14 @@
await InvokeAsync(StateHasChanged);
}
private async Task OnEnterPressed(KeyboardEventArgs args)
{
if(args.Code != "Enter" || args.CtrlKey || args.ShiftKey)
return;
await SendCommand();
}
public void Dispose()
{