feat: add configurable find/replace shortcuts with Mod-R routing

Add find and replace shortcut definitions to the shortcut registry with
Mod+F and Mod+R defaults. Route Mod-R through App → ContentArea to
dispatch to either the query editor replace panel or data grid refresh
based on focus context. Add isModRShortcut helper and tests.
This commit is contained in:
t8y2 committed 2026-05-27 12:20:20 +08:00
1 parent 20fcea82b4
commit 12abe9d0e0
6 files changed
+75 -11

No files matched your search

+10 -2
View File
@@ -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);
});