From 049b8edbfd9f96aa730f8555a19b57ead9da0946 Mon Sep 17 00:00:00 2001 From: Piotr Machowski Date: Wed, 17 Jul 2024 00:36:58 +0200 Subject: [PATCH] Fix editor detection for sections view --- package.json | 2 +- src/xiaomi-vacuum-map-card.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 471d9143..2c74741b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaomi-vacuum-map-card", - "version": "v2.2.3", + "version": "v2.2.4", "description": "Xiaomi Vacuum Map Card", "keywords": [ "home-assistant", diff --git a/src/xiaomi-vacuum-map-card.ts b/src/xiaomi-vacuum-map-card.ts index 7b082463..f0c0adae 100644 --- a/src/xiaomi-vacuum-map-card.ts +++ b/src/xiaomi-vacuum-map-card.ts @@ -828,6 +828,7 @@ export class XiaomiVacuumMapCard extends LitElement { private _isInEditor(): boolean { function isInEditor(e: Element): boolean { 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);