Refresh card embedded yaml editors on dialog open (#6307)

This commit is contained in:
Bram Kragten 2020-07-02 18:15:20 +02:00 committed by GitHub
parent 06a94f0f28
commit 57c0b34ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -128,6 +128,9 @@ export class HuiCardEditor extends LitElement {
}
public refreshYamlEditor(focus = false) {
if (this._configElement?.refreshYamlEditor) {
this._configElement.refreshYamlEditor(focus);
}
if (!this._yamlEditor?.codemirror) {
return;
}

View File

@ -56,6 +56,10 @@ export class HuiConditionalCardEditor extends LitElement
this._config = cardConfigStruct(config);
}
public refreshYamlEditor(focus) {
this._cardEditorEl?.refreshYamlEditor(focus);
}
protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
@ -195,7 +199,7 @@ export class HuiConditionalCardEditor extends LitElement
private _setMode(value: boolean): void {
this._GUImode = value;
if (this._cardEditorEl) {
this._cardEditorEl!.GUImode = value;
this._cardEditorEl.GUImode = value;
}
}

View File

@ -51,6 +51,10 @@ export class HuiStackCardEditor extends LitElement
this._config = cardConfigStruct(config);
}
public refreshYamlEditor(focus) {
this._cardEditorEl?.refreshYamlEditor(focus);
}
protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;

View File

@ -57,4 +57,5 @@ export interface LovelaceCardEditor extends HTMLElement {
hass?: HomeAssistant;
lovelace?: LovelaceConfig;
setConfig(config: LovelaceCardConfig): void;
refreshYamlEditor?: (focus: boolean) => void;
}