Fix closing hui-editor (#5132)

This commit is contained in:
Bram Kragten 2020-03-11 15:23:31 +01:00 committed by GitHub
parent e5db86363c
commit dbdbad2deb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -166,21 +166,23 @@ class LovelaceFullConfigEditor extends LitElement {
} }
} }
private _closeEditor() { private async _closeEditor() {
if (this._changed) { if (
showConfirmationDialog(this, { this._changed &&
!(await showConfirmationDialog(this, {
text: this.hass.localize( text: this.hass.localize(
"ui.panel.lovelace.editor.raw_editor.confirm_unsaved_changes" "ui.panel.lovelace.editor.raw_editor.confirm_unsaved_changes"
), ),
dismissText: this.hass!.localize("ui.common.no"), dismissText: this.hass!.localize("ui.common.no"),
confirmText: this.hass!.localize("ui.common.yes"), confirmText: this.hass!.localize("ui.common.yes"),
confirm: () => { }))
window.onbeforeunload = null; ) {
if (this.closeEditor) { return;
this.closeEditor(); }
}
}, window.onbeforeunload = null;
}); if (this.closeEditor) {
this.closeEditor();
} }
} }