mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Improved graceful handling of broken search when browsing locally
This commit is contained in:
parent
52d773b81b
commit
580f1181f5
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -223,7 +223,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.d7b0ad22.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.ddd52ceb.min.js' | url }}"></script>
|
||||
{% for path in config["extra_javascript"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -55,7 +55,7 @@ export function resetBackToTopState(
|
||||
* @param el - Back-to-top element
|
||||
* @param value - Back-to-top offset
|
||||
*/
|
||||
export function setBackToTopOffset(
|
||||
export function setBackToTopOffset(
|
||||
el: HTMLElement, value: number
|
||||
): void {
|
||||
el.style.top = `${value}px`
|
||||
|
@ -85,6 +85,7 @@ export function mountSearch(
|
||||
el: HTMLElement, { index$, keyboard$ }: MountOptions
|
||||
): Observable<Component<Search>> {
|
||||
const config = configuration()
|
||||
try {
|
||||
const worker = setupSearchWorker(config.search, index$)
|
||||
|
||||
/* Retrieve nested components */
|
||||
@ -177,4 +178,10 @@ export function mountSearch(
|
||||
query$,
|
||||
mountSearchResult(result, worker, { query$ })
|
||||
)
|
||||
|
||||
/* Gracefully handle broken search */
|
||||
} catch (err) {
|
||||
el.hidden = true
|
||||
return NEVER
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user