diff --git a/src/panels/config/script/ha-script-editor.ts b/src/panels/config/script/ha-script-editor.ts index 16c90ebc1e..03f57fc674 100644 --- a/src/panels/config/script/ha-script-editor.ts +++ b/src/panels/config/script/ha-script-editor.ts @@ -176,7 +176,11 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) { ${this.narrow ? html` ${this._config?.alias} ` : ""} -
+
${this._errors ? html`
${this._errors}
` : ""} @@ -350,44 +354,43 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) { ` : this._mode === "yaml" ? html` - - ${!this.narrow - ? html`${this._config?.alias}` - : ``} - -
- - - ${this.hass.localize( - "ui.panel.config.automation.editor.copy_to_clipboard" - )} - -
- ${this.scriptEntityId - ? html` -
+ ${this._config?.alias} +
+
+ - - - ${this.hass.localize( - "ui.panel.config.script.picker.run_script" - )} - -
- ` - : ``} - - + ${this.hass.localize( + "ui.panel.config.script.picker.run_script" + )} + +
+
+ ` + : ``} + +
+ + ${this.hass.localize( + "ui.panel.config.automation.editor.copy_to_clipboard" + )} + +
+
` : ``}
@@ -532,7 +535,12 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) { if ((this._config![name] || "") === newVal) { return; } - this._config = { ...this._config!, [name]: newVal }; + if (!newVal) { + delete this._config![name]; + this._config = { ...this._config! }; + } else { + this._config = { ...this._config!, [name]: newVal }; + } this._dirty = true; } @@ -693,6 +701,22 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) { .content { padding-bottom: 20px; } + .yaml-mode { + height: 100%; + display: flex; + flex-direction: column; + padding-bottom: 0; + } + ha-yaml-editor { + flex-grow: 1; + --code-mirror-height: 100%; + min-height: 0; + } + .yaml-mode ha-card { + overflow: initial; + --ha-card-border-radius: 0; + border-bottom: 1px solid var(--divider-color); + } span[slot="introduction"] a { color: var(--primary-color); }