mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-13 23:16:47 +00:00
fix gitbook & mermaid
This commit is contained in:
@@ -12,12 +12,14 @@ import 'prismjs/plugins/line-numbers/prism-line-numbers.css'
|
||||
// mermaid图
|
||||
import BLOG from '@/blog.config'
|
||||
import { isBrowser, loadExternalResource } from '@/lib/utils'
|
||||
import { useRouter } from 'next/router'
|
||||
|
||||
/**
|
||||
* @author https://github.com/txs/
|
||||
* @returns
|
||||
*/
|
||||
const PrismMac = () => {
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
if (isBrowser()) {
|
||||
if (BLOG.CODE_MAC_BAR) {
|
||||
@@ -33,7 +35,7 @@ const PrismMac = () => {
|
||||
renderMermaid()
|
||||
})
|
||||
}
|
||||
}, [])
|
||||
}, [router.events])
|
||||
return <></>
|
||||
}
|
||||
|
||||
@@ -70,8 +72,8 @@ const renderMermaid = async() => {
|
||||
}
|
||||
}
|
||||
})
|
||||
if (document.querySelector('#notion-article')) {
|
||||
observer.observe(document.querySelector('#notion-article'), { attributes: true, subtree: true })
|
||||
if (document.querySelector('#container-inner')) {
|
||||
observer.observe(document.querySelector('#container-inner'), { attributes: true, subtree: true })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ const Catalog = ({ post }) => {
|
||||
setActiveSection(currentSectionId)
|
||||
const index = tocIds.indexOf(currentSectionId) || 0
|
||||
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' })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user