From 62a9bb01d1d47980280c361b141cdfdca80674b2 Mon Sep 17 00:00:00 2001 From: fofolee Date: Mon, 7 Aug 2023 20:24:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/preload.js | 2 ++ src/App.vue | 29 +++++++++++----------- src/components/CommandSideBar.vue | 40 ++++++++++++++++++++++++------- src/js/options/commandTypes.js | 4 ++-- 4 files changed, 51 insertions(+), 24 deletions(-) diff --git a/plugin/preload.js b/plugin/preload.js index 3e56f8a..bcbbcc1 100644 --- a/plugin/preload.js +++ b/plugin/preload.js @@ -32,6 +32,8 @@ let isProcessExits = pid => { } } +window.isAppVersion4 = () => utools.getAppVersion() >= "4.0.0"; + // 多开检测 window.multiProcessDetection = () => { let pids = JSON.parse(localStorage.getItem('processes')) || []; diff --git a/src/App.vue b/src/App.vue index e302cf8..63bfe0f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -62,20 +62,21 @@ export default defineComponent({ this.utools.whole.onPluginEnter((enter) => { this.enterPlugin(enter); }); - this.utools.whole.onMainPush( - async ({ code, type, payload }) => { - let result = await this.runCommand(code, payload, 5000); - return result.map((x) => { - return { - text: x, - }; - }); - }, - ({ code, type, payload, option }) => { - window.quickcommand.writeClipboard(option.text); - window.utools.showNotification("已复制"); - } - ); + window.isAppVersion4() && + this.utools.whole.onMainPush( + async ({ code, type, payload }) => { + let result = await this.runCommand(code, payload, 5000); + return result.map((x) => { + return { + text: x, + }; + }); + }, + ({ code, type, payload, option }) => { + window.quickcommand.writeClipboard(option.text); + window.utools.showNotification("已复制"); + } + ); this.utools.whole.onPluginOut(() => { this.outPlugin(); }); diff --git a/src/components/CommandSideBar.vue b/src/components/CommandSideBar.vue index c1f8f31..f536148 100644 --- a/src/components/CommandSideBar.vue +++ b/src/components/CommandSideBar.vue @@ -23,13 +23,37 @@ />
- -
+ + + + + + x.name === "regex" || x.name === "over" + ? Object.values(commandTypes).filter((x) => + ["regex", "over", "key"].includes(x.name) ) : Object.values(commandTypes); }, diff --git a/src/js/options/commandTypes.js b/src/js/options/commandTypes.js index f7f55a4..d0167a0 100644 --- a/src/js/options/commandTypes.js +++ b/src/js/options/commandTypes.js @@ -55,7 +55,7 @@ const commandTypes = { icon: "font_download", color: "primary", matchLabel: "关键词", - desc: "在主输入框输入对应关键字进入插件,最通用的一种模式,关键字可以设置多个", + desc: "直接在主输入框输入对应关键字,最通用的一种模式,关键字可以设置多个", valueType: "array", disabledSpecialVars: /{{input}}|{{SelectFile}}|{{pwd}}|{{WindowInfo.*?}}|{{MatchedFiles.*?}}/g, matchToCmds: (rules, desc) => rules, @@ -190,4 +190,4 @@ const commandTypes = { } } -export default commandTypes \ No newline at end of file +export default commandTypes