25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix: prevent browser reload shortcuts in desktop app
t8y2718f0c1679ab
diff --git a/apps/desktop/src/App.vue b/apps/desktop/src/App.vueindex baf6f498cd..e236b5a4ff 100644--- a/apps/desktop/src/App.vue+++ b/apps/desktop/src/App.vue@@ -36,6 +36,7 @@ import { isTauriRuntime } from "@/lib/tauriRuntime";import { sqlFileTitleFromPath } from "@/lib/sqlFileOpen";import { parseConnectionDeepLink, type ConnectionDeepLinkDraft } from "@/lib/connectionDeepLink";import {+ isBrowserReloadShortcut,isCloseTabShortcut,isExecuteSqlShortcut,isFocusSearchShortcut,@@ -656,6 +657,11 @@ function handleKeydown(e: KeyboardEvent) {e.preventDefault();e.stopPropagation();tryExecute();+ return;+ }+ if (isDesktop && isBrowserReloadShortcut(e)) {+ e.preventDefault();+ e.stopPropagation();}}diff --git a/apps/desktop/src/lib/keyboardShortcuts.ts b/apps/desktop/src/lib/keyboardShortcuts.tsindex b7f7d1ca8d..23253d6e3f 100644--- a/apps/desktop/src/lib/keyboardShortcuts.ts+++ b/apps/desktop/src/lib/keyboardShortcuts.ts@@ -113,3 +113,10 @@ export function isDeleteCurrentRowShortcut(event: ShortcutLikeEvent, shortcuts?:export function isCancelSearchShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {return matchesShortcut(event, actionShortcut("cancelSearch", shortcuts));}++export function isBrowserReloadShortcut(event: ShortcutLikeEvent): boolean {+ if (event.isComposing || event.altKey) return false;+ const key = normalizeKey(event.key);+ if (key === "F5") return true;+ return key === "r" && (!!event.metaKey || !!event.ctrlKey);+}diff --git a/packages/app-tests/keyboardShortcuts.test.ts b/packages/app-tests/keyboardShortcuts.test.tsindex 9c004d066f..ab2872b0c3 100644--- a/packages/app-tests/keyboardShortcuts.test.ts+++ b/packages/app-tests/keyboardShortcuts.test.ts@@ -2,6 +2,7 @@ import { strict as assert } from "node:assert";import test from "node:test";import {eventToShortcut,+ isBrowserReloadShortcut,isCancelSearchShortcut,isCloseTabShortcut,isExecuteSqlShortcut,@@ -102,6 +103,14 @@ test("matches custom shortcut settings for refreshing data", () => {);});+test("detects browser reload shortcuts for desktop suppression", () => {+ assert.equal(isBrowserReloadShortcut({ key: "r", ctrlKey: true }), true);+ assert.equal(isBrowserReloadShortcut({ key: "R", metaKey: true, shiftKey: true }), true);+ assert.equal(isBrowserReloadShortcut({ key: "F5" }), true);+ assert.equal(isBrowserReloadShortcut({ key: "r", altKey: true, ctrlKey: true }), false);+ assert.equal(isBrowserReloadShortcut({ key: "r", ctrlKey: true, isComposing: true }), false);+});+test("ignores focus search shortcut while composing", () => {assert.equal(isFocusSearchShortcut({ key: "f", ctrlKey: true, isComposing: true }), false);});