From 6ee0b2a7955105ac609c8a1f8a3387e80bacf7fb Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Fri, 10 Dec 2021 16:47:33 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=94=AF=E6=8C=81=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=8F=9C=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/localConfig.ts | 3 +- src/core/db/index.ts | 1 - src/main/browsers/main.ts | 5 +- src/main/browsers/runner.ts | 1 + src/renderer/App.vue | 2 + src/renderer/components/search.vue | 83 ++++++++++++++++++++++++++- src/renderer/plugins-manager/index.ts | 10 +++- src/renderer/shims-vue.d.ts | 1 + 8 files changed, 99 insertions(+), 7 deletions(-) diff --git a/src/common/utils/localConfig.ts b/src/common/utils/localConfig.ts index 5706db2..2d55835 100644 --- a/src/common/utils/localConfig.ts +++ b/src/common/utils/localConfig.ts @@ -2,6 +2,7 @@ import path from "path"; import fs from "fs"; import getLocalDataFile from "./getLocalDataFile"; import { app } from "electron"; +import commonConst from "./commonConst"; const configPath = path.join(getLocalDataFile(), "./rubick-config.json"); @@ -17,7 +18,7 @@ const defaultConfigForAnyPlatform = { start: true, space: true, // 是否失焦隐藏。默认在dev环境不隐藏,在打包后隐藏。 - hideOnBlur: app.isPackaged, + hideOnBlur: commonConst.production(), }, local: { search: true, diff --git a/src/core/db/index.ts b/src/core/db/index.ts index e708021..d358d01 100644 --- a/src/core/db/index.ts +++ b/src/core/db/index.ts @@ -71,7 +71,6 @@ export default class { result._id = this.replaceDocId(name, result._id); return result; } catch (e) { - console.log(e); return null; } } diff --git a/src/main/browsers/main.ts b/src/main/browsers/main.ts index e4f2332..8a7b8ae 100644 --- a/src/main/browsers/main.ts +++ b/src/main/browsers/main.ts @@ -53,7 +53,10 @@ export default () => { // 判断失焦是否隐藏 win.on("blur", () => { - app.isPackaged && win.hide(); + const config = { ...global.OP_CONFIG.get() }; + if (config.perf.common.hideOnBlur) { + win.hide(); + } }); }; diff --git a/src/main/browsers/runner.ts b/src/main/browsers/runner.ts index d8049dc..1848f27 100644 --- a/src/main/browsers/runner.ts +++ b/src/main/browsers/runner.ts @@ -51,6 +51,7 @@ export default () => { view.webContents.openDevTools(); executeHooks("PluginEnter", plugin.ext); executeHooks("PluginReady", plugin.ext); + window.webContents.executeJavaScript(`window.pluginLoaded()`); }); }; diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 3cd12d2..58339fe 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -9,6 +9,7 @@ @changeSelect="changeSelect" :searchValue="searchValue" :placeholder="placeholder" + :pluginLoading="pluginLoading" @choosePlugin="choosePlugin" /> @@ -39,6 +40,7 @@ const { openPlugin, currentPlugin, placeholder, + pluginLoading, } = createPluginManager(); initPlugins(); diff --git a/src/renderer/components/search.vue b/src/renderer/components/search.vue index 968b164..27cfd08 100644 --- a/src/renderer/components/search.vue +++ b/src/renderer/components/search.vue @@ -18,11 +18,20 @@ " >