Skip to content

Commit 001bacb

Browse files
committed
2 parents f764d24 + 0a7cce6 commit 001bacb

File tree

2 files changed

+91
-71
lines changed

2 files changed

+91
-71
lines changed

components/DebugPanel.js

+75-71
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { useEffect, useState } from 'react'
2-
import Select from './Select'
1+
import { siteConfigMap } from '@/lib/config'
32
import { useGlobal } from '@/lib/global'
3+
import { getQueryParam } from '@/lib/utils'
44
import { THEMES } from '@/themes/theme'
55
import { useRouter } from 'next/router'
6-
import { siteConfigMap } from '@/lib/config'
7-
import { getQueryParam } from '@/lib/utils'
6+
import { useEffect, useState } from 'react'
7+
import Select from './Select'
88

99
/**
1010
*
@@ -50,79 +50,83 @@ const DebugPanel = () => {
5050
}
5151

5252
return (
53-
<>
54-
{/* 调试按钮 */}
55-
<div>
56-
<div
57-
style={{ writingMode: 'vertical-lr' }}
58-
className={`bg-black text-xs text-white shadow-2xl p-1.5 rounded-l-xl cursor-pointer ${show ? 'right-96' : 'right-0'} fixed bottom-72 duration-200 z-50`}
59-
onClick={toggleShow}
60-
>
61-
{show
62-
? <i className="fas fa-times">&nbsp;{locale.COMMON.DEBUG_CLOSE}</i>
63-
: <i className="fas fa-tools">&nbsp;{locale.COMMON.DEBUG_OPEN}</i>}
64-
</div>
65-
</div>
53+
<>
54+
{/* 调试按钮 */}
55+
<div>
56+
<div
57+
style={{ writingMode: 'vertical-lr' }}
58+
className={`bg-black text-xs text-white shadow-2xl p-1.5 rounded-l-xl cursor-pointer ${show ? 'right-96' : 'right-0'} fixed bottom-72 duration-200 z-50`}
59+
onClick={toggleShow}>
60+
{show ? (
61+
<i className='fas fa-times'>&nbsp;{locale.COMMON.DEBUG_CLOSE}</i>
62+
) : (
63+
<i className='fas fa-tools'>&nbsp;{locale.COMMON.DEBUG_OPEN}</i>
64+
)}
65+
</div>
66+
</div>
6667

67-
{/* 调试侧拉抽屉 */}
68+
{/* 调试侧拉抽屉 */}
69+
<div
70+
className={` ${show ? 'shadow-card w-96 right-0 ' : '-right-96 invisible w-0'} overflow-y-scroll h-full p-5 bg-white fixed bottom-0 z-50 duration-200`}>
71+
<div className='flex justify-between space-x-1 my-5'>
72+
<div className='flex-col px-5'>
73+
<Select
74+
label={locale.COMMON.THEME_SWITCH}
75+
value={currentTheme}
76+
options={themeOptions}
77+
onChange={handleUpdateDebugTheme}
78+
/>
6879
<div
69-
className={` ${show ? 'shadow-card w-96 right-0 ' : '-right-96 invisible w-0'} overflow-y-scroll h-full p-5 bg-white fixed bottom-0 z-50 duration-200`}
70-
>
71-
<div className="flex justify-between space-x-1 my-5">
72-
<div className='flex'>
73-
<Select
74-
label={locale.COMMON.THEME_SWITCH}
75-
value={currentTheme}
76-
options={themeOptions}
77-
onChange={handleUpdateDebugTheme}
78-
/>
79-
<div className="p-2 cursor-pointer" onClick={handleChangeDebugTheme}>
80-
<i className="fas fa-sync" />
81-
</div>
82-
</div>
80+
className='p-2 cursor-pointer'
81+
onClick={handleChangeDebugTheme}>
82+
<i className='fas fa-sync' />
83+
</div>
84+
</div>
8385

84-
<div className='p-2'>
85-
<i className='fas fa-times' onClick={toggleShow}/>
86-
</div>
87-
</div>
86+
<div className='p-2'>
87+
<i className='fas fa-times' onClick={toggleShow} />
88+
</div>
89+
</div>
8890

89-
<div>
90-
{/* <div>
91-
<div className="font-bold w-18 border-b my-2">
92-
主题配置{`config_${debugTheme}.js`}:
93-
</div>
94-
<div className="text-xs">
95-
{Object.keys(themeConfig).map(k => (
96-
<div key={k} className="justify-between flex py-1">
97-
<span className="bg-indigo-500 p-0.5 rounded text-white mr-2">
98-
{k}
99-
</span>
100-
<span className="whitespace-nowrap">
101-
{filterResult(themeConfig[k] + '')}
102-
</span>
103-
</div>
104-
))}
91+
<div className='flex-col px-5'>
92+
{/*
93+
<div>
94+
<div className="font-bold w-18 border-b my-2">
95+
主题配置{`config_${debugTheme}.js`}:
96+
</div>
97+
<div className="text-xs">
98+
{Object.keys(themeConfig).map(k => (
99+
<div key={k} className="justify-between flex py-1">
100+
<span className="bg-indigo-500 p-0.5 rounded text-white mr-2">
101+
{k}
102+
</span>
103+
<span className="whitespace-nowrap">
104+
{filterResult(themeConfig[k] + '')}
105+
</span>
105106
</div>
106-
</div> */}
107-
<div className="font-bold w-18 border-b my-2">
108-
站点配置[blog.config.js]
109-
</div>
110-
<div className="text-xs">
111-
{siteConfig && Object.keys(siteConfig).map(k => (
112-
<div key={k} className="justify-between flex py-1">
113-
<span className="bg-blue-500 p-0.5 rounded text-white mr-2">
114-
{k}
115-
</span>
116-
<span className="whitespace-nowrap">
117-
{filterResult(siteConfig[k] + '')}
118-
</span>
119-
</div>
120-
))}
121-
</div>
107+
))}
122108
</div>
123-
124-
</div>
125-
</>
109+
</div>
110+
*/}
111+
<div className='font-bold w-18 border-b my-2'>
112+
站点配置[blog.config.js]
113+
</div>
114+
<div className='text-xs'>
115+
{siteConfig &&
116+
Object.keys(siteConfig).map(k => (
117+
<div key={k} className='justify-between flex py-1'>
118+
<span className='bg-blue-500 p-0.5 rounded text-white mr-2'>
119+
{k}
120+
</span>
121+
<span className='whitespace-nowrap'>
122+
{filterResult(siteConfig[k] + '')}
123+
</span>
124+
</div>
125+
))}
126+
</div>
127+
</div>
128+
</div>
129+
</>
126130
)
127131
}
128132
export default DebugPanel

components/NotionPage.js

+16
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ const NotionPage = ({ post, className }) => {
9898
})
9999
})
100100
}
101+
102+
// 查找所有具有 'notion-collection-page-properties' 类的元素,删除notion自带的页面properties
103+
const timer = setTimeout(() => {
104+
// 查找所有具有 'notion-collection-page-properties' 类的元素
105+
const elements = document.querySelectorAll(
106+
'.notion-collection-page-properties'
107+
)
108+
109+
// 遍历这些元素并将其从 DOM 中移除
110+
elements?.forEach(element => {
111+
element?.remove()
112+
})
113+
}, 1000) // 1000 毫秒 = 1 秒
114+
115+
// 清理定时器,防止组件卸载时执行
116+
return () => clearTimeout(timer)
101117
}, [post])
102118

103119
return (

0 commit comments

Comments
 (0)