From 27a3d64700caaf67019e238b1c366cd010bfd59e Mon Sep 17 00:00:00 2001 From: Dymonelewis <120695700@qq.com> Date: Fri, 26 Dec 2025 16:08:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E4=BF=AE=E5=A4=8D=E8=BE=B9?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=81=B6=E5=8F=91=E5=A4=B1=E7=84=A6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/view/edge/BaseEdge.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/core/src/view/edge/BaseEdge.tsx b/packages/core/src/view/edge/BaseEdge.tsx index a57f6dabe..dd2e8be6f 100644 --- a/packages/core/src/view/edge/BaseEdge.tsx +++ b/packages/core/src/view/edge/BaseEdge.tsx @@ -1,4 +1,5 @@ import { createElement as h, Component, createRef } from 'preact/compat' +import { isFunction, isNil } from 'lodash-es' import { Circle } from '../shape' import { LineText } from '../text' import LogicFlow from '../../LogicFlow' @@ -565,6 +566,15 @@ export abstract class BaseEdge
extends Component< e, position, }) + // 复制粘贴后会出现点击边时,边会失去焦点的问题,这里手动让边获焦以解决这个问题 + const el = e.currentTarget as HTMLElement + const rAF = + !isNil(window) && isFunction(window.requestAnimationFrame) + ? window.requestAnimationFrame.bind(window) + : (fn: () => void) => setTimeout(fn, 0) + rAF(() => { + el.focus() + }) } const { editConfigModel } = graphModel graphModel.selectEdgeById(model.id, isMultipleSelect(e, editConfigModel))