fix: prevent closing quick panel in multiple selection mode

- Updated InputbarCore to avoid closing the quick panel when in multiple selection mode or if triggered by input.
- Removed unnecessary useEffect in KnowledgeBaseButton that dynamically updated the quick panel list based on selected bases.
This commit is contained in:
kangfenmao 2025-12-12 15:13:22 +08:00
parent 95f5853d7d
commit 512d872ac3
2 changed files with 2 additions and 9 deletions

View File

@ -526,7 +526,8 @@ export const InputbarCore: FC<InputbarCoreProps> = ({
const handleFocus = useCallback(() => {
setInputFocus(true)
dispatch(setSearching(false))
if (quickPanel.isVisible && quickPanel.triggerInfo?.type !== 'input') {
// Don't close panel in multiple selection mode, or if triggered by input
if (quickPanel.isVisible && quickPanel.triggerInfo?.type !== 'input' && !quickPanel.multiple) {
quickPanel.close()
}
PasteService.setLastFocusedComponent('inputbar')

View File

@ -92,14 +92,6 @@ const KnowledgeBaseButton: FC<Props> = ({ quickPanel, selectedBases, onSelect, d
}
}, [openQuickPanel, quickPanelHook])
// 监听 selectedBases 变化,动态更新已打开的 QuickPanel 列表状态
useEffect(() => {
if (quickPanelHook.isVisible && quickPanelHook.symbol === QuickPanelReservedSymbol.KnowledgeBase) {
// 直接使用重新计算的 baseItems因为它已经包含了最新的 isSelected 状态
quickPanelHook.updateList(baseItems)
}
}, [selectedBases, quickPanelHook, baseItems])
useEffect(() => {
const disposeRootMenu = quickPanel.registerRootMenu([
{