From 0b11c007ba88476ffc2a71e32113b0fb0ce44f73 Mon Sep 17 00:00:00 2001 From: ZLY Date: Thu, 18 Dec 2025 14:45:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(flowEditor):=20=E5=A2=9E=E5=BC=BA=E5=BF=AB?= =?UTF-8?q?=E6=8D=B7=E9=94=AE=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/flowEditor/FlowEditorMain.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/pages/flowEditor/FlowEditorMain.tsx b/src/pages/flowEditor/FlowEditorMain.tsx index d44a0f1..36b8537 100644 --- a/src/pages/flowEditor/FlowEditorMain.tsx +++ b/src/pages/flowEditor/FlowEditorMain.tsx @@ -231,6 +231,29 @@ const FlowEditorMain: React.FC = (props) => { // 兼容 Mac (metaKey) 和 Windows/Linux (ctrlKey) const isModifierKey = e.ctrlKey || e.metaKey; + // 检查事件目标是否在可编辑元素中(input、textarea、contenteditable、CodeMirror等) + const target = e.target as HTMLElement; + const isEditableElement = + target instanceof HTMLInputElement || + target instanceof HTMLTextAreaElement || + target?.getAttribute('contenteditable') === 'true' || + target?.closest('[contenteditable="true"]') !== null || + target?.closest('.cm-content') !== null || // CodeMirror 编辑器 + target?.closest('.cm-editor') !== null || + target?.closest('.arco-input') !== null || // Arco Design 输入框 + target?.closest('.arco-textarea') !== null; + + // 检查是否有打开的弹出层(Modal、Drawer、Popover等),如果有则不拦截快捷键 + const hasOpenPopup = + document.querySelector('.arco-modal-wrapper') !== null || + document.querySelector('.arco-drawer-wrapper') !== null || + document.querySelector('.arco-popover-popup') !== null; + + // 如果在可编辑元素中或有打开的弹出层,不拦截复制粘贴快捷键,让浏览器处理 + if (isEditableElement || hasOpenPopup) { + return; + } + // Ctrl/Cmd+Z 撤销 if (isModifierKey && e.key === 'z' && !e.shiftKey && canUndo) { e.preventDefault();