mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed restoration of scroll offset on page refresh
This commit is contained in:
parent
f38d0a8d64
commit
4d370fe903
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/bundle.630a9b34.min.js.map
Normal file
1
material/assets/javascripts/bundle.630a9b34.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.837e8062.min.js",
|
"assets/javascripts/bundle.js": "assets/javascripts/bundle.630a9b34.min.js",
|
||||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.837e8062.min.js.map",
|
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.630a9b34.min.js.map",
|
||||||
"assets/javascripts/vendor.js": "assets/javascripts/vendor.c1fcc1cc.min.js",
|
"assets/javascripts/vendor.js": "assets/javascripts/vendor.c1fcc1cc.min.js",
|
||||||
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.c1fcc1cc.min.js.map",
|
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.c1fcc1cc.min.js.map",
|
||||||
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.3bc815f0.min.js",
|
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.3bc815f0.min.js",
|
||||||
|
@ -175,7 +175,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/vendor.c1fcc1cc.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/vendor.c1fcc1cc.min.js' | url }}"></script>
|
||||||
<script src="{{ 'assets/javascripts/bundle.837e8062.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.630a9b34.min.js' | url }}"></script>
|
||||||
{%- set translations = {} -%}
|
{%- set translations = {} -%}
|
||||||
{%- for key in [
|
{%- for key in [
|
||||||
"clipboard.copy",
|
"clipboard.copy",
|
||||||
|
@ -349,20 +349,18 @@ export function initialize(config: unknown) {
|
|||||||
setToggle("drawer", false)
|
setToggle("drawer", false)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/* Hack: ensure that page loads restore scroll offset */
|
||||||
|
fromEvent(window, "beforeunload")
|
||||||
|
.subscribe(() => {
|
||||||
|
history.scrollRestoration = "auto"
|
||||||
|
})
|
||||||
|
|
||||||
// instant loading
|
// instant loading
|
||||||
if (config.features.includes("instant")) {
|
if (config.features.includes("instant")) {
|
||||||
|
|
||||||
/* Disable automatic scroll restoration, as it doesn't work nicely */
|
/* Disable automatic scroll restoration, as it doesn't work nicely */
|
||||||
location$
|
|
||||||
.pipe(
|
|
||||||
skip(1),
|
|
||||||
take(1)
|
|
||||||
)
|
|
||||||
.subscribe(() => {
|
|
||||||
console.log("disabled automatic scroll restoration")
|
|
||||||
if ("scrollRestoration" in history)
|
if ("scrollRestoration" in history)
|
||||||
history.scrollRestoration = "manual"
|
history.scrollRestoration = "manual"
|
||||||
})
|
|
||||||
|
|
||||||
/* Resolve relative links for stability */
|
/* Resolve relative links for stability */
|
||||||
for (const selector of [
|
for (const selector of [
|
||||||
@ -375,7 +373,6 @@ export function initialize(config: unknown) {
|
|||||||
setupInstantLoading({
|
setupInstantLoading({
|
||||||
document$, link$, location$, viewport$
|
document$, link$, location$, viewport$
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user