mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-08-01 02:08:46 -04:00
Improved documentation and fixed search reset
This commit is contained in:
@@ -33,6 +33,13 @@ import { PackerMessage } from "../message"
|
||||
/**
|
||||
* Setup packer web worker
|
||||
*
|
||||
* This function will create a web worker that helps in packing and unpacking
|
||||
* strings using an LZ-based algorithm, namely `lz-string`. Its main purpose is
|
||||
* to compress the search index before storing it in local storage, so it can
|
||||
* be retrieved and imported to minimize the time necessary to setup search.
|
||||
*
|
||||
* @see https://bit.ly/2Q1ArhU - LZ-String documentation
|
||||
*
|
||||
* @param url - Worker url
|
||||
*
|
||||
* @return Worker handler
|
||||
|
||||
@@ -113,7 +113,7 @@ export function setupSearchWorker(
|
||||
pluck("response")
|
||||
)
|
||||
|
||||
/* Send index to search worker */
|
||||
/* Send index to worker */
|
||||
index$
|
||||
.pipe<SearchSetupMessage>(
|
||||
map(data => ({
|
||||
|
||||
@@ -40,6 +40,9 @@ let index: SearchIndex
|
||||
/**
|
||||
* Setup multi-language support through `lunr-languages`
|
||||
*
|
||||
* This function will automatically import the stemmers necessary to process
|
||||
* the languages which were given through the search index configuration.
|
||||
*
|
||||
* @param config - Search index configuration
|
||||
*/
|
||||
function setupLunrLanguages(config: SearchIndexConfig): void {
|
||||
@@ -58,7 +61,7 @@ function setupLunrLanguages(config: SearchIndexConfig): void {
|
||||
|
||||
/* Load scripts synchronously */
|
||||
if (scripts.length)
|
||||
importScripts(
|
||||
self.importScripts(
|
||||
`${base}/min/lunr.stemmer.support.min.js`,
|
||||
...scripts
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user