@@ -620,6 +620,24 @@ export function ChatActions(props: {
620620
621621 const [ showTools , setShowTools ] = useState ( false ) ;
622622 const toolsRef = useRef < HTMLDivElement > ( null ) ;
623+ const toolsCloseTimeoutRef = useRef < ReturnType < typeof setTimeout > | null > (
624+ null ,
625+ ) ;
626+
627+ const handleToolsMouseEnter = ( ) => {
628+ if ( toolsCloseTimeoutRef . current ) {
629+ clearTimeout ( toolsCloseTimeoutRef . current ) ;
630+ toolsCloseTimeoutRef . current = null ;
631+ }
632+ setShowTools ( true ) ;
633+ } ;
634+
635+ const handleToolsMouseLeave = ( ) => {
636+ toolsCloseTimeoutRef . current = setTimeout ( ( ) => {
637+ setShowTools ( false ) ;
638+ } , 150 ) ;
639+ } ;
640+
623641 useEffect ( ( ) => {
624642 if ( ! showTools ) return ; // 菜单没开时不监听,省一次注册
625643 const handle = ( e : MouseEvent ) => {
@@ -1478,6 +1496,8 @@ export function ChatActions(props: {
14781496 < div
14791497 ref = { toolsRef }
14801498 className = { clsx ( styles [ "desktop-only" ] , styles [ "tool-wrapper" ] ) }
1499+ onMouseEnter = { handleToolsMouseEnter }
1500+ onMouseLeave = { handleToolsMouseLeave }
14811501 >
14821502 < ChatAction
14831503 onClick = { ( ) => setShowTools ( ( v ) => ! v ) }
@@ -4677,8 +4697,16 @@ function ChatComponent() {
46774697 < IconButton
46784698 icon = { config . tightBorder ? < MinIcon /> : < MaxIcon /> }
46794699 bordered
4680- title = { Locale . Chat . Actions . FullScreen }
4681- aria = { Locale . Chat . Actions . FullScreen }
4700+ title = {
4701+ config . tightBorder
4702+ ? Locale . Chat . Actions . ExitFullScreen
4703+ : Locale . Chat . Actions . FullScreen
4704+ }
4705+ aria = {
4706+ config . tightBorder
4707+ ? Locale . Chat . Actions . ExitFullScreen
4708+ : Locale . Chat . Actions . FullScreen
4709+ }
46824710 onClick = { ( ) => {
46834711 config . update (
46844712 ( config ) => ( config . tightBorder = ! config . tightBorder ) ,
@@ -5879,8 +5907,16 @@ function ChatComponent() {
58795907 < IconButton
58805908 icon = { isExpanded ? < MinIcon /> : < MaxIcon /> }
58815909 bordered
5882- title = { Locale . Chat . Actions . FullScreen }
5883- aria = { Locale . Chat . Actions . FullScreen }
5910+ title = {
5911+ isExpanded
5912+ ? Locale . Chat . Actions . ExitFullScreen
5913+ : Locale . Chat . Actions . FullScreen
5914+ }
5915+ aria = {
5916+ isExpanded
5917+ ? Locale . Chat . Actions . ExitFullScreen
5918+ : Locale . Chat . Actions . FullScreen
5919+ }
58845920 onClick = { toggleExpand }
58855921 />
58865922 < IconButton
0 commit comments