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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% 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"] %}
|
{% for path in config["extra_javascript"] %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -24,6 +24,7 @@ import {
|
|||||||
Observable,
|
Observable,
|
||||||
Subject,
|
Subject,
|
||||||
animationFrameScheduler,
|
animationFrameScheduler,
|
||||||
|
asyncScheduler,
|
||||||
auditTime,
|
auditTime,
|
||||||
combineLatest,
|
combineLatest,
|
||||||
defer,
|
defer,
|
||||||
@ -33,6 +34,7 @@ import {
|
|||||||
mapTo,
|
mapTo,
|
||||||
merge,
|
merge,
|
||||||
startWith,
|
startWith,
|
||||||
|
subscribeOn,
|
||||||
takeLast,
|
takeLast,
|
||||||
takeUntil,
|
takeUntil,
|
||||||
tap
|
tap
|
||||||
@ -73,7 +75,8 @@ export interface ContentTabs {
|
|||||||
export function watchContentTabs(
|
export function watchContentTabs(
|
||||||
el: HTMLElement
|
el: HTMLElement
|
||||||
): Observable<ContentTabs> {
|
): 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")
|
return merge(...inputs.map(input => fromEvent(input, "change")
|
||||||
.pipe(
|
.pipe(
|
||||||
mapTo<ContentTabs>({
|
mapTo<ContentTabs>({
|
||||||
@ -83,7 +86,7 @@ export function watchContentTabs(
|
|||||||
))
|
))
|
||||||
.pipe(
|
.pipe(
|
||||||
startWith({
|
startWith({
|
||||||
active: getElement(`label[for=${inputs[0].id}]`)
|
active: getElement(`label[for=${active.id}]`)
|
||||||
} as ContentTabs)
|
} as ContentTabs)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -144,4 +147,7 @@ export function mountContentTabs(
|
|||||||
map(state => ({ ref: el, ...state }))
|
map(state => ({ ref: el, ...state }))
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
.pipe(
|
||||||
|
subscribeOn(asyncScheduler)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user