From 6c096fcd999dab4efc2e52eb8b9894664a08d7a6 Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Mon, 13 Nov 2023 11:40:35 +0800 Subject: [PATCH] =?UTF-8?q?:recycle:=20=E4=BC=98=E5=8C=96=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=86=85=E5=AE=B9=E6=8E=92=E5=BA=8F=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DsetSubInput=20=E6=97=A0=E6=B3=95=E8=A7=A6=E5=8F=91=20i?= =?UTF-8?q?nputChange=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/main/common/api.ts | 1 + src/renderer/plugins-manager/index.ts | 2 +- src/renderer/plugins-manager/options.ts | 15 +++++++++++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 496a1cb..ce7981f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubick", - "version": "4.1.5", + "version": "4.1.6", "author": "muwoo <2424880409@qq.com>", "private": true, "scripts": { diff --git a/src/main/common/api.ts b/src/main/common/api.ts index 3fe6baa..73bd370 100644 --- a/src/main/common/api.ts +++ b/src/main/common/api.ts @@ -190,6 +190,7 @@ class API extends DBInstance { value: data.text, })})` ); + this.sendSubInputChangeEvent({ data }); } public getPath({ data }) { diff --git a/src/renderer/plugins-manager/index.ts b/src/renderer/plugins-manager/index.ts index 68246b1..8ca02e0 100644 --- a/src/renderer/plugins-manager/index.ts +++ b/src/renderer/plugins-manager/index.ts @@ -118,7 +118,7 @@ const createPluginManager = (): any => { if (isPin) { pin.forEach((p, index) => { if (p.name === plugin.name) { - pin.splice(index, 1); + plugin = pin.splice(index, 1)[0]; } }); pin.unshift(plugin); diff --git a/src/renderer/plugins-manager/options.ts b/src/renderer/plugins-manager/options.ts index 158984c..3c062ff 100644 --- a/src/renderer/plugins-manager/options.ts +++ b/src/renderer/plugins-manager/options.ts @@ -41,6 +41,17 @@ const optionsManager = ({ options[0].click(); }); + const getIndex = (cmd, value) => { + let index = 0; + if (PinyinMatch.match(cmd.label || cmd, value)) { + index += 1; + } + if (cmd.label) { + index -= 1; + } + return index; + }; + const getOptionsFromSearchValue = (value, strict = false) => { const localPlugins = getGlobal('LOCAL_PLUGINS').getLocalPlugins(); let options: any = []; @@ -61,7 +72,7 @@ const optionsManager = ({ desc: fe.explain, type: plugin.pluginType, match: PinyinMatch.match(cmd.label || cmd, value), - zIndex: cmd.label ? 0 : 1, // 排序权重 + zIndex: getIndex(cmd, value), // 排序权重 click: () => { pluginClickEvent({ plugin, @@ -117,7 +128,7 @@ const optionsManager = ({ .map((plugin) => { const option = { ...plugin, - zIndex: 1, + zIndex: 0, click: () => { openPlugin(plugin, option); },