mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-16 23:54:19 +08:00
✨ 插件适配窗口缩放;修复窗口尺寸调整的bug;新增 createBrowserWindow、getCursorScreenPoint、getDisplayNearestPoint、outPlugin API
This commit is contained in:
@@ -25,7 +25,6 @@ export const handleScreenShots = (cb) => {
|
||||
|
||||
export default (mainWindow, cb) => {
|
||||
// 接收到截图后的执行程序
|
||||
mainWindow.hide();
|
||||
clipboard.writeText('');
|
||||
if (platform.macOS()) {
|
||||
handleScreenShots(cb);
|
||||
|
||||
@@ -64,6 +64,7 @@ export default () => {
|
||||
createWin.webContents.executeJavaScript(
|
||||
`document.body.classList.add("dark");window.rubick.theme="dark"`
|
||||
);
|
||||
view.setAutoResize({ width: true, height: true });
|
||||
createWin.setBrowserView(view);
|
||||
createWin.webContents.executeJavaScript(
|
||||
`window.initDetach(${JSON.stringify(pluginInfo)})`
|
||||
|
||||
@@ -3,7 +3,11 @@ import path from 'path';
|
||||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib';
|
||||
// import versonHandler from '../common/versionHandler';
|
||||
import localConfig from '@/main/common/initLocalConfig';
|
||||
import { WINDOW_HEIGHT, WINDOW_MIN_HEIGHT, WINDOW_WIDTH } from '@/common/constans/common';
|
||||
import {
|
||||
WINDOW_HEIGHT,
|
||||
WINDOW_MIN_HEIGHT,
|
||||
WINDOW_WIDTH,
|
||||
} from '@/common/constans/common';
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
require('@electron/remote/main').initialize();
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export default () => {
|
||||
const height = pluginSetting && pluginSetting.height;
|
||||
window.setSize(800, height || 600);
|
||||
view.setBounds({ x: 0, y: 60, width: 800, height: height || 540 });
|
||||
view.setAutoResize({ width: true });
|
||||
view.setAutoResize({ width: true, height: true });
|
||||
executeHooks('PluginEnter', ext);
|
||||
executeHooks('PluginReady', ext);
|
||||
const config = await localConfig.getConfig();
|
||||
@@ -166,7 +166,7 @@ export default () => {
|
||||
const removeView = (window: BrowserWindow) => {
|
||||
if (!view) return;
|
||||
window.removeBrowserView(view);
|
||||
window.setSize(800, 60);
|
||||
// window.setSize(800, 60);
|
||||
executeHooks('PluginOut', null);
|
||||
window.webContents?.executeJavaScript(`window.initRubick()`);
|
||||
view = undefined;
|
||||
|
||||
@@ -76,13 +76,16 @@ getPluginInfo({
|
||||
remote.getGlobal('LOCAL_PLUGINS').addPlugin(res);
|
||||
});
|
||||
|
||||
watch([options, pluginHistory], () => {
|
||||
watch([options, pluginHistory, currentPlugin], () => {
|
||||
currentSelect.value = 0;
|
||||
if (currentPlugin.value.name) return;
|
||||
nextTick(() => {
|
||||
ipcRenderer.sendSync('msg-trigger', {
|
||||
type: 'setExpendHeight',
|
||||
data: getWindowHeight(options.value, pluginHistory.value),
|
||||
data: getWindowHeight(
|
||||
options.value,
|
||||
pluginLoading.value ? [] : pluginHistory.value
|
||||
),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -121,6 +121,7 @@ const createPluginManager = (): any => {
|
||||
const {
|
||||
options,
|
||||
searchFocus,
|
||||
setOptionsRef,
|
||||
clipboardFile,
|
||||
clearClipboardFile,
|
||||
readClipboardContent,
|
||||
@@ -172,6 +173,7 @@ const createPluginManager = (): any => {
|
||||
window.initRubick = () => {
|
||||
state.currentPlugin = {};
|
||||
setSearchValue('');
|
||||
setOptionsRef([]);
|
||||
window.setSubInput({ placeholder: '' });
|
||||
};
|
||||
|
||||
|
||||
@@ -157,6 +157,7 @@ const optionsManager = ({
|
||||
});
|
||||
|
||||
return {
|
||||
setOptionsRef,
|
||||
options: optionsRef,
|
||||
searchFocus,
|
||||
clipboardFile,
|
||||
|
||||
Reference in New Issue
Block a user