Skip to content

Commit

Permalink
Update xiaomi-vacuum-map-card.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
sca075 authored Jan 19, 2025
1 parent b8dab26 commit 2885a66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/xiaomi-vacuum-map-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,9 @@ export class XiaomiVacuumMapCard extends LitElement {

private _isInEditor(): boolean {
function isInEditor(e: Element): boolean {
return e.parentElement?.tagName?.toLowerCase() === "hui-card-preview"
return (e.parentElement?.tagName?.toLowerCase() === "hui-card" && "preview" in (e.parentElement?.attributes ?? []))
|| (e.parentElement?.tagName?.toLowerCase() === "hui-section" && "preview" in (e.parentElement?.attributes ?? []))
|| e.parentElement?.tagName?.toLowerCase() === "hui-card-preview"
|| e.parentElement != null && isInEditor(e.parentElement)
|| e.parentNode?.toString() == "[object ShadowRoot]" && isInEditor((e.getRootNode() as ShadowRoot).host);
}
Expand Down

0 comments on commit 2885a66

Please sign in to comment.