fix(frontend): guard startup and loading shortcuts

This commit is contained in:
zipg authored and GitHub committed 2026-08-03 16:57:26 +08:00
1 parent 246dfad018
commit 658e3d16ad
17 files changed
+420 -15

No files matched your search

+7
View File
@@ -90,6 +90,7 @@ import { countAvailableAgentDriverUpdates, type AgentDriverUpdateBadgeState } fr
import type { DriverStoreFocus } from "@/lib/connection/agentDriverInstallHint";
import { safeLocalStorageGet, safeLocalStorageSet } from "@/lib/backend/safeStorage";
import { apiUrl, webPath } from "@/lib/common/webPath";
import { shouldBlockAppNativeSelectAll } from "@/lib/common/clipboard";
import { APP_FONT_SANS_CSS_VAR, DATA_GRID_FONT_FAMILY_CSS_VAR, DEFAULT_DATA_GRID_FONT_FAMILY, DEFAULT_UI_FONT_FAMILY } from "@/lib/app/appFonts";
import { rankSavedSqlHistory } from "@/lib/savedSql/savedSqlHistory";
import { savedSqlDefaultTargetForWrite } from "@/lib/savedSql/savedSqlExecutionTarget";
@@ -1873,6 +1874,10 @@ function activateAdjacentTab(direction: -1 | 1): boolean {
return activateTabByIndex(nextIndex);
}
function handleNativeSelectAll(e: KeyboardEvent) {
if (shouldBlockAppNativeSelectAll(e)) e.preventDefault();
}
function handleKeydown(e: KeyboardEvent) {
if (e.defaultPrevented) return;
@@ -2138,6 +2143,7 @@ onMounted(async () => {
});
applyTheme();
void applyUiScale(settingsStore.editorSettings.uiScale);
window.addEventListener("keydown", handleNativeSelectAll, true);
window.addEventListener("keydown", handleKeydown);
window.addEventListener("dbx-open-driver-store", openDriverStoreFromEvent);
if (isDesktop) {
@@ -2204,6 +2210,7 @@ onUnmounted(() => {
if (updateCheckTimer) {
clearInterval(updateCheckTimer);
}
window.removeEventListener("keydown", handleNativeSelectAll, true);
window.removeEventListener("keydown", handleKeydown);
window.removeEventListener("dbx-open-driver-store", openDriverStoreFromEvent);
document.removeEventListener("contextmenu", handleContextMenu);