mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed anchor tracking not working for anchors in tables
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -240,7 +240,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.56861ea1.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.2a903f2a.min.js' | url }}"></script>
|
||||||
{% for path in config.extra_javascript %}
|
{% for path in config.extra_javascript %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -176,6 +176,11 @@ export function watchTableOfContents(
|
|||||||
offset = target.offsetTop
|
offset = target.offsetTop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Fix anchor offsets in tables - see https://bit.ly/3CUFOcn */
|
||||||
|
let parent = target.offsetParent as HTMLElement
|
||||||
|
for (; parent; parent = parent.offsetParent as HTMLElement)
|
||||||
|
offset += parent.offsetTop
|
||||||
|
|
||||||
/* Map reversed anchor path to vertical offset */
|
/* Map reversed anchor path to vertical offset */
|
||||||
return index.set(
|
return index.set(
|
||||||
[...path = [...path, anchor]].reverse(),
|
[...path = [...path, anchor]].reverse(),
|
||||||
|
|||||||
Reference in New Issue
Block a user