mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
修复 Client异常
This commit is contained in:
@@ -40,37 +40,42 @@ function renderPrismMac() {
|
||||
const container = document?.getElementById('container-inner')
|
||||
const codeToolBars = container?.getElementsByClassName('code-toolbar')
|
||||
|
||||
Array.from(codeToolBars).forEach(item => {
|
||||
const codeBlocks = item.getElementsByTagName('pre')
|
||||
if (codeBlocks.length === 0) {
|
||||
item.remove()
|
||||
}
|
||||
})
|
||||
|
||||
if (codeToolBars) {
|
||||
Array.from(codeToolBars).forEach(item => {
|
||||
const codeBlocks = item.getElementsByTagName('pre')
|
||||
if (codeBlocks.length === 0) {
|
||||
item.remove()
|
||||
}
|
||||
})
|
||||
}
|
||||
// 重新渲染之前检查所有的多余text
|
||||
|
||||
try {
|
||||
Prism.highlightAll()
|
||||
// Add line numbers
|
||||
const codeBlocks = container?.getElementsByTagName('pre')
|
||||
Array.from(codeBlocks).forEach(item => {
|
||||
if (!item.classList.contains('line-numbers')) {
|
||||
item.classList.add('line-numbers')
|
||||
item.style.whiteSpace = 'pre-wrap'
|
||||
}
|
||||
})
|
||||
if (codeBlocks) {
|
||||
Array.from(codeBlocks).forEach(item => {
|
||||
if (!item.classList.contains('line-numbers')) {
|
||||
item.classList.add('line-numbers')
|
||||
item.style.whiteSpace = 'pre-wrap'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
// Add pre-mac element for Mac Style UI
|
||||
Array.from(codeToolBars).forEach(item => {
|
||||
const existPreMac = item.getElementsByClassName('pre-mac')
|
||||
if (existPreMac.length < codeToolBars.length) {
|
||||
const preMac = document.createElement('div')
|
||||
preMac.classList.add('pre-mac')
|
||||
preMac.innerHTML = '<span></span><span></span><span></span>'
|
||||
item?.appendChild(preMac, item)
|
||||
}
|
||||
})
|
||||
if (codeToolBars) {
|
||||
Array.from(codeToolBars).forEach(item => {
|
||||
const existPreMac = item.getElementsByClassName('pre-mac')
|
||||
if (existPreMac.length < codeToolBars.length) {
|
||||
const preMac = document.createElement('div')
|
||||
preMac.classList.add('pre-mac')
|
||||
preMac.innerHTML = '<span></span><span></span><span></span>'
|
||||
item?.appendChild(preMac, item)
|
||||
}
|
||||
})
|
||||
}
|
||||
}, 0)
|
||||
} catch (err) {
|
||||
console.log('代码渲染', err)
|
||||
|
||||
@@ -24,7 +24,7 @@ const LayoutBase = props => {
|
||||
<Nav {...props} />
|
||||
|
||||
{/* 主体 */}
|
||||
<div className="w-full">
|
||||
<div id='container-inner' className="w-full">
|
||||
|
||||
<Title {...props} />
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ const LayoutBase = (props) => {
|
||||
<div className='flex'>
|
||||
<AsideLeft {...props} slot={leftAreaSlot}/>
|
||||
<main id='wrapper' className='flex w-full py-8 justify-center'>
|
||||
<div className='2xl:max-w-6xl md:max-w-4xl w-full'>
|
||||
<div id='container-inner' className='2xl:max-w-6xl md:max-w-4xl w-full'>
|
||||
<div> {headerSlot} </div>
|
||||
<div>{children}</div>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ const LayoutBase = props => {
|
||||
{/* 桌面端左侧菜单 */}
|
||||
{/* <LeftMenuBar/> */}
|
||||
|
||||
<div className='w-full'>
|
||||
<div id='container-inner' className='w-full'>
|
||||
{/* 移动端顶部菜单 */}
|
||||
<TopNavBar {...props}/>
|
||||
<div className='px-5 max-w-5xl justify-center mx-auto min-h-screen'>
|
||||
|
||||
@@ -70,7 +70,7 @@ const LayoutBase = (props) => {
|
||||
|
||||
<main id='wrapper' className='flex justify-center flex-1 pb-12'>
|
||||
<SideAreaLeft slot={leftAreaSlot} targetRef={targetRef} {...props}/>
|
||||
<section id='center' className={`${CONFIG_NEXT.NAV_TYPE !== 'normal' ? 'mt-40' : ''} lg:max-w-3xl xl:max-w-4xl flex-grow md:mt-0 min-h-screen w-full`} ref={targetRef}>
|
||||
<section id='container-inner' className={`${CONFIG_NEXT.NAV_TYPE !== 'normal' ? 'mt-40' : ''} lg:max-w-3xl xl:max-w-4xl flex-grow md:mt-0 min-h-screen w-full`} ref={targetRef}>
|
||||
{onLoading ? <LoadingCover/> : <> {children}</> }
|
||||
</section>
|
||||
{/* 右侧栏样式 */}
|
||||
|
||||
Reference in New Issue
Block a user