Skip to content

Commit

Permalink
maintaining hidden config through the editor
Browse files Browse the repository at this point in the history
  • Loading branch information
catdad committed Apr 19, 2024
1 parent 03ace3e commit 76b5b62
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/combined-card-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CombinedCardEditor extends LitElement implements LovelaceCardEditor {
private _hass?: HomeAssistant;
private _lovelace?: LovelaceConfig;
private _stackCardEditor?;
private _config = {};

private _setEditorConfig(config: LovelaceCardConfig) {
// @ts-ignore
Expand All @@ -18,20 +19,23 @@ class CombinedCardEditor extends LitElement implements LovelaceCardEditor {
}

setConfig(config: LovelaceCardConfig): void {
LOG('setConfig', config);
this._setEditorConfig(config);
this._config = {
...this._config,
...config
};

LOG('setConfig', this._config);
this._setEditorConfig(this._config as LovelaceCardConfig);
}

configChanged(newCondfig: LovelaceCardConfig): void {
configChanged(newConfig: LovelaceCardConfig): void {
const event = new Event('config-changed', {
bubbles: true,
composed: true
});

// @ts-ignore
event.detail = { config: newCondfig };

LOG('configChanged', newCondfig);
event.detail = { config: newConfig };

this.dispatchEvent(event);
}
Expand All @@ -51,6 +55,7 @@ class CombinedCardEditor extends LitElement implements LovelaceCardEditor {
ev.stopPropagation();

this.configChanged({
...this._config,
...ev.detail.config,
type: `custom:${NAME}`
});
Expand Down

0 comments on commit 76b5b62

Please sign in to comment.