fix: user profile can not scroll by scrollbar
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
parent
6873d21e26
commit
eac1965cfc
|
|
@ -26,7 +26,7 @@ import { MarkdownRenderContainerRefContext } from "../context"
|
|||
import type { TocItemProps } from "./TocItem"
|
||||
import { TocItem } from "./TocItem"
|
||||
|
||||
type DebouncedFuncLeading<T extends (...args: any[]) => any> = T & {
|
||||
type DebouncedFuncLeading<T extends (..._args: any[]) => any> = T & {
|
||||
cancel: () => void
|
||||
flush: () => void
|
||||
}
|
||||
|
|
@ -218,7 +218,7 @@ export const Toc: Component = ({ className }) => {
|
|||
{toc.map((heading, index) => (
|
||||
<MemoedItem
|
||||
heading={heading}
|
||||
key={heading.title}
|
||||
key={heading.anchorId}
|
||||
rootDepth={rootDepth}
|
||||
onClick={handleScrollTo}
|
||||
isScrollOut={index < currentScrollRange[0]}
|
||||
|
|
@ -246,7 +246,7 @@ export const Toc: Component = ({ className }) => {
|
|||
>
|
||||
{toc.map((heading, index) => (
|
||||
<li
|
||||
key={heading.title}
|
||||
key={heading.anchorId}
|
||||
className="flex h-[24px] w-full items-center"
|
||||
>
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ const Scrollbar = React.forwardRef<
|
|||
<ScrollAreaBase.Scrollbar
|
||||
{...rest}
|
||||
ref={forwardedRef}
|
||||
forceMount
|
||||
className={cn(
|
||||
"z-[99] flex w-2.5 touch-none select-none p-0.5",
|
||||
orientation === "horizontal" ?
|
||||
|
|
|
|||
|
|
@ -90,16 +90,16 @@ const EntryUser: Component<{
|
|||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
className="relative"
|
||||
className="no-drag-region relative cursor-pointer"
|
||||
style={{
|
||||
right: `${i * 8}px`,
|
||||
zIndex: i,
|
||||
}}
|
||||
asChild
|
||||
>
|
||||
<m.button
|
||||
layout="position"
|
||||
layoutId={userId}
|
||||
className="no-drag-region cursor-pointer"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
presentUserProfile(userId)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@ export const UserProfileModalContent: FC<{
|
|||
if (!$ref) return
|
||||
|
||||
const initialHeaderHeight = 136
|
||||
$ref.onscroll = throttle(() => {
|
||||
|
||||
const scrollHandler = throttle(() => {
|
||||
const currentH = $ref.scrollTop
|
||||
|
||||
setHeaderSimple((current) => {
|
||||
|
|
@ -102,6 +103,7 @@ export const UserProfileModalContent: FC<{
|
|||
return current
|
||||
})
|
||||
}, 16)
|
||||
$ref.addEventListener("scroll", scrollHandler)
|
||||
|
||||
const currentVisible = new Set<string>()
|
||||
const ob = new IntersectionObserver((en) => {
|
||||
|
|
@ -123,7 +125,7 @@ export const UserProfileModalContent: FC<{
|
|||
ob.observe(el)
|
||||
})
|
||||
return () => {
|
||||
$ref.onscroll = null
|
||||
$ref.removeEventListener("scroll", scrollHandler)
|
||||
|
||||
ob.disconnect()
|
||||
}
|
||||
|
|
@ -176,7 +178,7 @@ export const UserProfileModalContent: FC<{
|
|||
>
|
||||
<m.div
|
||||
onPointerDown={stopPropagation}
|
||||
onPointerDownCapture={stopPropagation}
|
||||
// onPointerDownCapture={stopPropagation}
|
||||
tabIndex={-1}
|
||||
initial="initial"
|
||||
animate={controller}
|
||||
|
|
@ -291,7 +293,7 @@ export const UserProfileModalContent: FC<{
|
|||
</div>
|
||||
<ScrollArea.ScrollArea
|
||||
ref={setScrollerRef}
|
||||
rootClassName="h-[400px] grow max-w-full px-5 w-full"
|
||||
rootClassName="grow max-w-full px-5 w-full"
|
||||
viewportClassName="[&>div]:space-y-4 pb-4"
|
||||
>
|
||||
{subscriptions.isLoading ? (
|
||||
|
|
|
|||
Loading…
Reference in New Issue