Fixed closing of search results on anchor jump

This commit is contained in:
squidfunk
2020-03-12 17:13:31 +01:00
parent 566b1363ee
commit c0abaf5692
6 changed files with 14 additions and 21 deletions

View File

@@ -57,7 +57,8 @@ import {
watchLocationHash,
watchViewport,
isLocationInternal,
isLocationAnchor
isLocationAnchor,
setLocationHash
} from "./browser"
import { setupSearchWorker } from "./workers"
@@ -270,20 +271,12 @@ export function initialize(config: unknown) {
/* ----------------------------------------------------------------------- */
// // put into search...
// hash$
// .pipe(
// switchMap(hash => useToggle("search")
// .pipe(
// filter(x => x.checked), // only active
// tap(toggle => setToggle(toggle, false)),
// delay(125), // ensure that it runs after the body scroll reset...
// mapTo(hash)
// )
// )
// )
// .subscribe(hash => {
// getElement(`[id="${hash}"]`)!.scrollIntoView()
// })
hash$
.pipe(
tap(() => setToggle("search", false)),
delay(125), // ensure that it runs after the body scroll reset...
)
.subscribe(hash => setLocationHash(`#${hash}`)) // TODO: must be unified
// Scroll lock // document -> document$ => { body } !?
// put into search...