mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-16 07:26:47 +00:00
@@ -119,7 +119,7 @@ const BLOG = {
|
||||
COMMENT_VALINE_SERVER_URLS: process.env.NEXT_PUBLIC_VALINE_SERVER_URLS || '', // 该配置适用于国内自定义域名用户, 海外版本会自动检测(无需手动填写) @see https://valine.js.org/configuration.html#serverURLs
|
||||
COMMENT_VALINE_PLACEHOLDER: process.env.NEXT_PUBLIC_VALINE_PLACEHOLDER || '抢个沙发吧~', // 可以搭配后台管理评论 https://github.com/DesertsP/Valine-Admin 便于查看评论,以及邮件通知,垃圾评论过滤等功能
|
||||
|
||||
COMMENT_WALINE_SERVER_URL: process.env.NEXT_PUBLIC_WALINE_SERVER_URL || '', // Waline 评论 @see https://waline.js.org/guide/get-started.html
|
||||
COMMENT_WALINE_SERVER_URL: process.env.NEXT_PUBLIC_WALINE_SERVER_URL || '', // 请配置完整的Waline评论地址 例如 hhttps://preview-waline.tangly1024.com @see https://waline.js.org/guide/get-started.html
|
||||
COMMENT_WALINE_RECENT: process.env.NEXT_PUBLIC_WALINE_RECENT || false, // 最新评论
|
||||
|
||||
// 站点统计
|
||||
|
||||
@@ -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} />
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export const BlogListPage = props => {
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between text-xs">
|
||||
<Link href={{ pathname: currentPage - 1 === 1 ? `${BLOG.SUB_PATH || pagePrefix}` : `${pagePrefix}/page/${currentPage - 1}`, query: router.query.s ? { s: router.query.s } : {} }}>
|
||||
<Link href={{ pathname: currentPage - 1 === 1 ? `${pagePrefix}/` : `${pagePrefix}/page/${currentPage - 1}`, query: router.query.s ? { s: router.query.s } : {} }}>
|
||||
<a className={`${showPrev ? 'bg-black ' : 'bg-gray pointer-events-none '} text-white no-underline py-2 px-3 rounded`}>{locale.PAGINATION.PREV}</a>
|
||||
</Link>
|
||||
<Link href={{ pathname: `${pagePrefix}/page/${currentPage + 1}`, query: router.query.s ? { s: router.query.s } : {} }}>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -21,7 +21,7 @@ const PaginationSimple = ({ page, showNext }) => {
|
||||
href={{
|
||||
pathname:
|
||||
currentPage === 2
|
||||
? `${pagePrefix}`
|
||||
? `${pagePrefix}/`
|
||||
: `${pagePrefix}/page/${currentPage - 1}`,
|
||||
query: router.query.s ? { s: router.query.s } : {}
|
||||
}}
|
||||
|
||||
@@ -21,7 +21,7 @@ const PaginationNumber = ({ page, totalPage }) => {
|
||||
<Link
|
||||
href={{
|
||||
pathname: currentPage === 2
|
||||
? pagePrefix
|
||||
? `${pagePrefix}/`
|
||||
: `${pagePrefix}/page/${currentPage - 1}`,
|
||||
query: router.query.s ? { s: router.query.s } : {}
|
||||
}}
|
||||
@@ -50,7 +50,7 @@ const PaginationNumber = ({ page, totalPage }) => {
|
||||
|
||||
function getPageElement(page, currentPage, pagePrefix) {
|
||||
return (
|
||||
<Link href={page === 1 ? `${pagePrefix}` : `${pagePrefix}/page/${page}`} key={page} passHref>
|
||||
<Link href={page === 1 ? `${pagePrefix}/` : `${pagePrefix}/page/${page}`} key={page} passHref>
|
||||
<a className={
|
||||
(page + '' === currentPage + ''
|
||||
? 'font-bold bg-indigo-400 dark:bg-indigo-500 text-white '
|
||||
|
||||
@@ -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'>
|
||||
|
||||
@@ -22,7 +22,7 @@ const PaginationSimple = ({ page, totalPage }) => {
|
||||
href={{
|
||||
pathname:
|
||||
currentPage === 2
|
||||
? `${pagePrefix}`
|
||||
? `${pagePrefix}/`
|
||||
: `${pagePrefix}/page/${currentPage - 1}`,
|
||||
query: router.query.s ? { s: router.query.s } : {}
|
||||
}}
|
||||
|
||||
@@ -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>
|
||||
{/* 右侧栏样式 */}
|
||||
|
||||
@@ -22,7 +22,7 @@ const PaginationNumber = ({ page, totalPage }) => {
|
||||
href={{
|
||||
pathname:
|
||||
currentPage - 1 === 1
|
||||
? `${pagePrefix}}`
|
||||
? `${pagePrefix}/`
|
||||
: `${pagePrefix}/page/${currentPage - 1}`,
|
||||
query: router.query.s ? { s: router.query.s } : {}
|
||||
}}
|
||||
@@ -60,10 +60,8 @@ const PaginationNumber = ({ page, totalPage }) => {
|
||||
}
|
||||
|
||||
function getPageElement(pagePrefix, page, currentPage) {
|
||||
console.log(pagePrefix, page, currentPage)
|
||||
|
||||
return (
|
||||
<Link href={page === 1 ? `${pagePrefix}` : `${pagePrefix}/page/${page}`} key={page} passHref>
|
||||
<Link href={page === 1 ? `${pagePrefix}/` : `${pagePrefix}/page/${page}`} key={page} passHref>
|
||||
<a className={
|
||||
(page + '' === currentPage + ''
|
||||
? 'font-bold bg-gray-500 dark:bg-gray-400 text-white '
|
||||
|
||||
Reference in New Issue
Block a user