Add function to close side panel based on the browser's history. (#13944)
* Add function to close side panel based on the browser's history. * Switched to hashchange, removed from SidePanel, added to ClientApp.svelte * Removed unused onMount, fixed lint issue * Removed unnecessary if statement.
This commit is contained in:
parent
c6a7bf6ed1
commit
92f9501d26
|
@ -19,6 +19,7 @@
|
||||||
devToolsStore,
|
devToolsStore,
|
||||||
devToolsEnabled,
|
devToolsEnabled,
|
||||||
environmentStore,
|
environmentStore,
|
||||||
|
sidePanelStore,
|
||||||
} from "stores"
|
} from "stores"
|
||||||
import NotificationDisplay from "components/overlay/NotificationDisplay.svelte"
|
import NotificationDisplay from "components/overlay/NotificationDisplay.svelte"
|
||||||
import ConfirmationDisplay from "components/overlay/ConfirmationDisplay.svelte"
|
import ConfirmationDisplay from "components/overlay/ConfirmationDisplay.svelte"
|
||||||
|
@ -102,6 +103,16 @@
|
||||||
embedded: !!$appStore.embedded,
|
embedded: !!$appStore.embedded,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const handleHashChange = () => {
|
||||||
|
const { open } = $sidePanelStore
|
||||||
|
if (open) {
|
||||||
|
sidePanelStore.actions.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.addEventListener("hashchange", handleHashChange)
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("hashchange", handleHashChange)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $: {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Derive visibility
|
// Derive visibility
|
||||||
$: open = $sidePanelStore.contentId === $component.id
|
$: open = $sidePanelStore.contentId === $component.id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue