Skip to content

Commit 9d33f8a

Browse files
committed
Fixed highlighted lines in code blocks being cutoff on mobile
1 parent cd08611 commit 9d33f8a

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

Diff for: material/templates/assets/javascripts/bundle.b4d6038a.min.js renamed to material/templates/assets/javascripts/bundle.ae821067.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: material/templates/assets/javascripts/bundle.b4d6038a.min.js.map renamed to material/templates/assets/javascripts/bundle.ae821067.min.js.map

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: material/templates/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@
249249
</script>
250250
{% endblock %}
251251
{% block scripts %}
252-
<script src="{{ 'assets/javascripts/bundle.b4d6038a.min.js' | url }}"></script>
252+
<script src="{{ 'assets/javascripts/bundle.ae821067.min.js' | url }}"></script>
253253
{% for script in config.extra_javascript %}
254254
{{ script | script_tag }}
255255
{% endfor %}

Diff for: src/templates/assets/javascripts/components/content/code/_/index.ts

+9
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
import { feature } from "~/_"
4343
import {
4444
getElementContentSize,
45+
getElements,
4546
watchElementSize,
4647
watchElementVisibility
4748
} from "~/browser"
@@ -226,6 +227,14 @@ export function mountCodeBlock(
226227
}
227228
}
228229

230+
// If the code block has line spans, we can add this additional class to
231+
// the code block element, which fixes the problem for highlighted code
232+
// lines not stretching to the entirety of the screen when the code block
233+
// overflows, e.g., on mobile - see
234+
const spans = getElements(":scope > span[id]", el)
235+
if (spans.length)
236+
el.classList.add("md-code__content")
237+
229238
/* Create and return component */
230239
return watchCodeBlock(el)
231240
.pipe(

0 commit comments

Comments
 (0)