mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed tab indicator on wrong position when using back button
This commit is contained in:
parent
8358a9b162
commit
6976b9fd31
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -214,7 +214,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.e87a5f81.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.5ea521e9.min.js' | url }}"></script>
|
||||
{% for path in config["extra_javascript"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -24,6 +24,7 @@ import {
|
||||
Observable,
|
||||
Subject,
|
||||
animationFrameScheduler,
|
||||
asyncScheduler,
|
||||
auditTime,
|
||||
combineLatest,
|
||||
defer,
|
||||
@ -33,6 +34,7 @@ import {
|
||||
mapTo,
|
||||
merge,
|
||||
startWith,
|
||||
subscribeOn,
|
||||
takeLast,
|
||||
takeUntil,
|
||||
tap
|
||||
@ -73,7 +75,8 @@ export interface ContentTabs {
|
||||
export function watchContentTabs(
|
||||
el: HTMLElement
|
||||
): Observable<ContentTabs> {
|
||||
const inputs = getElements(":scope > input", el)
|
||||
const inputs = getElements<HTMLInputElement>(":scope > input", el)
|
||||
const active = inputs.find(input => input.checked) || inputs[0]
|
||||
return merge(...inputs.map(input => fromEvent(input, "change")
|
||||
.pipe(
|
||||
mapTo<ContentTabs>({
|
||||
@ -83,7 +86,7 @@ export function watchContentTabs(
|
||||
))
|
||||
.pipe(
|
||||
startWith({
|
||||
active: getElement(`label[for=${inputs[0].id}]`)
|
||||
active: getElement(`label[for=${active.id}]`)
|
||||
} as ContentTabs)
|
||||
)
|
||||
}
|
||||
@ -144,4 +147,7 @@ export function mountContentTabs(
|
||||
map(state => ({ ref: el, ...state }))
|
||||
)
|
||||
})
|
||||
.pipe(
|
||||
subscribeOn(asyncScheduler)
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user