Fixed instant navigation removing color theme tags

This commit is contained in:
squidfunk 2024-02-29 10:12:02 +07:00
parent 6219f3d297
commit d366a45fdb
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
7 changed files with 19 additions and 13 deletions

View File

@ -18,4 +18,4 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
__version__ = "9.5.11"
__version__ = "9.5.12"

View File

@ -32,7 +32,7 @@
<link rel="alternate" type="application/rss+xml" title="{{ lang.t('rss.updated') }}" href="{{ 'feed_rss_updated.xml' | url }}">
{% endif %}
<link rel="icon" href="{{ config.theme.favicon | url }}">
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-9.5.11">
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-9.5.12">
{% endblock %}
{% block htmltitle %}
{% if page.meta and page.meta.title %}
@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.553b3b51.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.c8d2eff1.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "mkdocs-material",
"version": "9.5.11",
"version": "9.5.12",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mkdocs-material",
"version": "9.5.11",
"version": "9.5.12",
"license": "MIT",
"dependencies": {
"clipboard": "^2.0.11",

View File

@ -1,6 +1,6 @@
{
"name": "mkdocs-material",
"version": "9.5.11",
"version": "9.5.12",
"description": "Documentation that simply works",
"keywords": [
"mkdocs",

View File

@ -205,8 +205,14 @@ function inject(next: Document): Observable<Document> {
document.head.appendChild(el)
// Remove meta tags that are not present in the new document
for (const el of tags.values())
el.remove()
for (const el of tags.values()) {
const name = el.getAttribute("name")
// @todo - find a better way to handle attributes we add dynamically in
// other components without mounting components on every navigation, as
// this might impact overall performance - see https://t.ly/ehp_O
if (name !== "theme-color" && name !== "color-scheme")
el.remove()
}
// After components and meta tags were replaced, re-evaluate scripts
// that were provided by the author as part of Markdown files