mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-14 07:16:57 +08:00
🐛 #80 修复 win depd bug
This commit is contained in:
parent
e5ff219685
commit
1e73ab5ee6
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rubick",
|
"name": "rubick",
|
||||||
"version": "2.0.1-beta.15",
|
"version": "2.0.1-beta.16",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
@ -24,7 +24,6 @@
|
|||||||
"fix-path": "^3.0.0",
|
"fix-path": "^3.0.0",
|
||||||
"get-mac-apps": "^1.0.2",
|
"get-mac-apps": "^1.0.2",
|
||||||
"got": "^11.8.3",
|
"got": "^11.8.3",
|
||||||
"libnpmsearch": "^3.1.2",
|
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"pouchdb": "^7.2.2",
|
"pouchdb": "^7.2.2",
|
||||||
"vue": "^3.0.0",
|
"vue": "^3.0.0",
|
||||||
|
@ -3,7 +3,6 @@ import {
|
|||||||
AdapterInfo,
|
AdapterInfo,
|
||||||
} from "@/core/plugin-handler/types";
|
} from "@/core/plugin-handler/types";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import search, { Result } from "libnpmsearch";
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import got from "got";
|
import got from "got";
|
||||||
import fixPath from "fix-path";
|
import fixPath from "fix-path";
|
||||||
@ -90,30 +89,6 @@ class AdapterHandler {
|
|||||||
await this.execCommand(installCmd, adapters);
|
await this.execCommand(installCmd, adapters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 从 npm 搜索插件
|
|
||||||
* 传入 streamFunc 可以流式处理
|
|
||||||
* @param {string} adapter 插件名称
|
|
||||||
* @param {(data: Result) => void} [streamFunc] 流式处理钩子
|
|
||||||
* @memberof AdapterHandler
|
|
||||||
*/
|
|
||||||
async search(adapter: string, streamFunc?: (data: Result) => void) {
|
|
||||||
return await new Promise<Result[]>((resolve, reject) => {
|
|
||||||
const result: Result[] = [];
|
|
||||||
const stream = search.stream(adapter);
|
|
||||||
stream.on("data", (data: Result) => {
|
|
||||||
result.push(data);
|
|
||||||
if (streamFunc !== undefined) streamFunc(data);
|
|
||||||
});
|
|
||||||
stream.on("end", () => {
|
|
||||||
resolve(result);
|
|
||||||
});
|
|
||||||
stream.on("error", (e: any) => {
|
|
||||||
reject(e);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新指定插件
|
* 更新指定插件
|
||||||
* @param {...string[]} adapters 插件名称
|
* @param {...string[]} adapters 插件名称
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-show="!!options.length && (searchValue || !!clipboardFile.length) && !currentPlugin.name" class="options" ref="scrollDom">
|
<div v-show="!!options.length && (searchValue || !!clipboardFile.length) && !currentPlugin.name" class="options" ref="scrollDom">
|
||||||
<a-list item-layout="horizontal" :dataSource="options">
|
<a-list item-layout="horizontal" :dataSource="sort(options)">
|
||||||
<template #renderItem="{ item, index }">
|
<template #renderItem="{ item, index }">
|
||||||
<a-list-item
|
<a-list-item
|
||||||
@click="() => item.click()"
|
@click="() => item.click()"
|
||||||
@ -66,6 +66,20 @@ const renderDesc = (desc) => {
|
|||||||
}
|
}
|
||||||
return desc;
|
return desc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const sort = (options) => {
|
||||||
|
for (let i = 0; i < options.length; i++) {
|
||||||
|
for (let j = i + 1; j < options.length; j++) {
|
||||||
|
if (options[j].zIndex > options[i].zIndex) {
|
||||||
|
let temp = options[i];
|
||||||
|
options[i] = options[j];
|
||||||
|
options[j] = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
@ -178,7 +178,7 @@ const changeHideOnBlur = () => {
|
|||||||
const getIcon = () => {
|
const getIcon = () => {
|
||||||
if (props.clipboardFile[0].dataUrl) return props.clipboardFile[0].dataUrl;
|
if (props.clipboardFile[0].dataUrl) return props.clipboardFile[0].dataUrl;
|
||||||
return props.clipboardFile[0].isFile ? require("../assets/file.png") : require("../assets/folder.png")
|
return props.clipboardFile[0].isFile ? require("../assets/file.png") : require("../assets/folder.png")
|
||||||
}
|
};
|
||||||
|
|
||||||
const newWindow = () => {
|
const newWindow = () => {
|
||||||
ipcRenderer.send("msg-trigger", {
|
ipcRenderer.send("msg-trigger", {
|
||||||
|
@ -54,6 +54,7 @@ const optionsManager = ({
|
|||||||
icon: plugin.logo,
|
icon: plugin.logo,
|
||||||
desc: fe.explain,
|
desc: fe.explain,
|
||||||
type: plugin.pluginType,
|
type: plugin.pluginType,
|
||||||
|
zIndex: cmd.label ? 0 : 1, // 排序权重
|
||||||
click: () => {
|
click: () => {
|
||||||
pluginClickEvent({
|
pluginClickEvent({
|
||||||
plugin,
|
plugin,
|
||||||
@ -61,10 +62,10 @@ const optionsManager = ({
|
|||||||
cmd,
|
cmd,
|
||||||
ext: cmd.type
|
ext: cmd.type
|
||||||
? {
|
? {
|
||||||
code: fe.code,
|
code: fe.code,
|
||||||
type: cmd.type || "text",
|
type: cmd.type || "text",
|
||||||
payload: searchValue.value,
|
payload: searchValue.value,
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
openPlugin,
|
openPlugin,
|
||||||
});
|
});
|
||||||
@ -101,14 +102,17 @@ const optionsManager = ({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map((plugin) => {
|
.map((plugin) => {
|
||||||
plugin.click = () => {
|
return {
|
||||||
openPlugin(plugin);
|
...plugin,
|
||||||
|
zIndex: 1,
|
||||||
|
click: () => {
|
||||||
|
openPlugin(plugin);
|
||||||
|
},
|
||||||
};
|
};
|
||||||
return plugin;
|
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
return options;
|
return options;
|
||||||
}
|
};
|
||||||
|
|
||||||
watch(searchValue, () => search(searchValue.value));
|
watch(searchValue, () => search(searchValue.value));
|
||||||
// search Input operation
|
// search Input operation
|
||||||
@ -126,7 +130,12 @@ const optionsManager = ({
|
|||||||
optionsRef.value = options;
|
optionsRef.value = options;
|
||||||
};
|
};
|
||||||
|
|
||||||
const { searchFocus, clipboardFile, clearClipboardFile, readClipboardContent } = useFocus({
|
const {
|
||||||
|
searchFocus,
|
||||||
|
clipboardFile,
|
||||||
|
clearClipboardFile,
|
||||||
|
readClipboardContent,
|
||||||
|
} = useFocus({
|
||||||
currentPlugin,
|
currentPlugin,
|
||||||
optionsRef,
|
optionsRef,
|
||||||
openPlugin,
|
openPlugin,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user