mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-30 04:36:36 +00:00
Only use toggle mode in card editor
This commit is contained in:
parent
4f2652abd2
commit
c8b7f373c3
@ -49,6 +49,7 @@ class HuiCardEditor extends LitElement {
|
||||
.hass=${this.hass}
|
||||
.lovelace=${this.lovelace}
|
||||
.value=${this.config}
|
||||
show-toggle-mode-button
|
||||
></hui-card-element-editor>
|
||||
`;
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ export abstract class HuiElementEditor<T, C = any> 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<T, C = any> extends LitElement {
|
||||
|
||||
return html`
|
||||
<div class="wrapper">
|
||||
<ha-button @click=${this.toggleMode} .disabled=${!guiModeAvailable}>
|
||||
${guiModeAvailable && this._guiMode ? "Show yaml" : "Show UI"}
|
||||
</ha-button>
|
||||
${this.showToggleModeButton
|
||||
? html`
|
||||
<ha-button
|
||||
@click=${this.toggleMode}
|
||||
.disabled=${!guiModeAvailable}
|
||||
>
|
||||
${guiModeAvailable && this._guiMode ? "Show yaml" : "Show UI"}
|
||||
</ha-button>
|
||||
`
|
||||
: nothing}
|
||||
${this.GUImode
|
||||
? html`
|
||||
<div class="gui-editor">
|
||||
|
@ -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}).",
|
||||
|
Loading…
x
Reference in New Issue
Block a user