Skip to content

Commit

Permalink
Merge pull request #748 from PiotrMachowski/bugfix-editor-detection
Browse files Browse the repository at this point in the history
Fix editor detection
  • Loading branch information
PiotrMachowski authored Jul 12, 2024
2 parents 9f01e6b + ef1a1ea commit 955bcb9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/xiaomi-vacuum-map-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 955bcb9

Please sign in to comment.