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(desktop): prevent window drag from tab whitespace

t8y2ed863e9e5945
diff --git a/apps/desktop/src/components/layout/EditorGroupTabBar.vue b/apps/desktop/src/components/layout/EditorGroupTabBar.vue
index ae8216e4e9..19d6e4deef 100644
--- a/apps/desktop/src/components/layout/EditorGroupTabBar.vue
+++ b/apps/desktop/src/components/layout/EditorGroupTabBar.vue
@@ -1755,7 +1755,7 @@ watch([() => props.specialPageTabs?.settingsActive, () => props.specialPageTabs?
</div>
</CustomContextMenu>
</template>
- <div v-if="!section.pinned" :class="tabTailDragRegionClass" data-tauri-drag-region />
+ <div v-if="!section.pinned" :class="tabTailDragRegionClass" data-tauri-drag-region="false" />
</div>
</div>
</template>
diff --git a/apps/desktop/src/components/layout/__tests__/AlwaysOnTopButton.spec.ts b/apps/desktop/src/components/layout/__tests__/AlwaysOnTopButton.spec.ts
index a35deea684..6c580bae2b 100644
--- a/apps/desktop/src/components/layout/__tests__/AlwaysOnTopButton.spec.ts
+++ b/apps/desktop/src/components/layout/__tests__/AlwaysOnTopButton.spec.ts
@@ -149,6 +149,16 @@ describe("always-on-top button visibility", () => {
setActivePinia(pinia);
});
+ it("keeps the actual title bar on Tauri's intentional native drag path", async () => {
+ const { host, unmount } = mount(AppToolbar, toolbarProps);
+ await settled();
+
+ expect(host.querySelector(".app-toolbar")?.getAttribute("data-tauri-drag-region")).toBe("");
+ expect(host.querySelector('.app-toolbar > [data-tauri-drag-region=""]')).not.toBeNull();
+
+ unmount();
+ });
+
it("hides the main toolbar pin control until the appearance setting opts in", async () => {
const settingsStore = useSettingsStore();
const { host, unmount } = mount(AppToolbar, toolbarProps);
diff --git a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.ts b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.ts
index d57b46436f..668c64be29 100644
--- a/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.ts
+++ b/apps/desktop/src/components/layout/__tests__/EditorGroupTabBar.behavior.spec.ts
@@ -177,6 +177,33 @@ describe("EditorGroupTabBar behavior", () => {
host.remove();
});
+ it("keeps a focus-return click on tab-strip whitespace out of native window dragging", async () => {
+ const store = useQueryStore();
+ const firstId = store.createTab("pg-1", "app", "Query 1", "query");
+ const secondId = store.createTab("pg-1", "app", "Query 2", "query");
+ const mainGroup = store.groups[0];
+ const activated: string[] = [];
+ const { app, host } = mountBar(mainGroup.id, [firstId, secondId], firstId, pinia, (tabId) => activated.push(tabId));
+ await settle();
+
+ const tabTail = host.querySelector<HTMLElement>('[data-tauri-drag-region="false"]');
+ expect(tabTail).not.toBeNull();
+
+ window.dispatchEvent(new Event("blur"));
+ window.dispatchEvent(new Event("focus"));
+ tabTail!.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, button: 0, detail: 1 }));
+ tabTail!.click();
+ await settle();
+ expect(activated).toEqual([]);
+
+ tabPill(host, secondId).click();
+ await settle();
+ expect(activated).toEqual([secondId]);
+
+ app.unmount();
+ host.remove();
+ });
+
it("closes a tab tooltip when the pointer leaves the tab", async () => {
const store = useQueryStore();
const tabId = store.createTab("pg-1", "app", "Plugin", "query");
diff --git a/apps/desktop/src/components/plugins/__tests__/PluginContributionsPanelBatch.spec.ts b/apps/desktop/src/components/plugins/__tests__/PluginContributionsPanelBatch.spec.ts
index cd77abf7d1..fb492b5c65 100644
--- a/apps/desktop/src/components/plugins/__tests__/PluginContributionsPanelBatch.spec.ts
+++ b/apps/desktop/src/components/plugins/__tests__/PluginContributionsPanelBatch.spec.ts
@@ -22,6 +22,7 @@ const mocks = vi.hoisted(() => ({
removePluginTrustedKey: vi.fn(),
toast: vi.fn(),
isTauriRuntime: vi.fn(),
+ openExternal: vi.fn(),
refreshPluginWorkbenches: vi.fn(),
}));
@@ -31,6 +32,7 @@ vi.mock("@/stores/connectionStore", () => ({ useConnectionStore: () => ({ connec
vi.mock("@/stores/queryStore", () => ({ useQueryStore: () => ({}) }));
vi.mock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: mocks.isTauriRuntime }));
vi.mock("@tauri-apps/api/event", () => ({ listen: vi.fn(async () => vi.fn()) }));
+vi.mock("@tauri-apps/plugin-shell", () => ({ open: mocks.openExternal }));
vi.mock("vue-i18n", async () => {
const { ref } = await import("vue");
return { useI18n: () => ({ locale: ref("en"), t: (key: string, values = {}) => `${key}:${JSON.stringify(values)}` }) };
@@ -270,6 +272,33 @@ describe("PluginContributionsPanel batch source validation", () => {
});
});
+describe("PluginContributionsPanel external links", () => {
+ it("hands GitHub and homepage clicks to the desktop shell without selecting the card", async () => {
+ const linkedCatalog = catalog("first", ["linked"]);
+ Object.assign(linkedCatalog.catalog!.plugins[0], {
+ source: "https://github.com/dbxio/linked",
+ homepage: "https://dbxio.com/plugins/linked",
+ });
+ state.catalogResults = [linkedCatalog];
+ state.marketplaceViewMode = "grid";
+ mocks.isTauriRuntime.mockReturnValue(true);
+ await nextTick();
+
+ const sourceButton = host.querySelector<HTMLButtonElement>('[aria-label^="pluginPlatform.sourceRepository"]')!;
+ const homepageButton = host.querySelector<HTMLButtonElement>('[aria-label^="pluginPlatform.pluginHomepage"]')!;
+ const cardClick = vi.fn();
+ sourceButton.closest("article")!.addEventListener("click", cardClick);
+
+ sourceButton.click();
+ await vi.waitFor(() => expect(mocks.openExternal).toHaveBeenCalledTimes(1));
+ homepageButton.click();
+ await vi.waitFor(() => expect(mocks.openExternal).toHaveBeenCalledTimes(2));
+
+ expect(mocks.openExternal.mock.calls).toEqual([["https://github.com/dbxio/linked"], ["https://dbxio.com/plugins/linked"]]);
+ expect(cardClick).not.toHaveBeenCalled();
+ });
+});
+
describe("PluginContributionsPanel update center synchronization", () => {
it("notifies after a single marketplace update without duplicating per batch item", async () => {
const listener = vi.fn();