feat: support pageup/pagedown to scroll up/down
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
parent
2412d59e3e
commit
6e0c3bc5e3
|
|
@ -2,18 +2,6 @@ import { COPY_MAP } from "@renderer/constants"
|
|||
|
||||
export const shortcuts = {
|
||||
feeds: {
|
||||
// previous: {
|
||||
// name: "Previous Subscription",
|
||||
// key: "P",
|
||||
// },
|
||||
// next: {
|
||||
// name: "Next Subscription",
|
||||
// key: "N",
|
||||
// },
|
||||
// toggleFolder: {
|
||||
// name: "Toggle Folder",
|
||||
// key: "X",
|
||||
// },
|
||||
add: {
|
||||
name: "Add Subscription",
|
||||
key: "Meta+T",
|
||||
|
|
@ -85,6 +73,14 @@ export const shortcuts = {
|
|||
name: "Share",
|
||||
key: "Meta+Alt+S",
|
||||
},
|
||||
scrollUp: {
|
||||
name: "Scroll Up",
|
||||
key: "PageUp",
|
||||
},
|
||||
scrollDown: {
|
||||
name: "Scroll Down",
|
||||
key: "PageDown",
|
||||
},
|
||||
},
|
||||
|
||||
audio: {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { useInPeekModal } from "@renderer/components/ui/modal/inspire/PeekModal"
|
|||
import { RootPortal } from "@renderer/components/ui/portal"
|
||||
import { ScrollArea } from "@renderer/components/ui/scroll-area"
|
||||
import { isWebBuild, ROUTE_FEED_PENDING } from "@renderer/constants"
|
||||
import { shortcuts } from "@renderer/constants/shortcuts"
|
||||
import { useEntryReadabilityToggle } from "@renderer/hooks/biz/useEntryActions"
|
||||
import { useRouteParamsSelector, useRouteParms } from "@renderer/hooks/biz/useRouteParams"
|
||||
import { useAuthQuery, useTitle } from "@renderer/hooks/common"
|
||||
|
|
@ -36,6 +37,7 @@ import type { FallbackRender } from "@sentry/react"
|
|||
import { ErrorBoundary } from "@sentry/react"
|
||||
import type { FC } from "react"
|
||||
import { useEffect, useLayoutEffect, useRef } from "react"
|
||||
import { useHotkeys } from "react-hotkeys-hook"
|
||||
|
||||
import { LoadingWithIcon } from "../../components/ui/loading"
|
||||
import { EntryPlaceholderDaily } from "../ai/ai-daily/EntryPlaceholderDaily"
|
||||
|
|
@ -125,6 +127,14 @@ export const EntryContentRender: Component<{ entryId: string }> = ({ entryId, cl
|
|||
scrollerRef.current?.scrollTo(0, 0)
|
||||
}, [entryId])
|
||||
|
||||
useHotkeys(shortcuts.entry.scrollDown.key, () => {
|
||||
scrollerRef.current?.scrollBy(0, window.innerHeight / 2)
|
||||
})
|
||||
|
||||
useHotkeys(shortcuts.entry.scrollUp.key, () => {
|
||||
scrollerRef.current?.scrollBy(0, -window.innerHeight / 2)
|
||||
})
|
||||
|
||||
const isPeekModal = useInPeekModal()
|
||||
if (!entry) return null
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue