fix(grid): preserve native clipboard in table info

This commit is contained in:
t8y2 committed 2026-07-26 13:47:46 +08:00
1 parent f186857322
commit f18030df72
2 files changed
+22 -1

No files matched your search

@@ -8715,7 +8715,14 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
</template>
</div>
<!-- Table Info Drawer -->
<div v-if="showTableInfo" class="table-info-drawer relative col-start-2 row-start-1 border-l flex flex-col bg-background min-w-0" :class="[{ 'row-span-2': cellDetailPanelIsBottom }, { 'ddl-drawer-resizing': isResizingDdl }]" :style="ddlDrawerStyle" @contextmenu="onDrawerContextMenu">
<div
v-if="showTableInfo"
data-native-clipboard
class="table-info-drawer relative col-start-2 row-start-1 border-l flex flex-col bg-background min-w-0"
:class="[{ 'row-span-2': cellDetailPanelIsBottom }, { 'ddl-drawer-resizing': isResizingDdl }]"
:style="ddlDrawerStyle"
@contextmenu="onDrawerContextMenu"
>
<div class="absolute left-0 top-0 bottom-0 z-20 w-1.5 -translate-x-1/2 cursor-col-resize" @mousedown.prevent="onDdlResizeStart" />
<div class="flex items-center gap-2 px-3 py-1.5 border-b shrink-0 bg-muted/20 h-9">
<TableProperties class="w-3.5 h-3.5 text-muted-foreground" />
@@ -0,0 +1,14 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const dataGridSource = readFileSync(new URL("../DataGrid.vue", import.meta.url), "utf8");
describe("DataGrid native clipboard regions", () => {
it("keeps table info text selection out of grid copy shortcuts", () => {
const drawerStart = dataGridSource.indexOf('<div v-if="showTableInfo"');
const drawerTagEnd = dataGridSource.indexOf(">", drawerStart);
expect(drawerStart).toBeGreaterThanOrEqual(0);
expect(dataGridSource.slice(drawerStart, drawerTagEnd)).toContain("data-native-clipboard");
});
});