mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-30 18:24:35 +01:00
Merge pull request #2426 from Benjamin-Dobell/feat/toc-reordering
Support TOC anchor targets vertical order differing from TOC order.
This commit is contained in:
commit
fe9a86cb41
@ -161,6 +161,13 @@ export function watchTableOfContents(
|
|||||||
}, new Map<HTMLAnchorElement[], number>())
|
}, new Map<HTMLAnchorElement[], number>())
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
/* Sort index by vertical offset */
|
||||||
|
map(index => (
|
||||||
|
new Map<HTMLAnchorElement[], number>(
|
||||||
|
[...index].sort(([, offsetA], [, offsetB]) => offsetA - offsetB)
|
||||||
|
)
|
||||||
|
)),
|
||||||
|
|
||||||
/* Re-compute partition when viewport offset changes */
|
/* Re-compute partition when viewport offset changes */
|
||||||
switchMap(index => combineLatest([adjust$, viewport$])
|
switchMap(index => combineLatest([adjust$, viewport$])
|
||||||
.pipe(
|
.pipe(
|
||||||
|
Loading…
Reference in New Issue
Block a user