Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(search): separate cmd-f and / hotkeys (#681)

gbirman2bbd3a734fef
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index 75223da35e..6d880f5563 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -1820,6 +1820,7 @@ function SearchBar(props: {
const {
viewsDataStore,
selectedView,
+ setSelectedView,
setViewDataStore,
virtualizerHandleSignal: [virtualizerHandle],
entityListRefSignal: [entityListRef],
@@ -1878,25 +1879,43 @@ function SearchBar(props: {
return loading;
}, props.isLoading());
+ const focusSearch = () => {
+ setTimeout(() => {
+ const searchInput = document.getElementById(
+ `search-input-${splitContext.handle.id}-${selectedView()}`
+ ) as HTMLInputElement;
+ searchInput?.focus();
+ }, 0);
+ };
+
onMount(() => {
- const { dispose } = registerHotkey({
+ const { dispose: disposeSlash } = registerHotkey({
hotkey: ['/'],
scopeId: splitContext.splitHotkeyScope,
- description: 'Search in current view',
+ description: 'Search all',
hotkeyToken: TOKENS.soup.openSearch,
keyDownHandler: () => {
- setTimeout(() => {
- const searchInput = document.getElementById(
- `search-input-${splitContext.handle.id}-${selectedView()}`
- ) as HTMLInputElement;
- searchInput?.focus();
- }, 0);
+ setSelectedView(VIEWCONFIG_DEFAULTS_IDS_ENUM.all);
+ focusSearch();
+ return true;
+ },
+ displayPriority: 5,
+ });
+
+ const { dispose: disposeCmd } = registerHotkey({
+ hotkey: ['cmd+f'],
+ scopeId: splitContext.splitHotkeyScope,
+ description: 'Search in current view',
+ keyDownHandler: () => {
+ focusSearch();
return true;
},
displayPriority: 5,
});
+
onCleanup(() => {
- dispose();
+ disposeSlash();
+ disposeCmd();
});
});