Skip to content

Commit

Permalink
Fix editor detection for sections view
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrMachowski committed Jul 16, 2024
1 parent c1ca5c0 commit 049b8ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/xiaomi-vacuum-map-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 049b8ed

Please sign in to comment.