From acf3b798c92d8a4528124a2468b03e8ba138e59a Mon Sep 17 00:00:00 2001 From: HellowVirgil <1135895008@qq.com> Date: Wed, 17 Dec 2025 11:49:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(libro-view):=20=E4=BF=AE=E5=A4=8D=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E7=84=A6=E7=82=B9=E9=80=BB=E8=BE=91=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=97=AE=E9=A2=98=EF=BC=8C=E9=81=BF=E5=85=8D=20Notebo?= =?UTF-8?q?ok=20=E8=99=BD=E7=84=B6=E5=A4=B1=E7=84=A6=E4=BD=86=20focus=20?= =?UTF-8?q?=E6=B2=A1=E8=A2=AB=E6=B8=85=E6=8E=89=E5=AF=BC=E8=87=B4=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=E4=BB=8D=E7=84=B6=E5=A4=84=E4=BA=8E=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/libro-core/src/libro-view.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/libro-core/src/libro-view.tsx b/packages/libro-core/src/libro-view.tsx index 16512428..f92e7e5a 100644 --- a/packages/libro-core/src/libro-view.tsx +++ b/packages/libro-core/src/libro-view.tsx @@ -262,18 +262,16 @@ export const LibroRender = forwardRef(function LibroRender(props if (typeof ref === 'function') { return; } - // focus编辑器host - if (!e.relatedTarget) { - return; - } - // focus编辑器外部区域 - if (ref?.current?.contains(e.relatedTarget)) { + const target = e.relatedTarget as Node | null; + const inside = target ? ref?.current?.contains(target) : false; + + if (inside) { const dndDom = ref?.current?.getElementsByClassName( 'libro-dnd-cells-container', )[0]; if ( - !dndDom?.contains(e.relatedTarget) && + !dndDom?.contains(target as Node) && (!instance.model.inputEditable || !instance.model.outputEditable || !instance.model.cellsEditable) &&