mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2025-02-02 04:17:55 +01:00
Fixed instant navigation anchor scoll restoration issue
This commit is contained in:
parent
c6fd95611d
commit
07a434b465
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -249,7 +249,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.60a45f97.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.5090c770.min.js' | url }}"></script>
|
||||||
{% for script in config.extra_javascript %}
|
{% for script in config.extra_javascript %}
|
||||||
{{ script | script_tag }}
|
{{ script | script_tag }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -366,15 +366,10 @@ export function setupInstantNavigation(
|
|||||||
// Handle instant navigation events that are triggered by the user clicking
|
// Handle instant navigation events that are triggered by the user clicking
|
||||||
// on an anchor link with a hash fragment different from the current one, as
|
// on an anchor link with a hash fragment different from the current one, as
|
||||||
// well as from popstate events, which are emitted when the user navigates
|
// well as from popstate events, which are emitted when the user navigates
|
||||||
// back and forth between pages. We use a two-layered subscription to scope
|
// back and forth between pages.
|
||||||
// the scroll restoration to the current page, as we don't need to restore
|
|
||||||
// the viewport offset when the user navigates to a different page, as this
|
|
||||||
// is already handled by the previous observable.
|
|
||||||
document$.pipe(
|
document$.pipe(
|
||||||
switchMap(() => location$),
|
switchMap(() => location$),
|
||||||
distinctUntilKeyChanged("pathname"),
|
distinctUntilKeyChanged("hash"),
|
||||||
switchMap(() => location$),
|
|
||||||
distinctUntilKeyChanged("hash")
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// Handle instant navigation events that are triggered by the user clicking
|
// Handle instant navigation events that are triggered by the user clicking
|
||||||
|
Loading…
x
Reference in New Issue
Block a user