Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/components/layout/ExplorerSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,21 @@ export const ExplorerSidebar = ({ sidebarWidth, startResize, onCollapse, sidebar
return () => window.removeEventListener("tabularis:paste-import", handler);
}, [activeConnectionId, activeCapabilities]);

// Focus the first visible "Filter tables…" input (flat / per-schema / per-db
// layouts) when the focus_table_filter shortcut fires.
useEffect(() => {
const handler = () => {
const input = sidebarBodyRef.current?.querySelector<HTMLInputElement>(
"[data-table-filter]",
);
input?.focus();
input?.select();
};
window.addEventListener("tabularis:focus-table-filter", handler);
return () =>
window.removeEventListener("tabularis:focus-table-filter", handler);
}, []);

const handleTableClick = (tableName: string, schema?: string) => {
setActiveTable(tableName, schema);
};
Expand Down Expand Up @@ -1438,6 +1453,7 @@ export const ExplorerSidebar = ({ sidebarWidth, startResize, onCollapse, sidebar
<Search size={11} className="absolute left-2 text-muted pointer-events-none" />
<input
type="text"
data-table-filter
value={tableFilter}
onChange={(e) => setTableFilter(e.target.value)}
placeholder={t("sidebar.filterTables")}
Expand Down
1 change: 1 addition & 0 deletions src/components/layout/sidebar/SidebarDatabaseItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export const SidebarDatabaseItem = ({
<Search size={11} className="absolute left-2 text-muted pointer-events-none" />
<input
type="text"
data-table-filter
value={tableFilter}
onChange={(e) => setTableFilter(e.target.value)}
placeholder={t("sidebar.filterTables")}
Expand Down
1 change: 1 addition & 0 deletions src/components/layout/sidebar/SidebarSchemaItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ export const SidebarSchemaItem = ({
<Search size={11} className="absolute left-2 text-muted pointer-events-none" />
<input
type="text"
data-table-filter
value={tableFilter}
onChange={(e) => setTableFilter(e.target.value)}
placeholder={t("sidebar.filterTables")}
Expand Down
10 changes: 10 additions & 0 deletions src/config/shortcuts.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@
"i18nKey": "settings.shortcuts.toggleSidebar",
"overridable": true
},
{
"id": "focus_table_filter",
"category": "navigation",
"defaultMac": "⌘+Shift+F",
"defaultWin": "Ctrl+Shift+F",
"macMatch": { "metaKey": true, "shiftKey": true, "key": "f" },
"winMatch": { "ctrlKey": true, "shiftKey": true, "key": "f" },
"i18nKey": "settings.shortcuts.focusTableFilter",
"overridable": true
},
{
"id": "open_connections",
"category": "navigation",
Expand Down
10 changes: 9 additions & 1 deletion src/hooks/useGlobalShortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ export function useGlobalShortcuts() {
// Don't fire when typing in inputs / textareas / contenteditable (except for the quick navigator)
const target = e.target as HTMLElement;
const isQuickNavigator = matchesShortcut(e, "quick_navigator");
const isFocusTableFilter = matchesShortcut(e, "focus_table_filter");
if (
(target.tagName === "INPUT" ||
target.tagName === "TEXTAREA" ||
target.isContentEditable) &&
!isQuickNavigator
!isQuickNavigator &&
!isFocusTableFilter
) {
return;
}
Expand All @@ -32,6 +34,12 @@ export function useGlobalShortcuts() {
return;
}

if (matchesShortcut(e, "focus_table_filter")) {
e.preventDefault();
window.dispatchEvent(new CustomEvent("tabularis:focus-table-filter"));
return;
}

if (matchesShortcut(e, "paste_import_clipboard")) {
e.preventDefault();
window.dispatchEvent(new CustomEvent("tabularis:paste-import"));
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@
"tabSwitcher": "Tab wechseln",
"copySelection": "Auswahl kopieren",
"toggleSidebar": "Seitenleiste umschalten",
"focusTableFilter": "Tabellenfilter fokussieren",
"openConnections": "Verbindungen öffnen",
"newConnection": "Neue Verbindung",
"newTab": "Neuer Tab",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@
"tabSwitcher": "Switch tab",
"copySelection": "Copy selection",
"toggleSidebar": "Toggle sidebar",
"focusTableFilter": "Focus table filter",
"openConnections": "Open connections",
"newConnection": "New connection",
"newTab": "New tab",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@
"tabSwitcher": "Cambiar pestaña",
"copySelection": "Copiar selección",
"toggleSidebar": "Mostrar/ocultar barra lateral",
"focusTableFilter": "Enfocar el filtro de tablas",
"openConnections": "Abrir conexiones",
"newConnection": "Nueva conexión",
"newTab": "Nueva pestaña",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@
"tabSwitcher": "Changer d’onglet",
"copySelection": "Copier la sélection",
"toggleSidebar": "Afficher/masquer la barre latérale",
"focusTableFilter": "Focaliser le filtre de tables",
"openConnections": "Ouvrir les connexions",
"newConnection": "Nouvelle connexion",
"newTab": "Nouvel onglet",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@
"tabSwitcher": "Cambia tab",
"copySelection": "Copia selezione",
"toggleSidebar": "Mostra/nascondi sidebar",
"focusTableFilter": "Focalizza il filtro tabelle",
"openConnections": "Apri connessioni",
"newConnection": "Nuova connessione",
"newTab": "Nuovo tab",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@
"tabSwitcher": "タブを切り替え",
"copySelection": "選択範囲をコピー",
"toggleSidebar": "サイドバーを切り替え",
"focusTableFilter": "テーブルフィルターにフォーカス",
"openConnections": "接続を開く",
"newConnection": "新規接続",
"newTab": "新規タブ",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@
"tabSwitcher": "Переключить вкладку",
"copySelection": "Копировать выделение",
"toggleSidebar": "Показать/скрыть боковую панель",
"focusTableFilter": "Фокус на фильтре таблиц",
"openConnections": "Открыть подключения",
"newConnection": "Новое подключение",
"newTab": "Новая вкладка",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@
"tabSwitcher": "切换标签",
"copySelection": "复制选区",
"toggleSidebar": "切换侧边栏",
"focusTableFilter": "聚焦表格筛选",
"openConnections": "打开连接",
"newConnection": "新建连接",
"newTab": "新建标签",
Expand Down