From e7893801260d1d168e54509b6c5734633549cdd4 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 30 Jan 2019 20:00:13 +0100 Subject: [PATCH] Move save to the instance --- src/panels/lovelace/components/hui-yaml-editor.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/components/hui-yaml-editor.ts b/src/panels/lovelace/components/hui-yaml-editor.ts index ba6c51cdba..4e531525c6 100644 --- a/src/panels/lovelace/components/hui-yaml-editor.ts +++ b/src/panels/lovelace/components/hui-yaml-editor.ts @@ -19,9 +19,6 @@ export class HuiYamlEditor extends HTMLElement { public constructor() { super(); - CodeMirror.commands.save = () => { - fireEvent(this, "yaml-save"); - }; this._value = ""; const shadowRoot = this.attachShadow({ mode: "open" }); shadowRoot.innerHTML = ` @@ -77,6 +74,9 @@ export class HuiYamlEditor extends HTMLElement { }, }, }); + this.codemirror.commands.save = () => { + fireEvent(this, "yaml-save"); + }; fireEvent(this, "yaml-changed", { value: this._value }); this.codemirror.on("changes", () => this._onChange()); } else {