parent
32700c7311
commit
d65c34757a
|
@ -623,9 +623,7 @@ class ButtonCard extends LitElement {
|
||||||
};
|
};
|
||||||
result = html`
|
result = html`
|
||||||
${result}
|
${result}
|
||||||
<div id=${key} class="ellipsis" style=${styleMap(customStyle)}>
|
<div id=${key} class="ellipsis" style=${styleMap(customStyle)}>${this._unsafeHTMLorNot(fields[key])}</div>
|
||||||
${(fields[key] as any).type === 'html' ? fields[key] : unsafeHTML(fields[key])}
|
|
||||||
</div>
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -853,6 +851,14 @@ class ButtonCard extends LitElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _unsafeHTMLorNot(input: any): any {
|
||||||
|
if (input.strings || input.values) {
|
||||||
|
return input;
|
||||||
|
} else {
|
||||||
|
return unsafeHTML(`${input}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private _gridHtml(
|
private _gridHtml(
|
||||||
state: HassEntity | undefined,
|
state: HassEntity | undefined,
|
||||||
configState: StateConfig | undefined,
|
configState: StateConfig | undefined,
|
||||||
|
@ -880,21 +886,21 @@ class ButtonCard extends LitElement {
|
||||||
${name
|
${name
|
||||||
? html`
|
? html`
|
||||||
<div id="name" class="ellipsis" style=${styleMap(nameStyleFromConfig)}>
|
<div id="name" class="ellipsis" style=${styleMap(nameStyleFromConfig)}>
|
||||||
${(name as any).type === 'html' ? name : unsafeHTML(name)}
|
${this._unsafeHTMLorNot(name)}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ''}
|
: ''}
|
||||||
${stateString
|
${stateString
|
||||||
? html`
|
? html`
|
||||||
<div id="state" class="ellipsis" style=${styleMap(stateStyleFromConfig)}>
|
<div id="state" class="ellipsis" style=${styleMap(stateStyleFromConfig)}>
|
||||||
${(stateString as any).type === 'html' ? stateString : unsafeHTML(stateString)}
|
${this._unsafeHTMLorNot(stateString)}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ''}
|
: ''}
|
||||||
${label && !lastChangedTemplate
|
${label && !lastChangedTemplate
|
||||||
? html`
|
? html`
|
||||||
<div id="label" class="ellipsis" style=${styleMap(labelStyleFromConfig)}>
|
<div id="label" class="ellipsis" style=${styleMap(labelStyleFromConfig)}>
|
||||||
${(label as any).type === 'html' ? label : unsafeHTML(label)}
|
${this._unsafeHTMLorNot(label)}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: ''}
|
: ''}
|
||||||
|
|
Loading…
Reference in New Issue