From 4d06f82349067f37086414fe7d62ad91cf7dc909 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 26 Dec 2022 16:46:16 +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=E7=BC=96=E8=BE=91=E7=95=8C=E9=9D=A2=E5=A4=8D?= =?UTF-8?q?=E7=94=A8=E5=8A=9F=E8=83=BD=E9=94=AE=E7=9B=98=E7=9B=91=E5=90=AC?= =?UTF-8?q?=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=85=B3=E9=97=AD=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=AF=BC=E8=87=B4=E9=94=AE=E7=9B=98=E7=9B=91?= =?UTF-8?q?=E5=90=AC=E4=BA=8B=E4=BB=B6=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/components/editor/Preview.vue | 3 ++- frontend/src/components/canvas/utils/shortcutKey.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/canvas/components/editor/Preview.vue b/frontend/src/components/canvas/components/editor/Preview.vue index 05a8e141af..a94c23d16a 100644 --- a/frontend/src/components/canvas/components/editor/Preview.vue +++ b/frontend/src/components/canvas/components/editor/Preview.vue @@ -413,7 +413,8 @@ export default { } }, created() { - if (this.canvasId === 'canvas-main') { + // 防止编辑界面销毁键盘事件监听 + if (this.canvasId === 'canvas-main' && !this.showPosition.includes('multiplexing')) { listenGlobalKeyDownPreview() } // 取消视图请求 diff --git a/frontend/src/components/canvas/utils/shortcutKey.js b/frontend/src/components/canvas/utils/shortcutKey.js index 1c0688e91e..02f61cc7ae 100644 --- a/frontend/src/components/canvas/utils/shortcutKey.js +++ b/frontend/src/components/canvas/utils/shortcutKey.js @@ -74,6 +74,8 @@ export function listenGlobalKeyDown() { export function listenGlobalKeyDownPreview() { window.onkeydown = (e) => { const { keyCode } = e + e.preventDefault() + e.stopPropagation() if (keyCode === ctrlKey || keyCode === commandKey) { isCtrlOrCommandDown = true } else if (isCtrlOrCommandDown) {