From b340b40bcf7c3df62e22bd80b0f54565fb1e9136 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Sun, 16 Feb 2025 13:54:09 +0800 Subject: [PATCH] Revert "fix: Improve the @ model list experience" This reverts commit c53d63f7af229b35233e857c032ba7ded2b294db. --- .../home/Inputbar/MentionModelsButton.tsx | 38 +++---------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/src/renderer/src/pages/home/Inputbar/MentionModelsButton.tsx b/src/renderer/src/pages/home/Inputbar/MentionModelsButton.tsx index 335f82b3..0358ca53 100644 --- a/src/renderer/src/pages/home/Inputbar/MentionModelsButton.tsx +++ b/src/renderer/src/pages/home/Inputbar/MentionModelsButton.tsx @@ -167,35 +167,12 @@ const MentionModelsButton: FC = ({ mentionModels, onMentionModel: onSelec loadPinnedModels() }, []) - useEffect(() => { - if (selectedIndex >= 0 && menuRef.current) { - const menuElement = menuRef.current - const selectedElement = menuElement.querySelector('.ant-dropdown-menu-item-selected') - - if (selectedElement) { - const menuRect = menuElement.getBoundingClientRect() - const selectedRect = selectedElement.getBoundingClientRect() - - if (selectedRect.bottom > menuRect.bottom) { - selectedElement.scrollIntoView({ block: 'nearest', behavior: 'auto' }) - } else if (selectedRect.top < menuRect.top) { - selectedElement.scrollIntoView({ block: 'nearest', behavior: 'auto' }) - } - } - } - }, [selectedIndex]) - useEffect(() => { const showModelSelector = () => { dropdownRef.current?.click() setIsOpen(true) setSelectedIndex(0) setSearchText('') - setTimeout(() => { - if (menuRef.current) { - menuRef.current.scrollTop = 0 - } - }, 0) } const handleKeyDown = (e: KeyboardEvent) => { @@ -316,24 +293,19 @@ const DropdownMenuStyle = createGlobalStyle` overflow-x: hidden; padding: 4px 0; margin-bottom: 40px; - position: relative; &::-webkit-scrollbar { width: 6px; height: 6px; } - &::-webkit-scrollbar-track { - background: transparent; + &::-webkit-scrollbar-thumb { + background: var(--color-scrollbar); + border-radius: 3px; } - &::-webkit-scrollbar-thumb { - border-radius: 10px; - background: var(--color-scrollbar-thumb); - - &:hover { - background: var(--color-scrollbar-thumb-hover); - } + &::-webkit-scrollbar-track { + background: transparent; } }