mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added note when search is initializing
This commit is contained in:
parent
62fcc9b86e
commit
0145f6d278
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
material/assets/javascripts/bundle.c51f1a8c.min.js
vendored
Normal file
2
material/assets/javascripts/bundle.c51f1a8c.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
material/assets/javascripts/bundle.c51f1a8c.min.js.map
Normal file
1
material/assets/javascripts/bundle.c51f1a8c.min.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.5482c854.min.js",
|
||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.5482c854.min.js.map",
|
||||
"assets/javascripts/bundle.js": "assets/javascripts/bundle.c51f1a8c.min.js",
|
||||
"assets/javascripts/bundle.js.map": "assets/javascripts/bundle.c51f1a8c.min.js.map",
|
||||
"assets/javascripts/vendor.js": "assets/javascripts/vendor.ff4ef43d.min.js",
|
||||
"assets/javascripts/vendor.js.map": "assets/javascripts/vendor.ff4ef43d.min.js.map",
|
||||
"assets/javascripts/worker/search.js": "assets/javascripts/worker/search.58d22e8e.min.js",
|
||||
|
@ -179,7 +179,7 @@
|
||||
</div>
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/vendor.ff4ef43d.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.5482c854.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.c51f1a8c.min.js' | url }}"></script>
|
||||
{%- set translations = {} -%}
|
||||
{%- for key in [
|
||||
"clipboard.copy",
|
||||
|
@ -12,6 +12,7 @@
|
||||
"meta.source": "Quellcode",
|
||||
"search.config.lang": "de",
|
||||
"search.placeholder": "Suche",
|
||||
"search.result.placeholder": "Suche wird initialisiert",
|
||||
"search.result.placeholder": "Suchbegriff eingeben",
|
||||
"search.result.none": "Keine Suchergebnisse",
|
||||
"search.result.one": "1 Suchergebnis",
|
||||
|
@ -19,6 +19,7 @@
|
||||
"search.config.separator": "[\s\-]+",
|
||||
"search.placeholder": "Search",
|
||||
"search.reset": "Clear",
|
||||
"search.result.initializer": "Initializing search",
|
||||
"search.result.placeholder": "Type to start searching",
|
||||
"search.result.none": "No matching documents",
|
||||
"search.result.one": "1 matching document",
|
||||
|
@ -19,7 +19,7 @@
|
||||
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||
<div class="md-search-result" data-md-component="search-result">
|
||||
<div class="md-search-result__meta">
|
||||
{{ lang.t("search.result.placeholder") }}
|
||||
{{ lang.t("search.result.initializer") }}
|
||||
</div>
|
||||
<ol class="md-search-result__list"></ol>
|
||||
</div>
|
||||
|
@ -25,7 +25,6 @@ import {
|
||||
filter,
|
||||
map,
|
||||
mapTo,
|
||||
pluck,
|
||||
sample,
|
||||
startWith,
|
||||
switchMap,
|
||||
@ -109,8 +108,7 @@ export function mountSearch(
|
||||
.pipe(
|
||||
filter(isSearchQueryMessage),
|
||||
sample(status$),
|
||||
take(1),
|
||||
filter(({ data }) => data.length > 0)
|
||||
take(1)
|
||||
)
|
||||
.subscribe(tx$.next.bind(tx$))
|
||||
|
||||
|
@ -26,6 +26,7 @@ import {
|
||||
distinctUntilChanged,
|
||||
filter,
|
||||
map,
|
||||
mapTo,
|
||||
pluck,
|
||||
startWith,
|
||||
switchMap
|
||||
@ -35,6 +36,7 @@ import { WorkerHandler, watchElementOffset } from "browser"
|
||||
import {
|
||||
SearchMessage,
|
||||
SearchResult,
|
||||
isSearchReadyMessage,
|
||||
isSearchResultMessage
|
||||
} from "integrations"
|
||||
|
||||
@ -71,6 +73,13 @@ export function mountSearchResult(
|
||||
switchMap(el => {
|
||||
const container = el.parentElement!
|
||||
|
||||
/* Compute if search is ready */
|
||||
const ready$ = rx$
|
||||
.pipe(
|
||||
filter(isSearchReadyMessage),
|
||||
mapTo(true)
|
||||
)
|
||||
|
||||
/* Compute whether there are more search results to fetch */
|
||||
const fetch$ = watchElementOffset(container)
|
||||
.pipe(
|
||||
@ -86,7 +95,7 @@ export function mountSearchResult(
|
||||
.pipe(
|
||||
filter(isSearchResultMessage),
|
||||
pluck("data"),
|
||||
applySearchResult(el, { query$, fetch$ }),
|
||||
applySearchResult(el, { query$, ready$, fetch$ }),
|
||||
startWith([])
|
||||
)
|
||||
})
|
||||
|
@ -57,6 +57,7 @@ import {
|
||||
*/
|
||||
interface ApplyOptions {
|
||||
query$: Observable<SearchQuery> /* Search query observable */
|
||||
ready$: Observable<boolean> /* Search ready observable */
|
||||
fetch$: Observable<boolean> /* Result fetch observable */
|
||||
}
|
||||
|
||||
@ -77,14 +78,14 @@ interface ApplyOptions {
|
||||
* @return Operator function
|
||||
*/
|
||||
export function applySearchResult(
|
||||
el: HTMLElement, { query$, fetch$ }: ApplyOptions
|
||||
el: HTMLElement, { query$, ready$, fetch$ }: ApplyOptions
|
||||
): MonoTypeOperatorFunction<SearchResult[]> {
|
||||
const list = getElementOrThrow(".md-search-result__list", el)
|
||||
const meta = getElementOrThrow(".md-search-result__meta", el)
|
||||
return pipe(
|
||||
|
||||
/* Apply search result metadata */
|
||||
withLatestFrom(query$),
|
||||
withLatestFrom(query$, ready$),
|
||||
map(([result, query]) => {
|
||||
if (query.value) {
|
||||
setSearchResultMeta(meta, result.length)
|
||||
|
@ -32,6 +32,7 @@
|
||||
"meta.source": "Quellcode",
|
||||
"search.config.lang": "de",
|
||||
"search.placeholder": "Suche",
|
||||
"search.result.placeholder": "Suche wird initialisiert",
|
||||
"search.result.placeholder": "Suchbegriff eingeben",
|
||||
"search.result.none": "Keine Suchergebnisse",
|
||||
"search.result.one": "1 Suchergebnis",
|
||||
|
@ -39,6 +39,7 @@
|
||||
"search.config.separator": "[\s\-]+",
|
||||
"search.placeholder": "Search",
|
||||
"search.reset": "Clear",
|
||||
"search.result.initializer": "Initializing search",
|
||||
"search.result.placeholder": "Type to start searching",
|
||||
"search.result.none": "No matching documents",
|
||||
"search.result.one": "1 matching document",
|
||||
|
@ -58,7 +58,7 @@
|
||||
<div class="md-search__scrollwrap" data-md-scrollfix>
|
||||
<div class="md-search-result" data-md-component="search-result">
|
||||
<div class="md-search-result__meta">
|
||||
{{ lang.t("search.result.placeholder") }}
|
||||
{{ lang.t("search.result.initializer") }}
|
||||
</div>
|
||||
<ol class="md-search-result__list"></ol>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user