mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
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:
parent
95f5853d7d
commit
512d872ac3
@ -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')
|
||||
|
||||
@ -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([
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user