diff --git a/src/panels/lovelace/editor/card-editor/hui-card-editor.ts b/src/panels/lovelace/editor/card-editor/hui-card-editor.ts index 973b9bc4f0..ec1e0f026e 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-editor.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-editor.ts @@ -49,6 +49,7 @@ class HuiCardEditor extends LitElement { .hass=${this.hass} .lovelace=${this.lovelace} .value=${this.config} + show-toggle-mode-button > `; } diff --git a/src/panels/lovelace/editor/hui-element-editor.ts b/src/panels/lovelace/editor/hui-element-editor.ts index 1e71e455e1..f0f092883f 100644 --- a/src/panels/lovelace/editor/hui-element-editor.ts +++ b/src/panels/lovelace/editor/hui-element-editor.ts @@ -74,6 +74,9 @@ export abstract class HuiElementEditor extends LitElement { @property({ attribute: false }) public context?: C; + @property({ type: Boolean, attribute: "show-toggle-mode-button" }) + public showToggleModeButton = false; + @state() private _yaml?: string; @state() private _config?: T; @@ -217,9 +220,16 @@ export abstract class HuiElementEditor extends LitElement { return html`
- - ${guiModeAvailable && this._guiMode ? "Show yaml" : "Show UI"} - + ${this.showToggleModeButton + ? html` + + ${guiModeAvailable && this._guiMode ? "Show yaml" : "Show UI"} + + ` + : nothing} ${this.GUImode ? html`
diff --git a/src/translations/en.json b/src/translations/en.json index fb96580917..90ad315f99 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1803,7 +1803,7 @@ "editor_not_supported": "Visual editor not supported", "editor_not_supported_details": "The visual editor is not supported for type ''{type}''.", "warning_details": "The configuration contains the following warnings:", - "edit_in_yaml_supported": "You can still edit your config in YAML.", + "edit_in_yaml_supported": "You can still edit the configuration in YAML.", "key_missing": "Required key ''{key}'' is missing.", "key_not_expected": "Key ''{key}'' is not expected or not supported by the visual editor.", "key_wrong_type": "The provided value for ''{key}'' is not supported by the visual editor. We support ({type_correct}) but received ({type_wrong}).",