diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vue index 8506fc349..f17548852 100644 --- a/apps/desktop/src/App.vue +++ b/apps/desktop/src/App.vue @@ -40,6 +40,7 @@ import { isCloseTabShortcut, isExecuteSqlShortcut, isFocusSearchShortcut, + isModRShortcut, isNewQueryShortcut, isObjectSourceSaveShortcutTarget, isRefreshDataShortcut, @@ -608,6 +609,8 @@ function onAiRequestAutoExecuteSql(sql: string) { } function handleKeydown(e: KeyboardEvent) { + if (e.defaultPrevented) return; + const shortcuts = settingsStore.editorSettings.shortcuts; if (isFocusSearchShortcut(e, shortcuts)) { @@ -659,6 +662,11 @@ function handleKeydown(e: KeyboardEvent) { tryExecute(); return; } + if (isModRShortcut(e) && e.target instanceof Element && contentAreaRef.value?.handleModRTarget(e.target)) { + e.preventDefault(); + e.stopPropagation(); + return; + } if (isDesktop && isBrowserReloadShortcut(e)) { e.preventDefault(); e.stopPropagation(); @@ -725,7 +733,7 @@ onMounted(async () => { aiPanelReady.value = true; }); applyTheme(); - window.addEventListener("keydown", handleKeydown, true); + window.addEventListener("keydown", handleKeydown); window.addEventListener("dbx-open-driver-store", openDriverStoreFromEvent); if (isDesktop) { document.addEventListener("contextmenu", handleContextMenu); @@ -780,7 +788,7 @@ onUnmounted(() => { if (updateCheckTimer) { clearInterval(updateCheckTimer); } - window.removeEventListener("keydown", handleKeydown, true); + window.removeEventListener("keydown", handleKeydown); window.removeEventListener("dbx-open-driver-store", openDriverStoreFromEvent); document.removeEventListener("contextmenu", handleContextMenu); }); diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index c4b6c668f..1c4dd2fe8 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -127,6 +127,7 @@ import { isCopyCurrentRowShortcut, isDeleteCurrentRowShortcut, isFocusSearchShortcut, + isModRShortcut, isToggleTransposeShortcut, } from "@/lib/keyboardShortcuts"; import { dataGridHeaderContentWidth, scrollbarGutterWidth } from "@/lib/dataGridScrollGutter"; @@ -2874,12 +2875,24 @@ function commitGridEdit() { nextTick(() => gridRef.value?.focus({ preventScroll: true })); } +function openCellDetailSearch(): boolean { + return getDetailEditor()?.openSearch() ?? false; +} + async function onGridKeydown(event: KeyboardEvent) { + if (event.defaultPrevented) return; + if (isFocusSearchShortcut(event)) { event.preventDefault(); focusSearch(); return; } + if (isModRShortcut(event)) { + event.preventDefault(); + event.stopPropagation(); + await onToolbarRefresh(); + return; + } if (eventTargetAllowsNativeClipboard(event)) return; if (isCopyCurrentRowShortcut(event, settingsStore.editorSettings.shortcuts) && copyCurrentRow()) { event.preventDefault(); @@ -3564,12 +3577,14 @@ defineExpose({ toggleColumnVisibility, showAllColumns, invertColumnVisibility, + openCellDetailSearch, });