mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-12 01:50:52 +01:00
Fixed expanded sections not collapsing on first click
This commit is contained in:
parent
f87e32debe
commit
f05c34e30d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
32
material/assets/javascripts/bundle.da29d79a.min.js
vendored
Normal file
32
material/assets/javascripts/bundle.da29d79a.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
material/assets/javascripts/bundle.da29d79a.min.js.map
Normal file
7
material/assets/javascripts/bundle.da29d79a.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -217,7 +217,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.52a6371e.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.da29d79a.min.js' | url }}"></script>
|
||||
{% for path in config["extra_javascript"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -20,7 +20,14 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable } from "rxjs"
|
||||
import { Observable, fromEvent, of } from "rxjs"
|
||||
import {
|
||||
mapTo,
|
||||
mergeMap,
|
||||
switchMap,
|
||||
takeWhile,
|
||||
tap
|
||||
} from "rxjs/operators"
|
||||
|
||||
import { getElements } from "~/browser"
|
||||
|
||||
@ -50,13 +57,24 @@ interface PatchOptions {
|
||||
export function patchIndeterminate(
|
||||
{ document$ }: PatchOptions
|
||||
): void {
|
||||
document$.subscribe(() => {
|
||||
for (const el of getElements<HTMLInputElement>(
|
||||
document$
|
||||
.pipe(
|
||||
switchMap(() => of(...getElements<HTMLInputElement>(
|
||||
"[data-md-state=indeterminate]"
|
||||
)) {
|
||||
el.setAttribute("data-md-state", "")
|
||||
))),
|
||||
tap(el => {
|
||||
el.indeterminate = true
|
||||
el.checked = false
|
||||
}
|
||||
}),
|
||||
mergeMap(el => fromEvent(el, "change")
|
||||
.pipe(
|
||||
takeWhile(() => el.hasAttribute("data-md-state")),
|
||||
mapTo(el)
|
||||
)
|
||||
)
|
||||
)
|
||||
.subscribe(el => {
|
||||
el.removeAttribute("data-md-state")
|
||||
el.checked = false
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user