@@ -30,7 +30,7 @@ import { ref } from 'vue';
const { ipcRenderer } = window.require('electron');
-const platform = ref(window.process.platform);
+const process = window.require('process');
const showInput = ref(false);
const storeInfo = localStorage.getItem('rubick-system-detach') || '{}';
diff --git a/src/main/common/getSearchFiles.ts b/src/main/common/getSearchFiles.ts
index 221cf22..bbb07fc 100644
--- a/src/main/common/getSearchFiles.ts
+++ b/src/main/common/getSearchFiles.ts
@@ -32,7 +32,9 @@ const getSearchFiles = (argv = process.argv, cwd = process.cwd()) => {
};
const putFileToRubick = (webContents, files) => {
- webContents.executeJavaScript(`window.searchFocus(${JSON.stringify(files)})`);
+ webContents.executeJavaScript(
+ `window.searchFocus(${JSON.stringify(files)}, false)`
+ );
};
const copyFileOutsideOfElectronAsar = function (
diff --git a/src/renderer/plugins-manager/clipboardWatch.ts b/src/renderer/plugins-manager/clipboardWatch.ts
index b101866..f2d23d3 100644
--- a/src/renderer/plugins-manager/clipboardWatch.ts
+++ b/src/renderer/plugins-manager/clipboardWatch.ts
@@ -8,10 +8,10 @@ import { ref } from 'vue';
export default ({ currentPlugin, optionsRef, openPlugin, setOptionsRef }) => {
const clipboardFile: any = ref([]);
- const searchFocus = (files) => {
+ const searchFocus = (files, strict = true) => {
const config: any = localConfig.getConfig();
// 未开启自动粘贴
- if (!config.perf.common.autoPast) return;
+ if (!config.perf.common.autoPast && strict) return;
if (currentPlugin.value.name) return;
const fileList = files || getCopyFiles();
diff --git a/src/renderer/plugins-manager/index.ts b/src/renderer/plugins-manager/index.ts
index 6277c9b..15500b4 100644
--- a/src/renderer/plugins-manager/index.ts
+++ b/src/renderer/plugins-manager/index.ts
@@ -176,6 +176,14 @@ const createPluginManager = (): any => {
state.pluginLoading = false;
};
+ window.searchFocus = (args, strict) => {
+ ipcRenderer.send('msg-trigger', {
+ type: 'removePlugin',
+ });
+ window.initRubick();
+ searchFocus(args, strict);
+ };
+
return {
...toRefs(state),
initPlugins,
diff --git a/src/renderer/plugins-manager/options.ts b/src/renderer/plugins-manager/options.ts
index 04e9eb7..1c6dceb 100644
--- a/src/renderer/plugins-manager/options.ts
+++ b/src/renderer/plugins-manager/options.ts
@@ -156,8 +156,6 @@ const optionsManager = ({
setOptionsRef,
});
- window.searchFocus = searchFocus;
-
return {
options: optionsRef,
searchFocus,
diff --git a/src/renderer/shims-vue.d.ts b/src/renderer/shims-vue.d.ts
index 497ddb1..81a8848 100644
--- a/src/renderer/shims-vue.d.ts
+++ b/src/renderer/shims-vue.d.ts
@@ -26,5 +26,5 @@ interface Window {
setCurrentPlugin: (plugin: any) => void;
pluginLoaded: () => void;
getMainInputInfo: () => any;
- searchFocus: (args: any) => any;
+ searchFocus: (args: any, strict?: boolean) => any;
}