From 105a37f258227d64c03aa40b09301279603d83c7 Mon Sep 17 00:00:00 2001 From: caojia <1301869380@qq.com> Date: Sat, 10 Oct 2026 15:54:00 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=94=AF=E6=8C=81=E5=8F=8C?= =?UTF-8?q?=E5=87=BB=E9=80=89=E4=B8=AD=E8=A1=A8=E6=A0=BC=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/directive/common/textDragCopy.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bms-front/src/directive/common/textDragCopy.js b/bms-front/src/directive/common/textDragCopy.js index ea221025..00a55684 100644 --- a/bms-front/src/directive/common/textDragCopy.js +++ b/bms-front/src/directive/common/textDragCopy.js @@ -220,6 +220,28 @@ function handleMouseUp() { } } +function handleDoubleClick(event) { + const cell = resolveCell(event.target) + if (!cell) return + + const textLength = cellText(cell.cell).length + if (!textLength) return + + activeSelection = { + context: cell.context, + bodyWrapper: cell.bodyWrapper, + colIndex: cell.colIndex, + anchorRow: cell.rowIndex, + focusRow: cell.rowIndex, + anchorOffset: 0, + focusOffset: textLength + } + dragging = false + hasDragged = false + renderHighlight() + event.preventDefault() +} + function handleClick(event) { const root = suppressClickRoot if (!root || !root.contains(event.target)) return @@ -244,6 +266,7 @@ function installListeners() { document.addEventListener('mousedown', handleMouseDown, true) document.addEventListener('mousemove', handleMouseMove) document.addEventListener('mouseup', handleMouseUp) + document.addEventListener('dblclick', handleDoubleClick) document.addEventListener('click', handleClick, true) document.addEventListener('copy', handleCopy, true) listenersInstalled = true @@ -254,6 +277,7 @@ function removeListeners() { document.removeEventListener('mousedown', handleMouseDown, true) document.removeEventListener('mousemove', handleMouseMove) document.removeEventListener('mouseup', handleMouseUp) + document.removeEventListener('dblclick', handleDoubleClick) document.removeEventListener('click', handleClick, true) document.removeEventListener('copy', handleCopy, true) listenersInstalled = false