mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
Merge branch 'main' into feat/notion-config
This commit is contained in:
@@ -114,7 +114,9 @@ const BLOG = {
|
||||
|
||||
CODE_MAC_BAR: process.env.NEXT_PUBLIC_CODE_MAC_BAR || true, // 代码左上角显示mac的红黄绿图标
|
||||
CODE_LINE_NUMBERS: process.env.NEXT_PUBLIC_CODE_LINE_NUMBERS || false, // 是否显示行号
|
||||
CODE_COLLAPSE: process.env.NEXT_PUBLIC_CODE_COLLAPSE || true, // 是否折叠代码框
|
||||
CODE_COLLAPSE: process.env.NEXT_PUBLIC_CODE_COLLAPSE || true, // 是否支持折叠代码框
|
||||
CODE_COLLAPSE_EXPAND_DEFAULT: process.env.NEXT_PUBLIC_CODE_COLLAPSE_EXPAND_DEFAULT || true, // 折叠代码默认是展开状态
|
||||
|
||||
// END********代码相关********
|
||||
|
||||
// Mermaid 图表CDN
|
||||
|
||||
@@ -105,13 +105,20 @@ const renderCollapseCode = () => {
|
||||
codeBlock.parentNode.insertBefore(collapseWrapper, codeBlock)
|
||||
panel.appendChild(codeBlock)
|
||||
|
||||
header.addEventListener('click', () => {
|
||||
function collapseCode() {
|
||||
panel.classList.toggle('invisible')
|
||||
panel.classList.toggle('h-0')
|
||||
panel.classList.toggle('h-auto')
|
||||
header.querySelector('svg').classList.toggle('rotate-180')
|
||||
panelWrapper.classList.toggle('border-gray-300')
|
||||
})
|
||||
}
|
||||
|
||||
// 点击后折叠展开代码
|
||||
header.addEventListener('click', collapseCode)
|
||||
// 是否自动展开
|
||||
if (JSON.parse(BLOG.CODE_COLLAPSE_EXPAND_DEFAULT)) {
|
||||
header.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,13 +67,10 @@ const mapImgUrl = (img, block, type = 'block', from) => {
|
||||
ret = BLOG.NOTION_HOST + '/image/' + encodeURIComponent(ret) + '?table=' + type + '&id=' + block.id
|
||||
}
|
||||
|
||||
// UnSplash 随机图片接口优化
|
||||
if (ret.includes('source.unsplash.com/random')) {
|
||||
// 检查原始URL是否已经包含参数
|
||||
const separator = ret.includes('?') ? '&' : '?'
|
||||
// 拼接唯一识别参数,防止请求的图片被缓存
|
||||
ret = `${ret}${separator}random=${block.id}`
|
||||
}
|
||||
// 随机图片接口优化 防止因url一致而随机结果相同
|
||||
const separator = ret.includes('?') ? '&' : '?'
|
||||
// 拼接唯一识别参数,防止请求的图片被缓存
|
||||
ret = `${ret.trim()}${separator}t=${block.id}`
|
||||
|
||||
// 文章封面
|
||||
if (from === 'pageCoverThumbnail') {
|
||||
|
||||
@@ -253,7 +253,7 @@ function TopGroup(props) {
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<TodayCard cRef={todayCardRef} />
|
||||
<TodayCard cRef={todayCardRef} siteInfo={siteInfo}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -301,7 +301,7 @@ function getTopPosts({ latestPosts, allNavPages }) {
|
||||
* 英雄区右侧,今日卡牌
|
||||
* @returns
|
||||
*/
|
||||
function TodayCard({ cRef }) {
|
||||
function TodayCard({ cRef, siteInfo }) {
|
||||
const router = useRouter()
|
||||
// 卡牌是否盖住下层
|
||||
const [isCoverUp, setIsCoverUp] = useState(true)
|
||||
@@ -378,8 +378,7 @@ function TodayCard({ cRef }) {
|
||||
isCoverUp ? '' : ' pointer-events-none'
|
||||
} cursor-pointer today-card-cover absolute w-full h-full top-0`}
|
||||
style={{
|
||||
background:
|
||||
"url('https://bu.dusays.com/2023/03/12/640dcd3a1b146.png') no-repeat center /cover"
|
||||
background: `url('${siteInfo?.pageCover}') no-repeat center /cover`
|
||||
}}
|
||||
></div>
|
||||
</div>
|
||||
|
||||
@@ -25,6 +25,7 @@ const CONFIG = {
|
||||
// 英雄区右侧推荐文章标签, 例如 [推荐] , 最多六篇文章; 若留空白'',则推荐最近更新文章
|
||||
HERO_RECOMMEND_POST_TAG: '推荐',
|
||||
HERO_RECOMMEND_POST_SORT_BY_UPDATE_TIME: false, // 推荐文章排序,为`true`时将强制按最后修改时间倒序
|
||||
// HERO_RECOMMEND_COVER: 'https://cdn.pixabay.com/photo/2015/10/30/20/13/sunrise-1014712_1280.jpg', // 英雄区右侧图片
|
||||
|
||||
// 右侧个人资料卡牌欢迎语,点击可自动切换
|
||||
INFOCARD_GREETINGS: [
|
||||
|
||||
@@ -9,7 +9,7 @@ import LazyImage from '@/components/LazyImage'
|
||||
const BlogPostCard = ({ index, post, showSummary, siteInfo }) => {
|
||||
const showPreview = CONFIG.POST_LIST_PREVIEW && post.blockMap
|
||||
if (post && !post.pageCoverThumbnail && CONFIG.POST_LIST_COVER_DEFAULT) {
|
||||
post.pageCover = siteInfo?.pageCoverThumbnail
|
||||
post.pageCoverThumbnail = siteInfo?.pageCover
|
||||
}
|
||||
const showPageCover = CONFIG.POST_LIST_COVER && post?.pageCoverThumbnail && !showPreview
|
||||
// const delay = (index % 2) * 200
|
||||
|
||||
@@ -16,6 +16,12 @@ const MenuGroupCard = (props) => {
|
||||
{ name: locale.COMMON.TAGS, to: '/tag', slot: tagSlot, show: CONFIG.MENU_TAG }
|
||||
]
|
||||
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
if (links[i].id !== i) {
|
||||
links[i].id = i
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<nav id='nav' className='leading-8 flex justify-center dark:text-gray-200 w-full'>
|
||||
{links.map(link => {
|
||||
|
||||
@@ -18,6 +18,12 @@ export const MenuListSide = (props) => {
|
||||
if (customNav) {
|
||||
links = customNav.concat(links)
|
||||
}
|
||||
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
if (links[i].id !== i) {
|
||||
links[i].id = i
|
||||
}
|
||||
}
|
||||
|
||||
// 如果 开启自定义菜单,则覆盖Page生成的菜单
|
||||
if (BLOG.CUSTOM_MENU) {
|
||||
|
||||
@@ -20,6 +20,12 @@ export const MenuListTop = (props) => {
|
||||
links = links.concat(customNav)
|
||||
}
|
||||
|
||||
for (let i = 0; i < links.length; i++) {
|
||||
if (links[i].id !== i) {
|
||||
links[i].id = i
|
||||
}
|
||||
}
|
||||
|
||||
// 如果 开启自定义菜单,则覆盖Page生成的菜单
|
||||
if (BLOG.CUSTOM_MENU) {
|
||||
links = customMenu
|
||||
|
||||
Reference in New Issue
Block a user