mirror of
https://github.com/labring/FastGPT.git
synced 2026-04-19 01:01:39 +08:00
960c8898cf
* feat: add Gemini 3.1 models - Add gemini-3.1-pro-preview (released February 19, 2026) - Add gemini-3.1-flash-lite-preview (released March 3, 2026) Both models support: - 1M context window - 64k max response - Vision - Tool choice * docs: switch to docs layout and apply black theme - Change layout from notebook to docs - Update logo to icon + text format - Apply fumadocs black theme - Simplify global.css (keep only navbar and TOC styles) - Fix icon components to properly accept className props - Add mobile text overflow handling - Update Node engine requirement to >=20.x * doc * doc * lock * fix: ts * doc * doc --------- Co-authored-by: archer <archer@archerdeMac-mini.local> Co-authored-by: archer <545436317@qq.com>
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
/**
|
|
* 修复侧边栏滚动焦点问题
|
|
* 当鼠标从内容区移动到侧边栏时,确保滚动事件作用于侧边栏而不是内容区
|
|
*/
|
|
export function SidebarScrollFix() {
|
|
useEffect(() => {
|
|
const handleMouseEnter = (e: MouseEvent) => {
|
|
const target = e.currentTarget as HTMLElement;
|
|
// 鼠标进入侧边栏时,聚焦到侧边栏的滚动容器
|
|
if (target) {
|
|
target.focus({ preventScroll: true });
|
|
}
|
|
};
|
|
|
|
// 桌面端侧边栏
|
|
const sidebar = document.querySelector('#nd-sidebar');
|
|
// 移动端侧边栏
|
|
const sidebarMobile = document.querySelector('#nd-sidebar-mobile');
|
|
|
|
if (sidebar) {
|
|
sidebar.addEventListener('mouseenter', handleMouseEnter as EventListener);
|
|
// 确保侧边栏可以接收焦点
|
|
(sidebar as HTMLElement).setAttribute('tabindex', '-1');
|
|
}
|
|
|
|
if (sidebarMobile) {
|
|
sidebarMobile.addEventListener('mouseenter', handleMouseEnter as EventListener);
|
|
(sidebarMobile as HTMLElement).setAttribute('tabindex', '-1');
|
|
}
|
|
|
|
return () => {
|
|
if (sidebar) {
|
|
sidebar.removeEventListener('mouseenter', handleMouseEnter as EventListener);
|
|
}
|
|
if (sidebarMobile) {
|
|
sidebarMobile.removeEventListener('mouseenter', handleMouseEnter as EventListener);
|
|
}
|
|
};
|
|
}, []);
|
|
|
|
return null;
|
|
}
|