Skip to content

Commit

Permalink
Merge pull request #750 from PiotrMachowski/bugfix/editor-detection
Browse files Browse the repository at this point in the history
Fix editor detection for sections view
  • Loading branch information
PiotrMachowski authored Jul 16, 2024
2 parents c1ca5c0 + 049b8ed commit 392a72e
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 392a72e

Please sign in to comment.