Submit on enter

This commit is contained in:
Bram Kragten 2023-06-28 16:06:44 +02:00
parent dccb565a7f
commit 6573555c1d
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B
1 changed files with 9 additions and 0 deletions

View File

@ -51,6 +51,14 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
this._language = ev.detail.value;
}
private _handleKeyDown(e: KeyboardEvent) {
if (e.code !== "Enter" || e.shiftKey) {
return;
}
e.preventDefault();
this._parse();
}
private _textAreaInput(ev) {
const value = ev.target.value;
const valid = Boolean(value);
@ -130,6 +138,7 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
label="Sentences"
id="sentences-input"
@input=${this._textAreaInput}
@keydown=${this._handleKeyDown}
></ha-textarea>
</div>
<div class="card-actions">