mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-19 22:31:26 +08:00
bugfix: #32,#31
This commit is contained in:
parent
0991d0ad64
commit
57504ab1eb
@ -194,6 +194,7 @@ class Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initTouchBar(mainWindow) {
|
initTouchBar(mainWindow) {
|
||||||
|
if (!commonConst.macOS()) return;
|
||||||
const { TouchBarButton, TouchBarGroup, TouchBarPopover } = TouchBar;
|
const { TouchBarButton, TouchBarGroup, TouchBarPopover } = TouchBar;
|
||||||
let items = [];
|
let items = [];
|
||||||
let system = [];
|
let system = [];
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
"
|
"
|
||||||
class="main-input"
|
class="main-input"
|
||||||
@change="(e) => search({ value: e.target.value })"
|
@change="(e) => search({ value: e.target.value })"
|
||||||
|
@keydown.ctrl.86="shouldPaste"
|
||||||
:value="searchValue"
|
:value="searchValue"
|
||||||
:maxLength="selected && selected.key !== 'plugin-container' ? 0 : 1000"
|
:maxLength="selected && selected.key !== 'plugin-container' ? 0 : 1000"
|
||||||
@keydown.down="(e) => changeCurrent(1)"
|
@keydown.down="(e) => changeCurrent(1)"
|
||||||
@ -113,7 +114,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapActions, mapMutations, mapState } from "vuex";
|
import { mapActions, mapMutations, mapState } from "vuex";
|
||||||
import { ipcRenderer, remote } from "electron";
|
import { ipcRenderer, remote, clipboard } from "electron";
|
||||||
import {
|
import {
|
||||||
getWindowHeight,
|
getWindowHeight,
|
||||||
debounce,
|
debounce,
|
||||||
@ -208,6 +209,18 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapActions("main", ["onSearch", "showMainUI", "openPlugin"]),
|
...mapActions("main", ["onSearch", "showMainUI", "openPlugin"]),
|
||||||
...mapMutations("main", ["commonUpdate"]),
|
...mapMutations("main", ["commonUpdate"]),
|
||||||
|
shouldPaste(e) {
|
||||||
|
let filePath = '';
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
const rawFilePath = clipboard.read('FileNameW');
|
||||||
|
filePath = rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), ''); } else {
|
||||||
|
if (filePath.indexOf('plugin.json') >= 0) {
|
||||||
|
this.search({
|
||||||
|
filePath,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
search(v) {
|
search(v) {
|
||||||
if (!this.searchFn) {
|
if (!this.searchFn) {
|
||||||
this.searchFn = debounce(this.onSearch, 200);
|
this.searchFn = debounce(this.onSearch, 200);
|
||||||
|
@ -107,10 +107,10 @@ const actions = {
|
|||||||
commit('commonUpdate', { searchValue: value });
|
commit('commonUpdate', { searchValue: value });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const fileUrl = clipboard.read('public.file-url').replace('file://', '');
|
const fileUrl = paylpad.filePath || clipboard.read('public.file-url').replace('file://', '');
|
||||||
commit('commonUpdate', { searchValue: value });
|
commit('commonUpdate', { searchValue: value });
|
||||||
// 复制文件
|
// 复制文件
|
||||||
if (fileUrl && value === 'plugin.json') {
|
if (paylpad.filePath || (fileUrl && value === 'plugin.json')) {
|
||||||
const config = JSON.parse(fs.readFileSync(fileUrl, 'utf-8'));
|
const config = JSON.parse(fs.readFileSync(fileUrl, 'utf-8'));
|
||||||
|
|
||||||
const pluginConfig = {
|
const pluginConfig = {
|
||||||
@ -132,7 +132,6 @@ const actions = {
|
|||||||
name: 'plugin.json'
|
name: 'plugin.json'
|
||||||
},
|
},
|
||||||
searchValue: '',
|
searchValue: '',
|
||||||
devPlugins: [pluginConfig, ...state.devPlugins],
|
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
name: '新建rubick开发插件',
|
name: '新建rubick开发插件',
|
||||||
@ -142,6 +141,7 @@ const actions = {
|
|||||||
click: (router) => {
|
click: (router) => {
|
||||||
commit('commonUpdate', {
|
commit('commonUpdate', {
|
||||||
showMain: true,
|
showMain: true,
|
||||||
|
devPlugins: [pluginConfig, ...state.devPlugins],
|
||||||
selected: {
|
selected: {
|
||||||
key: 'plugin',
|
key: 'plugin',
|
||||||
name: '新建rubick开发插件'
|
name: '新建rubick开发插件'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user