From 562cb6137d0f571d4d24aa96094735c795946cbb Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Tue, 27 Jun 2023 14:00:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D3.16.0=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E6=89=93=E5=8C=85=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + components/NotionPage.js | 2 +- components/PrismMac.js | 16 +++++++++------- lib/notion/getNotionData.js | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index a38dad5e..943cf303 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,6 +28,7 @@ assignees: tangly1024 - 操作系统: [例如. iOS, Android, macOS, windows] - 浏览器 [例如. chrome, safari, firefox] - NotionNext版本 [e.g. 3.13.6] +- 主题 [例如. hexo] **补充说明** 与问题相关的其它说明 \ No newline at end of file diff --git a/components/NotionPage.js b/components/NotionPage.js index f4cb2762..c7902fdd 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -77,7 +77,7 @@ const NotionPage = ({ post, className }) => { Tweet }} /> - + } diff --git a/components/PrismMac.js b/components/PrismMac.js index 060d6b94..0df21ba3 100644 --- a/components/PrismMac.js +++ b/components/PrismMac.js @@ -1,4 +1,6 @@ -import React, { useEffect } from 'react' +'use client' + +import { useEffect } from 'react' import Prism from 'prismjs' // 所有语言的prismjs 使用autoloader引入 // import 'prismjs/plugins/autoloader/prism-autoloader' @@ -12,7 +14,7 @@ import 'prismjs/plugins/line-numbers/prism-line-numbers.css' // mermaid图 import BLOG from '@/blog.config' import { isBrowser, loadExternalResource } from '@/lib/utils' -import { useRouter } from 'next/router' +import { useRouter } from 'next/navigation' /** * @author https://github.com/txs/ @@ -27,7 +29,6 @@ const PrismMac = () => { } loadExternalResource(BLOG.PRISM_THEME_PATH, 'css') loadExternalResource(BLOG.PRISM_JS_AUTO_LOADER, 'js').then((url) => { - // console.log('渲染公式图表') if (window?.Prism?.plugins?.autoloader) { window.Prism.plugins.autoloader.languages_path = BLOG.PRISM_JS_PATH } @@ -63,10 +64,11 @@ const renderMermaid = async() => { } } if (needLoad) { - const url = await loadExternalResource(BLOG.MERMAID_CDN, 'js') - const mermaid = window.mermaid - console.log('mermaid加载成功', url, mermaid) - mermaid.contentLoaded() + loadExternalResource(BLOG.MERMAID_CDN, 'js').then(url => { + // console.log('mermaid加载成功', url, mermaid) + const mermaid = window.mermaid + mermaid.contentLoaded() + }) } } } diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index f2550855..8b14b355 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -45,7 +45,7 @@ export async function getGlobalNotionData({ * @returns */ function getLatestPosts({ allPages, from, latestPostCount }) { - const allPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published') + const allPosts = allPages?.filter(page => page.type === 'Post' && page.status === 'Published') const latestPosts = Object.create(allPosts).sort((a, b) => { const dateA = new Date(a?.lastEditedTime || a?.createdTime || a?.date?.start_date)