feat: 支持文本模板,系统命令

This commit is contained in:
muwoo
2021-06-10 20:54:28 +08:00
parent 31e7e17cc9
commit 31d57fc404
29 changed files with 377 additions and 205 deletions

View File

@@ -2,8 +2,36 @@ const WINDOW_MAX_HEIGHT = 600;
const WINDOW_MIN_HEIGHT = 60;
const PRE_ITEM_HEIGHT = 60;
const SYSTEM_PLUGINS = [
{
"pluginName": "rubick 帮助文档",
"logo": "logo.png",
"features": [
{
"code": "help",
"explain": "rubick 帮助文档",
"cmds": [ "Help", "帮助" ]
},
],
"tag": 'rubick-help',
},
{
"pluginName": "屏幕颜色拾取",
"logo": "logo.png",
"features": [
{
"code": "pick",
"explain": "rubick 帮助文档",
"cmds": [ "取色", "拾色", 'Pick color' ]
},
],
"tag": 'rubick-color',
}
]
export {
WINDOW_MAX_HEIGHT,
WINDOW_MIN_HEIGHT,
PRE_ITEM_HEIGHT,
SYSTEM_PLUGINS,
}

View File

@@ -0,0 +1,13 @@
import {shell, ipcRenderer} from 'electron';
export default {
'rubick-help': {
help() {
shell.openExternal('https://u.tools/docs/guide/about-uTools.html')
}
},
'rubick-color': {
pick() {
ipcRenderer.send('start-picker')
}
}
}

View File

@@ -1,4 +1,4 @@
import {WINDOW_MAX_HEIGHT, WINDOW_MIN_HEIGHT, PRE_ITEM_HEIGHT} from './constans';
import {WINDOW_MAX_HEIGHT, WINDOW_MIN_HEIGHT, PRE_ITEM_HEIGHT, SYSTEM_PLUGINS} from './constans';
import download from 'download-git-repo';
import path from 'path';
import fs from 'fs';
@@ -14,7 +14,6 @@ function getWindowHeight(searchList) {
}
function searchKeyValues(lists, value){
console.log(lists);
return lists.filter(item => item.indexOf(value) >= 0)
}
@@ -90,9 +89,24 @@ const sysFile = {
}
}
function mergePlugins(plugins) {
return [
...plugins,
...SYSTEM_PLUGINS.map(plugin => {
return {
...plugin,
status: true,
sourceFile: '',
type: 'system',
}
}),
]
}
export {
getWindowHeight,
searchKeyValues,
downloadFunc,
sysFile,
mergePlugins,
}