mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-31 23:16:54 +00:00
Merge pull request #1205 from tangly1024/fix/next-router
修复3.16.0编译打包问题
This commit is contained in:
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
1
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -28,6 +28,7 @@ assignees: tangly1024
|
|||||||
- 操作系统: [例如. iOS, Android, macOS, windows]
|
- 操作系统: [例如. iOS, Android, macOS, windows]
|
||||||
- 浏览器 [例如. chrome, safari, firefox]
|
- 浏览器 [例如. chrome, safari, firefox]
|
||||||
- NotionNext版本 [e.g. 3.13.6]
|
- NotionNext版本 [e.g. 3.13.6]
|
||||||
|
- 主题 [例如. hexo]
|
||||||
|
|
||||||
**补充说明**
|
**补充说明**
|
||||||
与问题相关的其它说明
|
与问题相关的其它说明
|
||||||
@@ -77,7 +77,7 @@ const NotionPage = ({ post, className }) => {
|
|||||||
Tweet
|
Tweet
|
||||||
}} />
|
}} />
|
||||||
|
|
||||||
<PrismMac />
|
<PrismMac/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import React, { useEffect } from 'react'
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect } from 'react'
|
||||||
import Prism from 'prismjs'
|
import Prism from 'prismjs'
|
||||||
// 所有语言的prismjs 使用autoloader引入
|
// 所有语言的prismjs 使用autoloader引入
|
||||||
// import 'prismjs/plugins/autoloader/prism-autoloader'
|
// import 'prismjs/plugins/autoloader/prism-autoloader'
|
||||||
@@ -12,7 +14,7 @@ import 'prismjs/plugins/line-numbers/prism-line-numbers.css'
|
|||||||
// mermaid图
|
// mermaid图
|
||||||
import BLOG from '@/blog.config'
|
import BLOG from '@/blog.config'
|
||||||
import { isBrowser, loadExternalResource } from '@/lib/utils'
|
import { isBrowser, loadExternalResource } from '@/lib/utils'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/navigation'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author https://github.com/txs/
|
* @author https://github.com/txs/
|
||||||
@@ -27,7 +29,6 @@ const PrismMac = () => {
|
|||||||
}
|
}
|
||||||
loadExternalResource(BLOG.PRISM_THEME_PATH, 'css')
|
loadExternalResource(BLOG.PRISM_THEME_PATH, 'css')
|
||||||
loadExternalResource(BLOG.PRISM_JS_AUTO_LOADER, 'js').then((url) => {
|
loadExternalResource(BLOG.PRISM_JS_AUTO_LOADER, 'js').then((url) => {
|
||||||
// console.log('渲染公式图表')
|
|
||||||
if (window?.Prism?.plugins?.autoloader) {
|
if (window?.Prism?.plugins?.autoloader) {
|
||||||
window.Prism.plugins.autoloader.languages_path = BLOG.PRISM_JS_PATH
|
window.Prism.plugins.autoloader.languages_path = BLOG.PRISM_JS_PATH
|
||||||
}
|
}
|
||||||
@@ -63,10 +64,11 @@ const renderMermaid = async() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (needLoad) {
|
if (needLoad) {
|
||||||
const url = await loadExternalResource(BLOG.MERMAID_CDN, 'js')
|
loadExternalResource(BLOG.MERMAID_CDN, 'js').then(url => {
|
||||||
const mermaid = window.mermaid
|
// console.log('mermaid加载成功', url, mermaid)
|
||||||
console.log('mermaid加载成功', url, mermaid)
|
const mermaid = window.mermaid
|
||||||
mermaid.contentLoaded()
|
mermaid.contentLoaded()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export async function getGlobalNotionData({
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
function getLatestPosts({ allPages, from, latestPostCount }) {
|
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 latestPosts = Object.create(allPosts).sort((a, b) => {
|
||||||
const dateA = new Date(a?.lastEditedTime || a?.createdTime || a?.date?.start_date)
|
const dateA = new Date(a?.lastEditedTime || a?.createdTime || a?.date?.start_date)
|
||||||
|
|||||||
Reference in New Issue
Block a user