Revert "fix: Improve the @ model list experience"
This reverts commit c53d63f7af229b35233e857c032ba7ded2b294db.
This commit is contained in:
parent
253fc6f4e1
commit
b340b40bcf
@ -167,35 +167,12 @@ const MentionModelsButton: FC<Props> = ({ 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user