mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed highlighted lines in code blocks being cutoff on mobile
This commit is contained in:
parent
cd086110bf
commit
9d33f8aaa6
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -249,7 +249,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.b4d6038a.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.ae821067.min.js' | url }}"></script>
|
||||||
{% for script in config.extra_javascript %}
|
{% for script in config.extra_javascript %}
|
||||||
{{ script | script_tag }}
|
{{ script | script_tag }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -42,6 +42,7 @@ import {
|
|||||||
import { feature } from "~/_"
|
import { feature } from "~/_"
|
||||||
import {
|
import {
|
||||||
getElementContentSize,
|
getElementContentSize,
|
||||||
|
getElements,
|
||||||
watchElementSize,
|
watchElementSize,
|
||||||
watchElementVisibility
|
watchElementVisibility
|
||||||
} from "~/browser"
|
} from "~/browser"
|
||||||
@ -226,6 +227,14 @@ export function mountCodeBlock(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the code block has line spans, we can add this additional class to
|
||||||
|
// the code block element, which fixes the problem for highlighted code
|
||||||
|
// lines not stretching to the entirety of the screen when the code block
|
||||||
|
// overflows, e.g., on mobile - see
|
||||||
|
const spans = getElements(":scope > span[id]", el)
|
||||||
|
if (spans.length)
|
||||||
|
el.classList.add("md-code__content")
|
||||||
|
|
||||||
/* Create and return component */
|
/* Create and return component */
|
||||||
return watchCodeBlock(el)
|
return watchCodeBlock(el)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
Loading…
Reference in New Issue
Block a user