mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed instant loading (MkDocs 1.2.2 regression)
This commit is contained in:
parent
3b23896da3
commit
f869d275b4
File diff suppressed because one or more lines are too long
7
material/assets/javascripts/bundle.143c17e5.min.js.map
Normal file
7
material/assets/javascripts/bundle.143c17e5.min.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -223,7 +223,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.29db7785.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.143c17e5.min.js' | url }}"></script>
|
||||
{% for path in config["extra_javascript"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -16,5 +16,5 @@
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{ 'overrides/assets/javascripts/bundle.dba5ec94.min.js' | url }}"></script>
|
||||
<script src="{{ 'overrides/assets/javascripts/bundle.25c9f9b3.min.js' | url }}"></script>
|
||||
{% endblock %}
|
||||
|
@ -19,7 +19,7 @@
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
# Direct dependencies
|
||||
mkdocs>=1.1
|
||||
mkdocs>=1.2.2
|
||||
Pygments>=2.4
|
||||
markdown>=3.2
|
||||
pymdown-extensions>=7.0
|
||||
|
@ -96,9 +96,7 @@ export interface Config {
|
||||
*/
|
||||
const script = getElementOrThrow("#__config")
|
||||
const config: Config = JSON.parse(script.textContent!)
|
||||
config.base = new URL(config.base, getLocation())
|
||||
.toString()
|
||||
.replace(/\/$/, "")
|
||||
config.base = new URL(config.base, getLocation()).toString()
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Functions
|
||||
|
@ -99,7 +99,7 @@ const print$ = watchPrint()
|
||||
const config = configuration()
|
||||
const index$ = document.forms.namedItem("search")
|
||||
? __search?.index || requestJSON<SearchIndex>(
|
||||
`${config.base}/search/search_index.json`
|
||||
new URL("search/search_index.json", config.base)
|
||||
)
|
||||
: NEVER
|
||||
|
||||
|
@ -120,7 +120,7 @@ function preprocess(urls: string[]): string[] {
|
||||
/* Replace common prefix (i.e. base) with effective base */
|
||||
const config = configuration()
|
||||
return urls.map(url => (
|
||||
url.replace(root.slice(0, index), `${config.base}/`)
|
||||
url.replace(root.slice(0, index), config.base)
|
||||
))
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ export function setupInstantLoading(
|
||||
favicon.href = favicon.href
|
||||
|
||||
/* Intercept internal navigation */
|
||||
const push$ = requestXML(`${config.base}/sitemap.xml`)
|
||||
const push$ = requestXML(new URL("sitemap.xml", config.base))
|
||||
.pipe(
|
||||
map(sitemap => preprocess(getElements("loc", sitemap)
|
||||
.map(node => node.textContent!)
|
||||
|
@ -117,7 +117,7 @@ export function setupSearchWorker(
|
||||
if (isSearchResultMessage(message)) {
|
||||
for (const result of message.data.items)
|
||||
for (const document of result)
|
||||
document.location = `${config.base}/${document.location}`
|
||||
document.location = `${new URL(document.location, config.base)}`
|
||||
}
|
||||
return message
|
||||
}),
|
||||
|
@ -80,7 +80,7 @@ export function mountIconSearch(
|
||||
): Observable<Component<IconSearch>> {
|
||||
const config = configuration()
|
||||
const index$ = requestJSON<IconSearchIndex>(
|
||||
`${config.base}/overrides/assets/javascripts/iconsearch_index.json`
|
||||
new URL("overrides/assets/javascripts/iconsearch_index.json", config.base)
|
||||
)
|
||||
|
||||
/* Retrieve query and result components */
|
||||
|
Loading…
Reference in New Issue
Block a user