when navigating between fronend & backend,
you return to the last url you worked on
This commit is contained in:
parent
281fbec596
commit
c5c21d6929
|
@ -5,7 +5,7 @@
|
||||||
import { get } from "builderStore/api"
|
import { get } from "builderStore/api"
|
||||||
|
|
||||||
import { fade } from "svelte/transition"
|
import { fade } from "svelte/transition"
|
||||||
import { isActive, goto, layout } from "@sveltech/routify"
|
import { isActive, goto, layout, url } from "@sveltech/routify"
|
||||||
|
|
||||||
import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
|
import { SettingsIcon, PreviewIcon } from "components/common/Icons/"
|
||||||
import IconButton from "components/common/IconButton.svelte"
|
import IconButton from "components/common/IconButton.svelte"
|
||||||
|
@ -27,6 +27,17 @@
|
||||||
throw new Error(pkg)
|
throw new Error(pkg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const topItemNavigate = path => () => {
|
||||||
|
const activeTopNav = $layout.children.find(c => $isActive(c.path))
|
||||||
|
if (!activeTopNav) return
|
||||||
|
store.update(state => {
|
||||||
|
if (!state.previousTopNavPath) state.previousTopNavPath = {}
|
||||||
|
state.previousTopNavPath[activeTopNav.path] = window.location.pathname.replace("/_builder", "")
|
||||||
|
$goto(state.previousTopNavPath[path] || path)
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Modal>
|
<Modal>
|
||||||
|
@ -46,7 +57,7 @@
|
||||||
<span
|
<span
|
||||||
class:active={$isActive(path)}
|
class:active={$isActive(path)}
|
||||||
class="topnavitem"
|
class="topnavitem"
|
||||||
on:click={() => $goto(path)}>
|
on:click={topItemNavigate(path)}>
|
||||||
{title}
|
{title}
|
||||||
</span>
|
</span>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
Loading…
Reference in New Issue