mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-31 09:48:53 -04:00
Fixed details not opening on navigation (7.0.0 regression)
This commit is contained in:
@@ -20,8 +20,13 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable, fromEvent, of } from "rxjs"
|
||||
import { filter, map, share, startWith, switchMap } from "rxjs/operators"
|
||||
import { Observable, fromEvent } from "rxjs"
|
||||
import {
|
||||
filter,
|
||||
map,
|
||||
shareReplay,
|
||||
startWith
|
||||
} from "rxjs/operators"
|
||||
|
||||
import { createElement, getElement } from "~/browser"
|
||||
|
||||
@@ -68,7 +73,7 @@ export function watchLocationHash(): Observable<string> {
|
||||
map(getLocationHash),
|
||||
startWith(getLocationHash()),
|
||||
filter(hash => hash.length > 0),
|
||||
share()
|
||||
shareReplay(1)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -80,6 +85,7 @@ export function watchLocationHash(): Observable<string> {
|
||||
export function watchLocationTarget(): Observable<HTMLElement> {
|
||||
return watchLocationHash()
|
||||
.pipe(
|
||||
switchMap(id => of(getElement(`[id="${id}"]`)!))
|
||||
map(id => getElement(`[id="${id}"]`)!),
|
||||
filter(el => typeof el !== "undefined")
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user