1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-23 23:21:00 +01:00

Fixed improved tooltips mounted when disabled

This commit is contained in:
squidfunk 2024-07-01 14:34:38 +02:00
parent 12a8e82837
commit 845fc610b0
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 21 additions and 14 deletions

View File

@ -249,7 +249,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.ad660dcc.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.fe8b6f2b.min.js' | url }}"></script>
{% for script in config.extra_javascript %}
{{ script | script_tag }}
{% endfor %}

View File

@ -21,6 +21,7 @@
*/
import {
EMPTY,
Observable,
filter,
finalize,
@ -32,6 +33,7 @@ import {
takeUntil
} from "rxjs"
import { feature } from "~/_"
import {
Viewport,
getElements,
@ -85,6 +87,10 @@ export function patchEllipsis(
const host = el.closest("a") || el
host.title = text
// Do not mount improved tooltip if feature is disabled
if (!feature("content.tooltips"))
return EMPTY
/* Mount tooltip */
return mountInlineTooltip2(host, { viewport$ })
.pipe(
@ -96,10 +102,11 @@ export function patchEllipsis(
.subscribe()
// @todo move this outside of here and fix memleaks
document$
.pipe(
switchMap(() => getElements(".md-status")),
mergeMap(el => mountInlineTooltip2(el, { viewport$ }))
)
.subscribe()
if (feature("content.tooltips"))
document$
.pipe(
switchMap(() => getElements(".md-status")),
mergeMap(el => mountInlineTooltip2(el, { viewport$ }))
)
.subscribe()
}