mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-08-04 03:25:13 -04:00
Added emoji index to icon search
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
import { Observable, ObservableInput, merge } from "rxjs"
|
||||
import { NEVER, Observable, ObservableInput, merge } from "rxjs"
|
||||
import { filter, sample, take } from "rxjs/operators"
|
||||
|
||||
import { configuration } from "~/_"
|
||||
@@ -99,6 +99,10 @@ function fetchSearchIndex(url: string): ObservableInput<SearchIndex> {
|
||||
export function mountSearch(
|
||||
el: HTMLElement, { keyboard$ }: MountOptions
|
||||
): Observable<Component<Search>> {
|
||||
if (location.protocol === "file:")
|
||||
return NEVER
|
||||
|
||||
/* Set up search worker */
|
||||
const config = configuration()
|
||||
const worker = setupSearchWorker(config.search, fetchSearchIndex(
|
||||
`${config.base}/search/search_index.json`
|
||||
|
||||
@@ -184,7 +184,7 @@ export function setupInstantLoading(
|
||||
const el = ev.target.closest("a")
|
||||
if (el && !el.target && urls.includes(el.href)) {
|
||||
ev.preventDefault()
|
||||
return of<HistoryState>({
|
||||
return of({
|
||||
url: new URL(el.href)
|
||||
})
|
||||
}
|
||||
@@ -193,7 +193,7 @@ export function setupInstantLoading(
|
||||
})
|
||||
)
|
||||
),
|
||||
share()
|
||||
share<HistoryState>()
|
||||
)
|
||||
|
||||
/* Intercept history back and forward */
|
||||
@@ -203,8 +203,8 @@ export function setupInstantLoading(
|
||||
map(ev => ({
|
||||
url: new URL(location.href),
|
||||
offset: ev.state
|
||||
} as HistoryState)),
|
||||
share()
|
||||
})),
|
||||
share<HistoryState>()
|
||||
)
|
||||
|
||||
/* Emit location change */
|
||||
|
||||
Reference in New Issue
Block a user