feat: souport windows

This commit is contained in:
muwoo 2021-12-21 18:03:58 +08:00
parent 571ff12730
commit 3ba4be2e4a
6 changed files with 23 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "rubick", "name": "rubick",
"version": "2.0.1-beta.4", "version": "2.0.1-beta.5",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -17,6 +17,8 @@ export default function getCopyFiles(): Array<any> | null {
return null; return null;
} }
} else if (commonConst.windows()) { } else if (commonConst.windows()) {
const filePath = clipboard.readBuffer('FileNameW').toString('ucs2').replace(RegExp(String.fromCharCode(0), 'g'), '');
fileInfo = [filePath];
// todo // todo
} else { } else {
if (!commonConst.linux()) return null; if (!commonConst.linux()) return null;

View File

@ -3,6 +3,10 @@ import path from "path";
import commonConst from "../../common/utils/commonConst"; import commonConst from "../../common/utils/commonConst";
import { PLUGIN_INSTALL_DIR as baseDir } from "@/common/constans/main"; import { PLUGIN_INSTALL_DIR as baseDir } from "@/common/constans/main";
const getRelativePath = (indexPath) => {
return commonConst.windows() ? indexPath.replace("file://", "") : indexPath.replace("file:", "");
}
const getPreloadPath = (plugin, pluginIndexPath) => { const getPreloadPath = (plugin, pluginIndexPath) => {
const { name, preload, tplPath, indexPath } = plugin; const { name, preload, tplPath, indexPath } = plugin;
if (!preload) return; if (!preload) return;

View File

@ -31,6 +31,7 @@ const API: any = {
currentPlugin: API.currentPlugin, currentPlugin: API.currentPlugin,
})})` })})`
); );
window.show();
}, },
removePlugin(e, window) { removePlugin(e, window) {
API.currentPlugin = null; API.currentPlugin = null;

View File

@ -1,5 +1,6 @@
<template> <template>
<div id="components-layout"> <div v-if="commonConst.windows()" class="drag-bar"></div>
<div :class="!commonConst.windows() && 'drag'" id="components-layout">
<div class="rubick-select"> <div class="rubick-select">
<Search <Search
:currentPlugin="currentPlugin" :currentPlugin="currentPlugin"
@ -33,6 +34,7 @@ import Result from "./components/result.vue";
import Search from "./components/search.vue"; import Search from "./components/search.vue";
import getWindowHeight from "../common/utils/getWindowHeight"; import getWindowHeight from "../common/utils/getWindowHeight";
import createPluginManager from "./plugins-manager"; import createPluginManager from "./plugins-manager";
import commonConst from "@/common/utils/commonConst";
const { const {
initPlugins, initPlugins,
@ -100,12 +102,23 @@ const choosePlugin = () => {
</script> </script>
<style lang="less"> <style lang="less">
.drag-bar {
-webkit-app-region: drag;
width: 100%;
height: 20px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
}
#components-layout { #components-layout {
height: 100vh; height: 100vh;
overflow: hidden; overflow: hidden;
-webkit-app-region: drag;
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 0; width: 0;
} }
} }
.drag {
-webkit-app-region: drag;
}
</style> </style>