mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-07 13:52:47 +08:00
♻️ 优化搜索内容排序,修复setSubInput 无法触发 inputChange bug
This commit is contained in:
parent
1656418c10
commit
6c096fcd99
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rubick",
|
"name": "rubick",
|
||||||
"version": "4.1.5",
|
"version": "4.1.6",
|
||||||
"author": "muwoo <2424880409@qq.com>",
|
"author": "muwoo <2424880409@qq.com>",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -190,6 +190,7 @@ class API extends DBInstance {
|
|||||||
value: data.text,
|
value: data.text,
|
||||||
})})`
|
})})`
|
||||||
);
|
);
|
||||||
|
this.sendSubInputChangeEvent({ data });
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPath({ data }) {
|
public getPath({ data }) {
|
||||||
|
@ -118,7 +118,7 @@ const createPluginManager = (): any => {
|
|||||||
if (isPin) {
|
if (isPin) {
|
||||||
pin.forEach((p, index) => {
|
pin.forEach((p, index) => {
|
||||||
if (p.name === plugin.name) {
|
if (p.name === plugin.name) {
|
||||||
pin.splice(index, 1);
|
plugin = pin.splice(index, 1)[0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
pin.unshift(plugin);
|
pin.unshift(plugin);
|
||||||
|
@ -41,6 +41,17 @@ const optionsManager = ({
|
|||||||
options[0].click();
|
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 getOptionsFromSearchValue = (value, strict = false) => {
|
||||||
const localPlugins = getGlobal('LOCAL_PLUGINS').getLocalPlugins();
|
const localPlugins = getGlobal('LOCAL_PLUGINS').getLocalPlugins();
|
||||||
let options: any = [];
|
let options: any = [];
|
||||||
@ -61,7 +72,7 @@ const optionsManager = ({
|
|||||||
desc: fe.explain,
|
desc: fe.explain,
|
||||||
type: plugin.pluginType,
|
type: plugin.pluginType,
|
||||||
match: PinyinMatch.match(cmd.label || cmd, value),
|
match: PinyinMatch.match(cmd.label || cmd, value),
|
||||||
zIndex: cmd.label ? 0 : 1, // 排序权重
|
zIndex: getIndex(cmd, value), // 排序权重
|
||||||
click: () => {
|
click: () => {
|
||||||
pluginClickEvent({
|
pluginClickEvent({
|
||||||
plugin,
|
plugin,
|
||||||
@ -117,7 +128,7 @@ const optionsManager = ({
|
|||||||
.map((plugin) => {
|
.map((plugin) => {
|
||||||
const option = {
|
const option = {
|
||||||
...plugin,
|
...plugin,
|
||||||
zIndex: 1,
|
zIndex: 0,
|
||||||
click: () => {
|
click: () => {
|
||||||
openPlugin(plugin, option);
|
openPlugin(plugin, option);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user