mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed expanded sections not collapsing on first click
This commit is contained in:
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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% 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"] %}
|
{% for path in config["extra_javascript"] %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -20,7 +20,14 @@
|
|||||||
* IN THE SOFTWARE.
|
* 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"
|
import { getElements } from "~/browser"
|
||||||
|
|
||||||
@@ -50,13 +57,24 @@ interface PatchOptions {
|
|||||||
export function patchIndeterminate(
|
export function patchIndeterminate(
|
||||||
{ document$ }: PatchOptions
|
{ document$ }: PatchOptions
|
||||||
): void {
|
): void {
|
||||||
document$.subscribe(() => {
|
document$
|
||||||
for (const el of getElements<HTMLInputElement>(
|
.pipe(
|
||||||
"[data-md-state=indeterminate]"
|
switchMap(() => of(...getElements<HTMLInputElement>(
|
||||||
)) {
|
"[data-md-state=indeterminate]"
|
||||||
el.setAttribute("data-md-state", "")
|
))),
|
||||||
el.indeterminate = true
|
tap(el => {
|
||||||
el.checked = false
|
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
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user