From 3624024ec7d79fd379de121dabe28455eba73f7f Mon Sep 17 00:00:00 2001 From: purocean Date: Wed, 8 Sep 2021 19:30:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E4=B8=AD=E6=89=A7=E8=A1=8C=E9=80=80=E5=87=BA=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/plugins/markdown-code-run.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/renderer/plugins/markdown-code-run.ts b/src/renderer/plugins/markdown-code-run.ts index b3b32812..8dbe0d31 100644 --- a/src/renderer/plugins/markdown-code-run.ts +++ b/src/renderer/plugins/markdown-code-run.ts @@ -6,6 +6,7 @@ import { getActionHandler } from '@fe/context/action' import * as api from '@fe/support/api' import { FLAG_DISABLE_XTERM } from '@fe/support/global-args' import SvgIcon from '@fe/components/SvgIcon.vue' +import { CtrlCmd, getKeyLabel, matchKeys } from '@fe/context/shortcut' const cache: Record = {} @@ -53,7 +54,11 @@ const RunCode = defineComponent({ } const runInXterm = (e: MouseEvent) => { - getActionHandler('xterm.run-code')(props.language, props.code, e.ctrlKey) + getActionHandler('xterm.run-code')( + props.language, + props.code, + !matchKeys(e, [CtrlCmd]), + ) } const clearResult = () => { @@ -82,7 +87,7 @@ const RunCode = defineComponent({ onClick: run }), h('div', { - title: '在终端中运行代码,Ctrl + 单击不退出解释器', + title: `在终端中运行代码,${getKeyLabel(CtrlCmd)} + 单击不退出解释器`, class: 'no-print', style: 'position: absolute; top: -.5em; right: -0; height: 0; width: 0; border-left: .7em #b7b3b3 solid; border-top: .6em #dddddd00 solid; border-bottom: .6em #dddddd00 solid; border-right: 0; background: rgba(0, 0, 0, 0); cursor: pointer; outline: none;transform: rotate(90deg);', onClick: runInXterm