feat(ui): route Ctrl+F search by focused surface

This commit is contained in:
zipg authored and GitHub committed 2026-09-15 23:20:05 +08:00
1 parent 4c80d16e26
commit 3c8ae159fb
23 files changed
+233 -56

No files matched your search

@@ -4484,7 +4484,12 @@ function clearContextReferences() {
mentionError.value = "";
}
defineExpose({ triggerAction, setPrompt, addTableMention, clearContextReferences, selectConversationById });
function focusSearch(): boolean {
void setConversationListOpen(true);
return true;
}
defineExpose({ triggerAction, setPrompt, addTableMention, clearContextReferences, selectConversationById, focusSearch });
const messageRenderer = computed(() => {
const appearance = aiCodeAppearance.value;
@@ -4555,6 +4560,7 @@ async function openExternalUrl(url: string) {
<Search class="pointer-events-none absolute left-3 h-3 w-3 text-muted-foreground" />
<input
ref="conversationSearchInput"
data-ai-conversation-search
v-model="conversationSearchQuery"
type="search"
:aria-label="t('history.conversationSearch')"
@@ -5237,6 +5237,7 @@ onUnmounted(() => {
<div ref="settingsSearchInputContainerRef" class="relative">
<Search class="pointer-events-none absolute top-1/2 left-4 z-10 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
<Input
data-settings-global-search
v-model="settingsSearchQuery"
type="text"
autocomplete="off"
@@ -463,7 +463,7 @@ onBeforeUnmount(() => {
</div>
<div class="relative flex items-center px-2 py-1">
<Search class="absolute left-3 w-3 h-3 text-muted-foreground pointer-events-none" />
<input v-model="searchText" autocapitalize="off" autocorrect="off" spellcheck="false" class="flex-1 h-5 text-xs bg-transparent border rounded pl-5 pr-1 outline-none placeholder:text-muted-foreground" :placeholder="t('history.search')" />
<input data-history-search v-model="searchText" autocapitalize="off" autocorrect="off" spellcheck="false" class="flex-1 h-5 text-xs bg-transparent border rounded pl-5 pr-1 outline-none placeholder:text-muted-foreground" :placeholder="t('history.search')" />
<Popover :open="dateRangeOpen" @update:open="setDateRangeOpen">
<PopoverTrigger as-child>
<button
@@ -80,7 +80,7 @@ describe("QueryEditor search shortcuts", () => {
expect(queryEditorSource).toMatch(/\.\.\.binding\(shortcuts\.sendSelectionToAi[\s\S]*\.\.\.createQueryEditorSearchKeymap/);
expect(queryEditorSource).not.toMatch(/Prec\.highest\(\s*keymap\.of\(\[\s*\.\.\.createQueryEditorSearchKeymap/);
expect(queryEditorSource).toMatch(/function openReplace\(\): boolean \{\s*if \(props\.readOnly\) return false;/);
expect(contentAreaSource).toContain("if (props.resultOnly) return dataGridRef.value?.focusSearch() ?? false;");
expect(contentAreaSource).toContain("if (props.resultOnly) return dataGridRef.value?.focusSearch(target) ?? false;");
expect(contentAreaSource).toContain("return queryEditorRef.value?.openSearch() ?? false;");
expect(contentAreaSource).toContain("return queryEditorRef.value?.openReplace() ?? false;");
expect(queryEditorSource).toMatch(/key:\s*"Escape"/);