Allow to remove config entry name (#5607)

* Allow to remove config entry name

* Add enter handling to prompt
This commit is contained in:
Bram Kragten
2020-04-24 10:35:43 +02:00
committed by GitHub
parent 49f2fd2af7
commit 301a964a65
2 changed files with 8 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ class DialogBox extends LitElement {
autofocus
.value=${this._value}
@value-changed=${this._valueChanged}
@keyup=${this._handleKeyUp}
.label=${this._params.inputLabel
? this._params.inputLabel
: ""}
@@ -112,6 +113,12 @@ class DialogBox extends LitElement {
this._params = undefined;
}
private _handleKeyUp(ev: KeyboardEvent) {
if (ev.keyCode === 13) {
this._confirm();
}
}
private async _confirm(): Promise<void> {
if (this._params!.confirm) {
this._params!.confirm(this._value);