feat(theme-classic): autoscroll TOC with active link (#6317)

* feat(theme-common): add smooth TOC scrolling to active link

* docs: change the link of repeated content category in lifecycle api

* Update lifecycle-apis.md

* fix page container scrolling

Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
Devtato 2022-01-13 07:04:57 +00:00 committed by GitHub
parent 02a233a221
commit 2f97a85406
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,6 +144,7 @@ function useTOCHighlight(config: TOCHighlightConfig | undefined): void {
}
link.classList.add(linkActiveClassName);
lastActiveLinkRef.current = link;
link.scrollIntoView({block: 'nearest'});
} else {
link.classList.remove(linkActiveClassName);
}