mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed wrong URLs in search when instant loading is enabled
This commit is contained in:
parent
c98e2d39c7
commit
8556912bb4
@ -79,21 +79,13 @@ export function setupSearchWorker(
|
|||||||
): WorkerHandler<SearchMessage> {
|
): WorkerHandler<SearchMessage> {
|
||||||
const worker = new Worker(url)
|
const worker = new Worker(url)
|
||||||
|
|
||||||
/* Compute new base URL when location changes */
|
/* Ensure stable base URL */
|
||||||
const origin$ = location$
|
const origin$ = location$
|
||||||
.pipe(
|
|
||||||
withLatestFrom(location$
|
|
||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map(({ href }) => new URL(base, href))
|
map(({ href }) => new URL(base, href)
|
||||||
)
|
.toString()
|
||||||
),
|
.replace(/\/$/, "")
|
||||||
map(([location, origin]) => location.href
|
|
||||||
.replace(origin.href, "")
|
|
||||||
.split("/")
|
|
||||||
.slice(1)
|
|
||||||
.map(() => "..")
|
|
||||||
.join("/")
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user