Merge pull request #563 from tangly1024/main

发布tangly1024.com
This commit is contained in:
tangly1024
2022-12-09 10:11:07 +08:00
committed by GitHub
12 changed files with 65 additions and 44 deletions

View File

@@ -1,2 +1,2 @@
# 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables
NEXT_PUBLIC_VERSION=3.6.3
NEXT_PUBLIC_VERSION=3.6.4

View File

@@ -119,6 +119,8 @@ yarn run start # 本地启动NextJS服务
<td align="center"><a href="https://github.com/SwwweetOrange"><img src="https://avatars.githubusercontent.com/u/71168966" width="64px;" alt="SwwweetOrange"/><br/><sub><b>SwwweetOrange</b></sub></a><br/><a href="https://github.com/tangly1024/NotionNext/commits?author=SwwweetOrange" title="SwwweetOrange" >🔧 🐛</a></td>
<td align="center"><a href="https://github.com/Ylarod"><img src="https://avatars.githubusercontent.com/u/30978685" width="64px;" alt="Ylarod"/><br/><sub><b>Ylarod</b></sub></a><br/><a href="https://github.com/tangly1024/NotionNext/commits?author=Ylarod" title="Ylarod" >🔧 🐛</a></td>
v
</tr>
</table>

View File

@@ -23,8 +23,8 @@ const PrismMac = () => {
const observer = new MutationObserver(mutationsList => {
for (const m of mutationsList) {
if (m.target.nodeName === 'DETAILS') {
const preCode = m.target.querySelector('pre.notion-code')
if (preCode) {
const preCodes = m.target.querySelectorAll('pre.notion-code')
for (const preCode of preCodes) {
Prism.plugins.lineNumbers.resize(preCode)
}
}

View File

@@ -62,8 +62,10 @@ const WalineComponent = (props) => {
}
return () => {
waline.destroy()
waline = null
if (waline) {
waline.destroy()
waline = null
}
router.events.off('routeChangeComplete', updateWaline)
}
}, [])

View File

@@ -223,7 +223,8 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
return post &&
post.type &&
(post.type === 'Post' || post.type === 'Page') &&
(post.status === 'Published' || post.status === 'Invisible')
(post.status === 'Published' || post.status === 'Invisible') &&
(!post.slug.startsWith('http'))
})
// Sort by date

View File

@@ -1,6 +1,6 @@
{
"name": "notion-next",
"version": "3.6.3",
"version": "3.6.4",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {

View File

@@ -1910,10 +1910,6 @@ pre[class*='language-'] {
width: 100% !important;
}
.notion-simple-table td {
white-space: nowrap;
}
.pre-mac {
position: relative;
margin-top: -7px;
@@ -1978,4 +1974,22 @@ pre[class*='language-'] {
.notion-asset-wrapper-pdf>div{
width:unset!important
}
}
/* pdf预览适配页面 */
.react-pdf__Page__canvas,.react-pdf__Page__textContent{
width: 100% !important;
height: auto !important;
}
/* simple table设置 */
table,thead,tbody{
display:block
}
thead, tbody tr {
display:table;
width:100%;
table-layout:fixed;
}

View File

@@ -9,15 +9,19 @@ import BLOG from '@/blog.config'
import Mark from 'mark.js'
import BlogPostListScroll from './components/BlogPostListScroll'
import BlogPostListPage from './components/BlogPostListPage'
import { useRouter } from 'next/router'
export const LayoutSearch = (props) => {
const { locale } = useGlobal()
const { keyword } = props
const router = useRouter()
const currentSearch = keyword || router?.query?.s
useEffect(() => {
setTimeout(() => {
const container = isBrowser() && document.getElementById('container')
if (container && container.innerHTML) {
const re = new RegExp(keyword, 'gim')
const re = new RegExp(currentSearch, 'gim')
const instance = new Mark(container)
instance.markRegExp(re, {
element: 'span',
@@ -28,14 +32,20 @@ export const LayoutSearch = (props) => {
100)
})
return <LayoutBase {...props}>
<div className='py-12'>
<div className='pb-4 w-full'>{locale.NAV.SEARCH}</div>
<SearchInput currentSearch={keyword} {...props} />
<TagGroups {...props} />
<SearchInput currentSearch={currentSearch} {...props} />
{!currentSearch && <>
<TagGroups {...props} />
<CategoryGroup {...props} />
</>}
</div>
<div>
{currentSearch && <div>
{BLOG.POST_LIST_STYLE === 'page' ? <BlogPostListPage {...props} /> : <BlogPostListScroll {...props} />}
</div>
</div>}
</LayoutBase>
}

View File

@@ -12,9 +12,7 @@ export const LayoutSlug = props => {
const { locale } = useGlobal()
if (!post) {
return <LayoutBase
{...props}
showInfoCard={true}
return <LayoutBase {...props} showInfoCard={true}
/>
}
@@ -30,15 +28,8 @@ export const LayoutSlug = props => {
)
return (
<LayoutBase
{...props}
showInfoCard={true}
slotRight={slotRight}
>
{!lock && <ArticleDetail {...props} />}
{lock && <ArticleLock password={post.password} validPassword={validPassword} />}
<LayoutBase showInfoCard={true} slotRight={slotRight} {...props} >
{!lock ? <ArticleDetail {...props} /> : <ArticleLock password={post.password} validPassword={validPassword} />}
</LayoutBase>
)
}

View File

@@ -21,25 +21,24 @@ export const ArticleDetail = props => {
return <div id='container'>
{/* title */}
<h1 className="text-4xl pt-12 font-sans dark:text-gray-100">{post?.title}</h1>
<h1 className="text-3xl pt-12 font-sans dark:text-gray-100">{post?.title}</h1>
{/* meta */}
<section className="py-2 items-center font-sans px-1">
<div className='flex text-gray-500 py-1 dark:text-gray-600'>
<span> <i className='far fa-calendar mr-2' />{date}</span>
<span className='mx-2'>|</span>
<span> <i className='far fa-calendar-check mr-2'/>{post.lastEditedTime}</span>
<div className="hidden busuanzi_container_page_pv font-light mr-2">
<i className="ml-3 mr-1 fas fa-eye" />
<span className="busuanzi_value_page_pv" />
<section className="py-2 items-center text-sm font-sans px-1">
<div className='flex flex-wrap text-gray-500 py-1 dark:text-gray-600'>
<span className='whitespace-nowrap'> <i className='far fa-calendar mr-2' />{date}</span>
<span className='mx-1'>|</span>
<span className='whitespace-nowrap mr-2'><i className='far fa-calendar-check mr-2'/>{post.lastEditedTime}</span>
<div className="hidden busuanzi_container_page_pv font-light mr-2 whitespace-nowrap">
<i className="mr-1 fas fa-eye" /><span className="busuanzi_value_page_pv" />
</div>
</div>
<Link href="/about" passHref>
<div className='flex pt-2'>
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={siteInfo?.icon} className='rounded-full cursor-pointer' width={25} />
<img src={siteInfo?.icon} className='rounded-full cursor-pointer' width={22} />
<div className="mr-3 ml-2 text-md text-green-500 cursor-pointer">
<div className="mr-3 ml-2 my-auto text-green-500 cursor-pointer">
{BLOG.AUTHOR}
</div>
</div>

View File

@@ -69,6 +69,7 @@ const LayoutBase = (props) => {
<div className='h-0.5 w-full bg-gray-700 dark:bg-gray-600 hidden lg:block'/>
<main id='wrapper' className='flex justify-center flex-1 pb-12'>
{/* 左侧栏样式 */}
<SideAreaLeft slot={leftAreaSlot} targetRef={targetRef} {...props}/>
<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}</> }

View File

@@ -10,22 +10,23 @@ const MenuButtonGroup = (props) => {
const router = useRouter()
const archiveSlot = <div className='bg-gray-300 dark:bg-gray-500 rounded-md text-gray-50 px-1 text-xs'>{postCount}</div>
let links = [
const defaultLinks = [
{ icon: 'fas fa-home', name: locale.NAV.INDEX, to: '/' || '/', show: true },
{ icon: 'fas fa-th', name: locale.COMMON.CATEGORY, to: '/category', show: CONFIG_NEXT.MENU_CATEGORY },
{ icon: 'fas fa-tag', name: locale.COMMON.TAGS, to: '/tag', show: CONFIG_NEXT.MENU_TAG },
{ icon: 'fas fa-archive', name: locale.NAV.ARCHIVE, to: '/archive', slot: archiveSlot, show: CONFIG_NEXT.MENU_ARCHIVE },
{ icon: 'fas fa-user', name: locale.NAV.ABOUT, to: '/about', show: CONFIG_NEXT.MENU_ABOUT }
]
let links = [].concat(defaultLinks)
if (customNav) {
links = links.concat(customNav)
links = defaultLinks.concat(customNav)
}
return <nav id='nav' className='leading-8 text-gray-500 dark:text-gray-400 font-sans'>
{links.map(link => {
if (link && link.show) {
const selected = (router.pathname === link.to) || (router.asPath === link.to)
return <Link key={`${link.to}`} title={link.to} href={link.to} >
return <Link key={link.to} title={link.to} href={link.to} >
<a target={link.to.indexOf('http') === 0 ? '_blank' : '_self'} className={'py-1.5 px-5 duration-300 text-base justify-between hover:bg-gray-700 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center ' +
(selected ? 'bg-gray-200 text-black' : ' ')} >
<div className='my-auto items-center justify-center flex '>
@@ -36,7 +37,7 @@ const MenuButtonGroup = (props) => {
</a>
</Link>
} else {
return null
return <></>
}
})}
</nav>