fix(dashboard): Fix the issue where the dashboard editing interface cannot perform cmd+c copying

This commit is contained in:
wangjiahao
2026-07-14 11:04:14 +08:00
parent 17b947cb14
commit a9eda79e73
2 changed files with 10 additions and 2 deletions
@@ -727,7 +727,11 @@ function startResize(e: MouseEvent, point: string, item: CanvasItem, index: numb
infoBox.value.point = point
}
function containerClick() {
function containerClick(e?: MouseEvent) {
// Ignore clicks that originate inside a component so interacting with component
// content (e.g. selecting/copying cells in an S2 table) does not clear the
// current selection. Only blank-canvas clicks deselect.
if ((e?.target as HTMLElement)?.closest?.('.item')) return
// remove current component info
dashboardStore.setCurComponent(null)
}
@@ -52,7 +52,11 @@ const props = defineProps({
const { draggable } = toRefs(props)
const shapeClick = (e: MouseEvent) => {
e.stopPropagation()
// Do not stopPropagation here: the click must reach window so components that
// rely on a window-level click listener (e.g. the S2 table copy interaction,
// which only enables Cmd/Ctrl+C when the last click landed on its canvas) work
// inside the editor. Deselection is handled by containerClick ignoring clicks
// that originate inside a component.
e.preventDefault()
}