From c61bdd02beb5361ab3777f9bd05afa07cd3df27e Mon Sep 17 00:00:00 2001 From: fofolee Date: Sat, 27 Mar 2021 17:46:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AD=90=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=B2=98=E8=B4=B4=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/js/index.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/assets/js/index.js b/src/assets/js/index.js index 8efe925..aec24d5 100644 --- a/src/assets/js/index.js +++ b/src/assets/js/index.js @@ -56,6 +56,7 @@ import qcparser from "./qcparser.js" qccommands.showCodeEditor(file) } else if (code == 'newcommand') { utools.setExpendHeight(600) + $("#quickpanel").hide() $("#options").empty().fadeIn(); let qc = { "program": "quickcommand", "cmd": "", "output": "ignore" } if (payload != 'NewCommand' && payload != '新建快捷命令') { @@ -141,12 +142,17 @@ import qcparser from "./qcparser.js" subinput = text; }, placeholder.slice(1)); } - handleEnter = (event) => { - if (event.keyCode == 13) { - $("#out").append(`

>> ${new Date()}

`); - var cmdToRun = cmd.replace(new RegExp(rule, 'g'), subinput); - runQuickCommand(cmdToRun, option, db.output, true); - } + var querySubInput = () => { + $("#out").append(`

>> ${new Date()}

`); + var cmdToRun = cmd.replace(new RegExp(rule, 'g'), subinput); + runQuickCommand(cmdToRun, option, db.output, true); + } + // 自动粘贴的情况下自动执行 + setTimeout(() => { + if (subinput) querySubInput() + }, 100) + handleEnter = event => { + if (event.keyCode == 13) querySubInput() }; setSubInput(); document.addEventListener('keydown', handleEnter);