mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed search not closing on same anchor selection
This commit is contained in:
parent
68257348b8
commit
8a812aed83
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.a6761dc7.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.56861ea1.min.js' | url }}"></script>
|
||||
{% for path in config.extra_javascript %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
Observable,
|
||||
ObservableInput,
|
||||
filter,
|
||||
fromEvent,
|
||||
merge,
|
||||
mergeWith
|
||||
} from "rxjs"
|
||||
@ -112,6 +113,15 @@ export function mountSearch(
|
||||
const query = getComponentElement("search-query", el)
|
||||
const result = getComponentElement("search-result", el)
|
||||
|
||||
/* Always close search on result selection */
|
||||
fromEvent<PointerEvent>(el, "click")
|
||||
.pipe(
|
||||
filter(({ target }) => (
|
||||
target instanceof Element && !!target.closest("a")
|
||||
))
|
||||
)
|
||||
.subscribe(() => setToggle("search", false))
|
||||
|
||||
/* Set up search keyboard handlers */
|
||||
keyboard$
|
||||
.pipe(
|
||||
|
Loading…
Reference in New Issue
Block a user