mirror of
https://github.com/rubickCenter/rubick
synced 2026-03-09 15:30:26 +08:00
Compare commits
12 Commits
v4.3.4
...
6bf613042a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bf613042a | ||
|
|
04fe2e03a6 | ||
|
|
6c0d34fc4f | ||
|
|
3fa9bb0384 | ||
|
|
791115901a | ||
|
|
a879ed6555 | ||
|
|
28b58e7976 | ||
|
|
dc54b25f84 | ||
|
|
fc51a383bf | ||
|
|
a546bc0d59 | ||
|
|
c732e448c3 | ||
|
|
fbc7da0606 |
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -52,7 +52,7 @@ jobs:
|
||||
run: |
|
||||
yarn
|
||||
yarn global add xvfb-maybe
|
||||
yarn global add @vue/cli
|
||||
yarn global add @vue/cli@4.5.15
|
||||
- name: Build feature
|
||||
run: |
|
||||
cd ./feature
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-vue": "^7.0.0",
|
||||
"less": "^4.1.3",
|
||||
"less-loader": "5.0.0",
|
||||
"less-loader": "^6.2.0",
|
||||
"prettier": "^2.2.1",
|
||||
"typescript": "~4.1.5"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rubick",
|
||||
"version": "4.3.4",
|
||||
"version": "4.3.7",
|
||||
"author": "muwoo <2424880409@qq.com>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -36,7 +36,14 @@ class AdapterHandler {
|
||||
fs.mkdirsSync(options.baseDir);
|
||||
fs.writeFileSync(
|
||||
`${options.baseDir}/package.json`,
|
||||
'{"dependencies":{}}'
|
||||
// '{"dependencies":{}}'
|
||||
// fix 插件安装时node版本问题
|
||||
JSON.stringify({
|
||||
dependencies: {},
|
||||
volta: {
|
||||
node: '16.19.1',
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
this.baseDir = options.baseDir;
|
||||
|
||||
@@ -82,7 +82,7 @@ export default () => {
|
||||
};
|
||||
|
||||
const init = (plugin, window: BrowserWindow) => {
|
||||
if (view === null || view === undefined) {
|
||||
if (view === null || view === undefined || view.inDetach) {
|
||||
createView(plugin, window);
|
||||
// if (viewInstance.getView(plugin.name) && !commonConst.dev()) {
|
||||
// view = viewInstance.getView(plugin.name).view;
|
||||
@@ -176,14 +176,29 @@ export default () => {
|
||||
const removeView = (window: BrowserWindow) => {
|
||||
if (!view) return;
|
||||
executeHooks('PluginOut', null);
|
||||
// 先记住这次要移除的视图,防止后面异步代码里全局引用被换掉
|
||||
const snapshotView = view;
|
||||
setTimeout(() => {
|
||||
window.removeBrowserView(view);
|
||||
if (!view.inDetach) {
|
||||
window.setBrowserView(null);
|
||||
view.webContents?.destroy();
|
||||
// 获取当前视图,判断是否已经换成了新视图
|
||||
const currentView = window.getBrowserView?.();
|
||||
window.removeBrowserView(snapshotView);
|
||||
|
||||
// 主窗口的插件视图仍然挂着旧实例时,需要还原主窗口 UI
|
||||
if (!snapshotView.inDetach) {
|
||||
// 如果窗口还挂着旧视图,说明还没换掉,需要把主窗口恢复到初始状态
|
||||
if (currentView === snapshotView) {
|
||||
window.setBrowserView(null);
|
||||
if (view === snapshotView) {
|
||||
window.webContents?.executeJavaScript(`window.initRubick()`);
|
||||
view = undefined;
|
||||
}
|
||||
}
|
||||
snapshotView.webContents?.destroy();
|
||||
}
|
||||
// 分离窗口只需释放全局引用,视图由分离窗口继续管理
|
||||
else if (view === snapshotView) {
|
||||
view = undefined;
|
||||
}
|
||||
window.webContents?.executeJavaScript(`window.initRubick()`);
|
||||
view = undefined;
|
||||
}, 0);
|
||||
};
|
||||
|
||||
|
||||
@@ -110,9 +110,14 @@ const registerHotKey = (mainWindow: BrowserWindow): void => {
|
||||
// mainWindow.show();
|
||||
});
|
||||
|
||||
globalShortcut.register('CommandOrControl+W', () => {
|
||||
if (mainWindow && !mainWindow.isDestroyed() && mainWindow.isFocused()) {
|
||||
mainWindow.hide();
|
||||
// 添加局部快捷键监听
|
||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.key.toLowerCase() === 'w'
|
||||
&& (input.control || input.meta) && !input.alt && !input.shift) {
|
||||
event.preventDefault();
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user