diff --git a/.env.local b/.env.local index 8a2ae88c2df..b8274ef0559 100644 --- a/.env.local +++ b/.env.local @@ -1,5 +1,5 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=4.3.2 +NEXT_PUBLIC_VERSION=4.4.0 # 可在此添加环境变量,去掉最左边的(# )注释即可 diff --git a/components/AlgoliaSearchModal.js b/components/AlgoliaSearchModal.js index 5446582645c..ea727a48dbb 100644 --- a/components/AlgoliaSearchModal.js +++ b/components/AlgoliaSearchModal.js @@ -1,4 +1,4 @@ -import { useState, useImperativeHandle, useRef, useEffect } from 'react' +import { useState, useImperativeHandle, useRef, useEffect, Fragment } from 'react' import algoliasearch from 'algoliasearch' import replaceSearchResult from '@/components/Mark' import Link from 'next/link' @@ -7,6 +7,22 @@ import throttle from 'lodash/throttle' import { siteConfig } from '@/lib/config' import { useHotkeys } from 'react-hotkeys-hook'; +const ShortCutActions = [ + { + key: '↑ ↓', + action: '选择' + }, + { + key: 'Enter', + action: '跳转' + }, + { + key: 'Esc', + action: '关闭' + } + +] + /** * 结合 Algolia 实现的弹出式搜索框 * 打开方式 cRef.current.openSearch() @@ -234,6 +250,15 @@ export default function AlgoliaSearchModal({ cRef }) {
+ {totalHit === 0 && (
+ { + ShortCutActions.map((action, index) => { + return
{action.key}
+ {action.action}
+ }) + } +
) + }
{totalHit > 0 && (

diff --git a/lib/global.js b/lib/global.js index 57f5e41d0b2..77b94e2dfad 100644 --- a/lib/global.js +++ b/lib/global.js @@ -16,8 +16,8 @@ export function GlobalContextProvider(props) { const [lang, updateLang] = useState(NOTION_CONFIG?.LANG || LANG) // 默认语言 const [locale, updateLocale] = useState(generateLocaleDict(NOTION_CONFIG?.LANG || LANG)) // 默认语言 const [theme, setTheme] = useState(NOTION_CONFIG?.THEME || THEME) // 默认博客主题 - const defaultDarkMode = NOTION_CONFIG?.APPEARANCE || APPEARANCE === 'dark' - const [isDarkMode, updateDarkMode] = useState(defaultDarkMode) // 默认深色模式 + const defaultDarkMode = NOTION_CONFIG?.APPEARANCE || APPEARANCE + const [isDarkMode, updateDarkMode] = useState(defaultDarkMode === 'dark') // 默认深色模式 const [onLoading, setOnLoading] = useState(false) // 抓取文章数据 const router = useRouter() @@ -58,13 +58,13 @@ export function GlobalContextProvider(props) { } useEffect(() => { - initDarkMode(updateDarkMode,defaultDarkMode) + initDarkMode(updateDarkMode, defaultDarkMode) initLocale(lang, locale, updateLang, updateLocale) }, []) // 加载进度条 useEffect(() => { - const handleStart = (url) => { + const handleStart = url => { const { theme } = router.query if (theme && !url.includes(`theme=${theme}`)) { const newUrl = `${url}${url.includes('?') ? '&' : '?'}theme=${theme}` @@ -87,27 +87,28 @@ export function GlobalContextProvider(props) { }, [router]) return ( - - {children} - + + {children} + ) } diff --git a/package.json b/package.json index 13b60baf01a..9dc7983b567 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "4.3.2", + "version": "4.4.0", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": { diff --git a/public/dplayer.htm b/public/dplayer.htm index 67348de4e88..73760fa3380 100644 --- a/public/dplayer.htm +++ b/public/dplayer.htm @@ -8,8 +8,17 @@ @@ -25,7 +34,7 @@