fix(sidebar): copy selected table names to clipboard

This commit is contained in:
t8y2 committed 2026-07-22 23:10:39 +08:00
1 parent e6224ec0b0
commit 08d73ce371
2 files changed
+34 -18

No files matched your search

@@ -2837,23 +2837,6 @@ async function confirmPasteTable() {
}
}
function copyTableToClipboard() {
const node = activeNode.value;
if (node.type !== "table" || !node.connectionId || !node.database) return;
connectionStore.treeClipboard = {
kind: "table-copy",
tables: [
{
connectionId: node.connectionId,
database: node.database,
schema: node.schema,
tableName: node.label,
},
],
};
toast(t("contextMenu.pasteTableClipboardUpdated"), 2000);
}
function openPasteTableDialog() {
const clipboard = connectionStore.treeClipboard;
if (clipboard?.kind !== "table-copy" || !canPasteTreeClipboardToCurrentNode()) {
@@ -3939,7 +3922,8 @@ function buildObjectSidebarMenu(context: SidebarMenuFactoryContext): boolean {
if (isTableNotView.value) {
items.push({ label: "", separator: true });
items.push({ label: t("contextMenu.duplicateStructure"), action: duplicateStructure, icon: CopyPlus });
items.push({ label: t("contextMenu.copyTable"), action: copyTableToClipboard, icon: Copy });
// Keep menu copy aligned with keyboard copy so frozen multi-selection and single-row fallback stay compatible.
items.push({ label: t("contextMenu.copyTable"), action: copySelectedNames, icon: Copy });
if (supportsTruncate.value) {
destructiveActions.push({
label: truncateMenuLabel(t("contextMenu.truncateTable")),