mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
gitbook-drawer
This commit is contained in:
@@ -49,8 +49,11 @@ const Catalog = ({ post }) => {
|
||||
}
|
||||
setActiveSection(currentSectionId)
|
||||
const index = tocIds.indexOf(currentSectionId) || 0
|
||||
if (isBrowser()) {
|
||||
document?.getElementById('toc-wrapper')?.scrollTo({ top: 28 * index, behavior: 'smooth' })
|
||||
if (isBrowser() && tocIds?.length > 0) {
|
||||
console.log(28 * index, index, currentSectionId)
|
||||
for (const tocWrapper of document?.getElementsByClassName('toc-wrapper')) {
|
||||
tocWrapper?.scrollTo({ top: 28 * index, behavior: 'smooth' })
|
||||
}
|
||||
}
|
||||
}, throttleMs))
|
||||
|
||||
@@ -60,7 +63,7 @@ const Catalog = ({ post }) => {
|
||||
}
|
||||
|
||||
return <>
|
||||
<div id='toc-wrapper' className='max-h-96 scroll-hidden'>
|
||||
<div id='toc-wrapper' className='toc-wrapper overflow-y-auto max-h-96 overscroll-none scroll-hidden'>
|
||||
<nav className='h-full text-black'>
|
||||
{toc.map((tocItem) => {
|
||||
const id = uuidToId(tocItem.id)
|
||||
|
||||
@@ -18,9 +18,9 @@ const TocDrawer = ({ post, cRef }) => {
|
||||
{/* 侧边菜单 */}
|
||||
<div
|
||||
className={(tocVisible ? 'animate__slideInRight ' : ' -mr-72 animate__slideOutRight') +
|
||||
' shadow-card w-60 duration-200 fixed right-1 bottom-16 rounded py-2 bg-white dark:bg-gray-900'}>
|
||||
' overflow-y-hidden shadow-card w-60 duration-200 fixed right-1 bottom-16 rounded py-2 bg-white dark:bg-gray-900'}>
|
||||
{post && <>
|
||||
<div className='dark:text-gray-400 text-gray-600 h-56 p-3 overflow-y-scroll '>
|
||||
<div className='dark:text-gray-400 text-gray-600 h-96 p-3'>
|
||||
<Catalog post={post}/>
|
||||
</div>
|
||||
</>}
|
||||
|
||||
Reference in New Issue
Block a user