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(sidebar): copy selected name in single-click mode

t8y2b2324aea29a5
diff --git a/apps/desktop/src/components/sidebar/TreeItem.vue b/apps/desktop/src/components/sidebar/TreeItem.vue
index bf1c5ae1f5..702d9973aa 100644
--- a/apps/desktop/src/components/sidebar/TreeItem.vue
+++ b/apps/desktop/src/components/sidebar/TreeItem.vue
@@ -413,7 +413,7 @@ function isEditableShortcutTarget(target: EventTarget | null): boolean {
function onKeydown(event: KeyboardEvent) {
if (!isSelected.value || isEditableShortcutTarget(event.target)) return;
- const action = sidebarSelectionCopyAction(event, settingsStore.editorSettings.sidebarActivation);
+ const action = sidebarSelectionCopyAction(event);
if (action !== "copy-name") return;
event.preventDefault();
event.stopPropagation();
diff --git a/apps/desktop/src/lib/treeNodeClick.ts b/apps/desktop/src/lib/treeNodeClick.ts
index 2629d9aec2..a1887deca9 100644
--- a/apps/desktop/src/lib/treeNodeClick.ts
+++ b/apps/desktop/src/lib/treeNodeClick.ts
@@ -56,10 +56,6 @@ export function treeNodeRowDoubleClickAction(
return "none";
}
-export function sidebarSelectionCopyAction(
- event: ShortcutLikeEvent,
- activation: SidebarActivation,
-): SidebarSelectionCopyAction {
- if (activation !== "double") return "none";
+export function sidebarSelectionCopyAction(event: ShortcutLikeEvent): SidebarSelectionCopyAction {
return matchesShortcut(event, "Mod+C") ? "copy-name" : "none";
}
diff --git a/packages/app-tests/treeNodeClick.test.ts b/packages/app-tests/treeNodeClick.test.ts
index 931c2ce994..87bf5cad79 100644
--- a/packages/app-tests/treeNodeClick.test.ts
+++ b/packages/app-tests/treeNodeClick.test.ts
@@ -82,10 +82,11 @@ test("double click does not open object browser for non-browsable rows", () => {
});
test("double click navigation mode copies the selected sidebar row name", () => {
- assert.equal(sidebarSelectionCopyAction({ key: "c", metaKey: true }, "double"), "copy-name");
- assert.equal(sidebarSelectionCopyAction({ key: "C", ctrlKey: true }, "double"), "copy-name");
+ assert.equal(sidebarSelectionCopyAction({ key: "c", metaKey: true }), "copy-name");
+ assert.equal(sidebarSelectionCopyAction({ key: "C", ctrlKey: true }), "copy-name");
});
-test("single click navigation mode leaves copy shortcuts alone", () => {
- assert.equal(sidebarSelectionCopyAction({ key: "c", metaKey: true }, "single"), "none");
+test("single click navigation mode copies the selected sidebar row name", () => {
+ assert.equal(sidebarSelectionCopyAction({ key: "c", metaKey: true }), "copy-name");
+ assert.equal(sidebarSelectionCopyAction({ key: "C", ctrlKey: true }), "copy-name");
});