fix: not choose vars

This commit is contained in:
Joel 2025-08-26 17:35:25 +08:00
parent 5156b8f9c9
commit 40591b2196
2 changed files with 7 additions and 3 deletions

View File

@ -258,8 +258,8 @@ export default function ShortcutsPopupPlugin({
if (!portalRef.current.contains(e.target as Node))
closePortal()
}
document.addEventListener('mousedown', onMouseDown, true)
return () => document.removeEventListener('mousedown', onMouseDown, true)
document.addEventListener('mousedown', onMouseDown, false)
return () => document.removeEventListener('mousedown', onMouseDown, false)
}, [open, closePortal])
const handleInsert = useCallback((command: LexicalCommand<unknown>, params: any) => {

View File

@ -150,6 +150,7 @@ const Item: FC<ItemProps> = ({
}, [isHovering])
const handleChosen = (e: React.MouseEvent) => {
e.stopPropagation()
e.nativeEvent.stopImmediatePropagation()
if (!isSupportFileVar && isFile)
return
@ -186,7 +187,10 @@ const Item: FC<ItemProps> = ({
)
}
onClick={handleChosen}
onMouseDown={e => e.preventDefault()}
onMouseDown={(e) => {
e.stopPropagation()
e.nativeEvent.stopImmediatePropagation()
}}
>
<div className='flex w-0 grow items-center'>
{!isFlat && <VariableIconWithColor