Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(dialog): allow dragging window from modal overlay

zipg4382736c0243
diff --git a/apps/desktop/src/components/ui/dialog/DialogOverlay.vue b/apps/desktop/src/components/ui/dialog/DialogOverlay.vue
index 4b001dd03f..7d36f1c18b 100644
--- a/apps/desktop/src/components/ui/dialog/DialogOverlay.vue
+++ b/apps/desktop/src/components/ui/dialog/DialogOverlay.vue
@@ -4,14 +4,30 @@ import type { HTMLAttributes } from "vue";
import { reactiveOmit } from "@vueuse/core";
import { DialogOverlay } from "reka-ui";
import { cn } from "@/lib/utils";
+import { isTauriRuntime } from "@/lib/tauriRuntime";
const props = defineProps<DialogOverlayProps & { class?: HTMLAttributes["class"] }>();
const delegatedProps = reactiveOmit(props, "class");
+const isDesktop = isTauriRuntime();
+
+async function startWindowDrag(event: PointerEvent) {
+ if (!isDesktop || event.button !== 0) return;
+ event.preventDefault();
+ event.stopPropagation();
+ const { getCurrentWindow } = await import("@tauri-apps/api/window");
+ const currentWindow = getCurrentWindow();
+ if (event.detail >= 2) {
+ await currentWindow.toggleMaximize().catch(() => {});
+ return;
+ }
+ await currentWindow.startDragging().catch(() => {});
+}
</script>
<template>
<DialogOverlay data-slot="dialog-overlay" v-bind="delegatedProps" :class="cn('data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-open:supports-backdrop-filter:backdrop-blur-xs bg-black/10 duration-100 fixed inset-0 isolate z-50', props.class)">
+ <div v-if="isDesktop" aria-hidden="true" class="fixed inset-x-0 top-0 h-10 pointer-events-auto" data-tauri-drag-region @pointerdown="startWindowDrag" />
<slot />
</DialogOverlay>
</template>