mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed #1877: 404 on search index when search is disabled
This commit is contained in:
parent
f46334a955
commit
989b8597c5
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/bundle.a8472eec.min.js.map
Normal file
1
material/assets/javascripts/bundle.a8472eec.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.b7ed72fe.min.js",
|
||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.b7ed72fe.min.js.map",
|
||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.a8472eec.min.js",
|
||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.a8472eec.min.js.map",
|
||||
"assets/javascripts/vendor.js": "assets/javascripts/vendor.d1f5a259.min.js",
|
||||
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.d1f5a259.min.js.map",
|
||||
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.fae956e7.min.js",
|
||||
|
@ -183,7 +183,7 @@
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/vendor.d1f5a259.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.b7ed72fe.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.a8472eec.min.js' | url }}"></script>
|
||||
{%- set translations = {} -%}
|
||||
{%- for key in [
|
||||
"clipboard.copy",
|
||||
|
@ -237,32 +237,35 @@ export function initialize(config: unknown) {
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/* Search worker */
|
||||
const worker$ = defer(() => {
|
||||
const index = config.search && config.search.index
|
||||
? config.search.index
|
||||
: undefined
|
||||
/* Search worker - only if search is present */
|
||||
const worker$ = useComponent("search")
|
||||
.pipe(
|
||||
switchMap(() => defer(() => {
|
||||
const index = config.search && config.search.index
|
||||
? config.search.index
|
||||
: undefined
|
||||
|
||||
/* Fetch index if it wasn't passed explicitly */
|
||||
const index$ = typeof index !== "undefined"
|
||||
? from(index)
|
||||
: base$
|
||||
.pipe(
|
||||
switchMap(base => ajax({
|
||||
url: `${base}/search/search_index.json`,
|
||||
responseType: "json",
|
||||
withCredentials: true
|
||||
})
|
||||
.pipe<SearchIndex>(
|
||||
pluck("response")
|
||||
/* Fetch index if it wasn't passed explicitly */
|
||||
const index$ = typeof index !== "undefined"
|
||||
? from(index)
|
||||
: base$
|
||||
.pipe(
|
||||
switchMap(base => ajax({
|
||||
url: `${base}/search/search_index.json`,
|
||||
responseType: "json",
|
||||
withCredentials: true
|
||||
})
|
||||
.pipe<SearchIndex>(
|
||||
pluck("response")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
return of(setupSearchWorker(config.search.worker, {
|
||||
base$, index$
|
||||
}))
|
||||
})
|
||||
return of(setupSearchWorker(config.search.worker, {
|
||||
base$, index$
|
||||
}))
|
||||
}))
|
||||
)
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user