From ef1a1ea41fbc91e07a09355fea24d38c68aa7829 Mon Sep 17 00:00:00 2001 From: Piotr Machowski <6118709+PiotrMachowski@users.noreply.github.com> Date: Thu, 11 Jul 2024 12:23:26 +0200 Subject: [PATCH] Fix editor detection --- src/xiaomi-vacuum-map-card.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xiaomi-vacuum-map-card.ts b/src/xiaomi-vacuum-map-card.ts index dbc211a8..18d5ec4b 100644 --- a/src/xiaomi-vacuum-map-card.ts +++ b/src/xiaomi-vacuum-map-card.ts @@ -827,7 +827,7 @@ 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 != null && isInEditor(e.parentElement) || e.parentNode?.toString() == "[object ShadowRoot]" && isInEditor((e.getRootNode() as ShadowRoot).host); }