From 77e66e84619e957ffe86b1d612c19d53d45e7c48 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 1 Nov 2023 17:00:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=AA=E8=A1=A8=E6=9D=BF=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE=E7=9B=B8=E5=BA=94=E5=8C=BA=E5=9F=9F=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=BC=B9=E6=A1=86=E4=B8=AD=E7=9A=84=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=BD=B1=E5=93=8D=E4=BB=AA=E8=A1=A8=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/canvas/utils/shortcutKey.js | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/core/frontend/src/components/canvas/utils/shortcutKey.js b/core/frontend/src/components/canvas/utils/shortcutKey.js index 232d802851..3434a446df 100644 --- a/core/frontend/src/components/canvas/utils/shortcutKey.js +++ b/core/frontend/src/components/canvas/utils/shortcutKey.js @@ -50,10 +50,32 @@ const unlockMap = { let isCtrlOrCommandDown = false + +// 检查当前页面是否有弹框 +const checkDialog = () => { + let haveDialog = false + document.querySelectorAll('.el-dialog__wrapper').forEach(element => { + if (window.getComputedStyle(element).getPropertyValue('display') !== 'none') { + haveDialog = true + } + }) + document.querySelectorAll('.el-popover').forEach(element => { + if (window.getComputedStyle(element).getPropertyValue('display') !== 'none') { + haveDialog = true + } + }) + // 富文本单框 + if (document.querySelector('.tox-dialog-wrap')) { + haveDialog = true + } + + return haveDialog +} + // Monitor key operations globally and execute corresponding commands export function listenGlobalKeyDown() { window.onkeydown = (e) => { - if (!store.state.isInEditor) return + if (!store.state.isInEditor || checkDialog()) return const { keyCode } = e if (keyCode === ctrlKey || keyCode === commandKey) { isCtrlOrCommandDown = true