mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-14 21:40:27 +00:00
Make chrome work-around work in iframes (#9200)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { HASSDomEvent, ValidHassDomEvent } from "../common/dom/fire_event";
|
||||
import { mainWindow } from "../common/dom/get_main_window";
|
||||
import { ProvideHassElement } from "../mixins/provide-hass-lit-mixin";
|
||||
|
||||
declare global {
|
||||
@@ -67,25 +68,26 @@ export const showDialog = async (
|
||||
}
|
||||
|
||||
if (addHistory) {
|
||||
top.history.replaceState(
|
||||
mainWindow.history.replaceState(
|
||||
{
|
||||
dialog: dialogTag,
|
||||
open: false,
|
||||
oldState:
|
||||
top.history.state?.open && top.history.state?.dialog !== dialogTag
|
||||
? top.history.state
|
||||
mainWindow.history.state?.open &&
|
||||
mainWindow.history.state?.dialog !== dialogTag
|
||||
? mainWindow.history.state
|
||||
: null,
|
||||
},
|
||||
""
|
||||
);
|
||||
try {
|
||||
top.history.pushState(
|
||||
mainWindow.history.pushState(
|
||||
{ dialog: dialogTag, dialogParams: dialogParams, open: true },
|
||||
""
|
||||
);
|
||||
} catch (err) {
|
||||
// dialogParams could not be cloned, probably contains callback
|
||||
top.history.pushState(
|
||||
mainWindow.history.pushState(
|
||||
{ dialog: dialogTag, dialogParams: null, open: true },
|
||||
""
|
||||
);
|
||||
@@ -96,7 +98,10 @@ export const showDialog = async (
|
||||
};
|
||||
|
||||
export const replaceDialog = () => {
|
||||
top.history.replaceState({ ...top.history.state, replaced: true }, "");
|
||||
mainWindow.history.replaceState(
|
||||
{ ...mainWindow.history.state, replaced: true },
|
||||
""
|
||||
);
|
||||
};
|
||||
|
||||
export const closeDialog = async (dialogTag: string): Promise<boolean> => {
|
||||
|
||||
Reference in New Issue
Block a user