Skip to content

Commit c4d178d

Browse files
authored
feat: support back navigation via delete key (#717)
* feat: support back navigation via delete key * docs: update changelog
1 parent 6333c69 commit c4d178d

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

docs/content.en/docs/release-notes/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Information about release notes of Coco Server is provided here.
1616
- feat: support `Tab` and `Enter` for delete dialog buttons #700
1717
- feat: add check for updates #701
1818
- feat: impl extension store #699
19+
- feat: support back navigation via delete key #717
1920

2021
### 🐛 Bug fix
2122

src/components/Search/AssistantManager.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export function useAssistantManager({
3333
setVisibleExtensionStore,
3434
setSearchValue,
3535
visibleExtensionDetail,
36+
setVisibleExtensionDetail,
37+
sourceData,
38+
setSourceData,
3639
} = useSearchStore();
3740

3841
const { quickAiAccessAssistant, disabledExtensions } = useExtensionsStore();
@@ -93,7 +96,21 @@ export function useAssistantManager({
9396
const { value } = currentTarget;
9497

9598
if (key === "Backspace" && value === "") {
96-
return setGoAskAi(false);
99+
if (goAskAi) {
100+
return setGoAskAi(false);
101+
}
102+
103+
if (visibleExtensionDetail) {
104+
return setVisibleExtensionDetail(false);
105+
}
106+
107+
if (visibleExtensionStore) {
108+
return setVisibleExtensionStore(false);
109+
}
110+
111+
if (sourceData) {
112+
return setSourceData(void 0);
113+
}
97114
}
98115

99116
if (key === "Tab" && !isChatMode && isTauri) {
@@ -124,6 +141,9 @@ export function useAssistantManager({
124141
handleAskAi,
125142
handleSubmit,
126143
selectedSearchContent,
144+
visibleExtensionStore,
145+
visibleExtensionDetail,
146+
sourceData,
127147
]
128148
);
129149

0 commit comments

Comments
 (0)