mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-06 23:16:52 +00:00
@@ -1,7 +1,7 @@
|
|||||||
import BLOG from '@/blog.config'
|
import BLOG from '@/blog.config'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import Tabs from '@/components/Tabs'
|
import Tabs from '@/components/Tabs'
|
||||||
import React from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
const WalineComponent = dynamic(
|
const WalineComponent = dynamic(
|
||||||
@@ -57,7 +57,7 @@ const ValineComponent = dynamic(() => import('@/components/ValineComponent'), {
|
|||||||
const Comment = ({ frontMatter }) => {
|
const Comment = ({ frontMatter }) => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
// 跳转到评论区
|
// 跳转到评论区
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (window.location.href.indexOf('target=comment') > -1) {
|
if (window.location.href.indexOf('target=comment') > -1) {
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ import { getPostBlocks } from '@/lib/notion'
|
|||||||
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
|
import { getGlobalNotionData } from '@/lib/notion/getNotionData'
|
||||||
import { useGlobal } from '@/lib/global'
|
import { useGlobal } from '@/lib/global'
|
||||||
import * as ThemeMap from '@/themes'
|
import * as ThemeMap from '@/themes'
|
||||||
import React from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { idToUuid } from 'notion-utils'
|
import { idToUuid } from 'notion-utils'
|
||||||
import Router from 'next/router'
|
import Router, { useRouter } from 'next/router'
|
||||||
import { isBrowser } from '@/lib/utils'
|
|
||||||
import { getNotion } from '@/lib/notion/getNotion'
|
import { getNotion } from '@/lib/notion/getNotion'
|
||||||
import { getPageTableOfContents } from '@/lib/notion/getPageTableOfContents'
|
import { getPageTableOfContents } from '@/lib/notion/getPageTableOfContents'
|
||||||
import md5 from 'js-md5'
|
import md5 from 'js-md5'
|
||||||
|
import { isBrowser } from '@/lib/utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据notion的slug访问页面
|
* 根据notion的slug访问页面
|
||||||
@@ -20,13 +20,17 @@ const Slug = props => {
|
|||||||
const { theme, changeLoadingState } = useGlobal()
|
const { theme, changeLoadingState } = useGlobal()
|
||||||
const ThemeComponents = ThemeMap[theme]
|
const ThemeComponents = ThemeMap[theme]
|
||||||
const { post, siteInfo } = props
|
const { post, siteInfo } = props
|
||||||
const router = Router.useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
// 文章锁🔐
|
// 文章锁🔐
|
||||||
const [lock, setLock] = React.useState(post?.password && post?.password !== '')
|
const [lock, setLock] = useState(post?.password && post?.password !== '')
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
changeLoadingState(false)
|
if (post) {
|
||||||
|
changeLoadingState(false)
|
||||||
|
} else {
|
||||||
|
changeLoadingState(true)
|
||||||
|
}
|
||||||
if (post?.password && post?.password !== '') {
|
if (post?.password && post?.password !== '') {
|
||||||
setLock(true)
|
setLock(true)
|
||||||
} else {
|
} else {
|
||||||
@@ -42,7 +46,7 @@ const Slug = props => {
|
|||||||
if (!post) {
|
if (!post) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (isBrowser()) {
|
if (isBrowser()) {
|
||||||
const article = document.getElementById('container')
|
const article = document.getElementById('notion-article')
|
||||||
if (!article) {
|
if (!article) {
|
||||||
router.push('/404').then(() => {
|
router.push('/404').then(() => {
|
||||||
console.warn('找不到页面', router.asPath)
|
console.warn('找不到页面', router.asPath)
|
||||||
|
|||||||
Reference in New Issue
Block a user