Skip to content

Commit

Permalink
bump electron to 6.0.0, update docs, refactor rule
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottzheng committed Oct 15, 2019
1 parent fb77e49 commit 28715aa
Show file tree
Hide file tree
Showing 34 changed files with 12,641 additions and 447 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Expand Up @@ -3,13 +3,13 @@ module.exports = {
env: {
node: true
},
extends: ["plugin:vue/essential","@vue/prettier",'@vue/typescript'],
extends: ["plugin:vue/essential", "@vue/prettier", "@vue/typescript"],
rules: {
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
"no-multiple-empty-lines":1
"no-multiple-empty-lines": 1
},
parserOptions: {
parser: 'typescript-eslint-parser'
parser: "typescript-eslint-parser"
}
};
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -30,5 +30,4 @@ src/*/*.js
src/*.js
dist
/package-lock.json
/yarn.lock
theme
5 changes: 2 additions & 3 deletions .vscode/settings.json
Expand Up @@ -2,7 +2,7 @@
"explorer.confirmDelete": false,
"git.autofetch": true,
"terminal.integrated.rendererType": "dom",
"window.zoomLevel": 1,
"window.zoomLevel": 0,
"eslint.alwaysShowStatus": true,
"eslint.autoFixOnSave": true,
"eslint.validate": [
Expand All @@ -18,6 +18,5 @@
}
],
"typescript.updateImportsOnFileMove.enabled": "always",
"editor.fontFamily": "Monaco",
"python.pythonPath": "e:\\software\\Anaconda3\\python.exe"
"editor.fontFamily": "Monaco"
}
19 changes: 5 additions & 14 deletions docs/.vuepress/config.js
Expand Up @@ -9,16 +9,6 @@ module.exports = {
],
// base: '/docs/',
plugins: {
'@vssue/vuepress-plugin-vssue': {
// 设置 `platform` 而不是 `api`
platform: 'github',

// 其他的 Vssue 配置
owner: 'CopyTranslator',
repo: 'comments',
clientId: '28524bb606982ce73bf0',
clientSecret: '8bcd70bf3339fb0c0a946738e0327ca53ae3bb37'
},
},
themeConfig: {
// 假如你的文档仓库和项目本身不在一个仓库:
Expand Down Expand Up @@ -46,7 +36,7 @@ module.exports = {
},
{
text: '更新日志',
link: '/changelogs/'
link: '/changelogs/v9'
},
{
text: '用户生态',
Expand Down Expand Up @@ -89,9 +79,10 @@ module.exports = {
title: "更新日志",
collapsable: false,
children: [
'0.0.8',
'0.0.7',
'0.0.6'
'v9',
'v8',
'v7',
'v6'
]
}],
'/support/': [{
Expand Down
2 changes: 1 addition & 1 deletion docs/about/README.md
Expand Up @@ -16,7 +16,7 @@
3. 翻译结果框出现的位置和大小,时间不固定,有时候会遮挡到原文或者其他的地方,给翻译校对带来不便,此外点选别的地方可能会导致结果框的消失。
4. 此类软件常有广告弹窗

那么复译是如何解决这些问题呢
那么CopyTranslator是如何解决这些问题呢

1. 当勾选`listen clipboard`后,**复译会自动翻译剪贴板的内容,并显示译文在结果框中。**

Expand Down
16 changes: 10 additions & 6 deletions docs/about/acknowledge.md
Expand Up @@ -10,22 +10,26 @@
- Mac 维护者 [黎紫珊](https://github.com/Sandural)

## 开源库
所基于的开源库太多,难以罗列,在这里仅列出主要的几项:
所基于的开源库太多,难以罗列,在这里仅列出主要的几项,同时也感谢其他默默无闻为开源事业做出贡献的人们
- [Electron](https://electronjs.org):使用 JavaScript, HTML 和 CSS 构建跨平台的桌面应用
- [Vue](http://vuejs.org):渐进式 JavaScript 框架
- [Element](http://element-cn.eleme.io/#/zh-CN): 一套为开发者、设计师和产品经理准备的基于 Vue 2.0 的桌面端组件库
- [translation.js](https://github.com/Selection-Translator/translation.js): 核心翻译引擎
- [OpenTranslate](https://github.com/OpenTranslate/OpenTranslate): 开源翻译标准库(OpenTranslate诚意之作)
- [iohook](https://github.com/wilix-team/iohook): 捕获全局鼠标和键盘事件
- [robotjs](http://robotjs.io/): 模拟键盘输入
- [Saladict](https://github.com/crimx/ext-saladict) 沙拉查词-聚合词典划词翻译--Sogou Engine
- [eazydict](https://github.com/keenwon/eazydict) 简单易用的命令行词典
- [dadda-translate-crx](https://github.com/waynecz/dadda-translate-crx) 比较好看的 Chrome 划词翻译(搜狗)插件,自带生词簿及吐司单词记忆,可与有道、扇贝单词同步
- [iciba-translate-userscript](https://github.com/Firefox-Pro-Coding/iciba-translate-userscript) iciba划词翻译 userscript

## 界面语言维护

- 繁体中文: [Jeff Huang](https://github.com/s8321414)


## 友情软件
CopyTranslator从这些软件中学到了很多,以下均为非常优秀的软件,推荐大家尝试。
- [沙拉查词](https://github.com/crimx/ext-saladict):沙拉查词-聚合词典划词翻译
- [划词翻译](https://github.com/Selection-Translator/crx-selection-translate):让浏览任意语言的网站变得无比轻松的浏览器扩展程序。
- [达达查词](https://github.com/waynecz/dadda-translate-crx):比较好看的 Chrome 划词翻译(搜狗)插件,自带生词簿及吐司单词记忆,可与有道、扇贝单词同步
- [iciba-translate-userscript](https://github.com/Firefox-Pro-Coding/iciba-translate-userscript):iciba划词翻译 userscript

## 推广

感谢亲爱的朋友们,用户们的推荐和肯定
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/changelogs/0.0.7.md → docs/changelogs/v7.md
@@ -1,4 +1,4 @@
# v0.0.7 Kylin
# v7 Kylin

## v0.0.7 Kylin RC0

Expand Down
7 changes: 0 additions & 7 deletions docs/changelogs/0.0.8.md → docs/changelogs/v8.md
@@ -1,11 +1,4 @@
# v8 Zouwu
## v8.5.0 尚未发布
1. 修复mac 设置界面标题栏错位问题
2. 修复mac 无法使用快捷键复制黏贴的问题
3. 通过引擎按钮快速切换翻译结果
4. 修复 #153
5. 添加 tooltip,但是尚未完善 #126
6. 在全局快捷键之外添加了一些本地快捷键,如ctrl+s 快速复制译文

## v8.4.0
1. 拆出设置页面和更新页面
Expand Down
22 changes: 22 additions & 0 deletions docs/changelogs/v9.md
@@ -0,0 +1,22 @@
# v9 模仿猫

## v9.0.0 尚未发布
增强:
1. 删除点按复制功能,增加拖拽复制功能,它将改变你的操作习惯。详见使用指南。
2. 全异步化remote操作使整体性能得到明显提升,页面加载速度前所未有的快
3. 翻译核心库换为 [OpenTranslate](https://github.com/OpenTranslate/OpenTranslate),开源翻译标准库
4. 在全局快捷键之外添加了一些本地快捷键,如ctrl+s 快速复制译文
5. 按需打包Element UI,安装包体积减小,加载速度加快
7. 增加引擎按钮以快速切换翻译引擎和显示当前引擎
8. 添加 tooltip,尚未完善 #126

修复:
1. 修复mac 设置界面标题栏错位问题
2. 修复mac 无法使用快捷键复制黏贴的问题
3. 修复 #153 右键翻译器/隐藏方向时报错
4. 修复不同窗口的样式不一致性
6. 修复 #156 对照模式下开启增量复制后,点击翻译会重复当前内容




2 changes: 1 addition & 1 deletion docs/download/README.md
Expand Up @@ -20,7 +20,7 @@ sidebarDepth: 6
- [蓝奏云](https://www.lanzous.com/b389682)

### Windows
安装即用
下载exe文件,安装即用

### Mac
下载dmg文件
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/questions.md
Expand Up @@ -23,7 +23,7 @@

## 点按复制无效

答:0.0.8以后点按复制默认是关闭的,请确保您已经打开选项。他只是模拟ctrl+c而已,至于能不能复制到不知道了。**不是点一下,是按0.3s,你得先选中,然后移动到选中文字上方,按0.3s放开**(必须要放开哦,不是按越久越好)。我觉得挺好用的其实,如果ctrl+c的话,其实鼠标键盘切换很累的,这个就直接鼠标就可以,而且还不用右键菜单费神找复制选项。这是不知道划译怎么做的凑合方案。你按太久也没啥意义,**我检测的是你的鼠标释放的瞬间,跟你按下的时间间隔,以及鼠标的偏移量不太大就会模拟一次ctrl+c**。**我知道abobe的阅读器就不能用,有些阅读器刚按一下,没放开就取消选中了,那我这个模拟ctrl+c肯定没办法的**。我知道能使用的阅读器有这么一个:文电通PDF阅读器。 另外,有一大堆广告的恶心人的foxit也不建议使用,谁用谁知道,任务栏莫名其妙的广告,闪来闪去。
答:8.0.0 以后点按复制默认是关闭的,请确保您已经打开选项。他只是模拟ctrl+c而已,至于能不能复制到不知道了。**不是点一下,是按0.3s,你得先选中,然后移动到选中文字上方,按0.3s放开**(必须要放开哦,不是按越久越好)。我觉得挺好用的其实,如果ctrl+c的话,其实鼠标键盘切换很累的,这个就直接鼠标就可以,而且还不用右键菜单费神找复制选项。这是不知道划译怎么做的凑合方案。你按太久也没啥意义,**我检测的是你的鼠标释放的瞬间,跟你按下的时间间隔,以及鼠标的偏移量不太大就会模拟一次ctrl+c**。**我知道abobe的阅读器就不能用,有些阅读器刚按一下,没放开就取消选中了,那我这个模拟ctrl+c肯定没办法的**。我知道能使用的阅读器有这么一个:文电通PDF阅读器。 另外,有一大堆广告的恶心人的foxit也不建议使用,谁用谁知道,任务栏莫名其妙的广告,闪来闪去。

## CopyTranslator的配置目录在哪里
答:配置目录为用户目录下的copytranslator文件夹,用户目录在不同系统中的位置不同:
Expand Down
45 changes: 13 additions & 32 deletions docs/support/contributing.md
Expand Up @@ -15,13 +15,16 @@ sidebarDepth: 6
- components: vue components

## Build from source
For windows users, you need to `npm install windows-build-tools --global` first.
For windows users, you need to `yarn global add windows-build-tools` first.
```bash
yarn global add element-theme
```
```bash
git clone --recursive https://github.com/copytranslator/CopyTranslator.git
cd CopyTranslator
npm install
npm run rebuild
npm run electron:build
yarn
yarn rebuild
yarn electron:build
```


Expand All @@ -34,34 +37,6 @@ If you want to add a new locale, follow the instructions below.
Welcome to join the `gitter` chat room at [here](https://gitter.im/CopyTranslator/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link), so you can get notified before new version release. You can create a pull request at any time as **the out of date locale file won't cause any error**, the program will go back to English for the missing words.

## Components
### BrowserWindow Control System
In main process
```ts
import { windowController } from "../tools/windowController";
windowController.bind();
```
In render process

```vue
<template>
<div v-on:dblclick="minify" v-on:mousedown="bindDrag" ></div>
</template>
<script>
import WindowController from "./WindowController";
export default {
mixins: [WindowController]
};
</script>
```



### Context menu system
For both focus mode, contrast mode, and tray, we generate menu online. They share the same `BaseMenu` object, but the content of the menu can be different according to the context.


### Notification
In `vue.config.js`
```js
Expand All @@ -75,6 +50,12 @@ app.setAppUserModelId("com.copytranslator.copytranslator");
```
In windows, you need to first install the application once for further develop,otherwise the app have not right to create notification.

## Documentation Development
```bash
yarn global add vuepress
yarn docs:dev
```

## Publish Documentation
Make sure you are Elliott Zheng
```bash
Expand Down
22 changes: 10 additions & 12 deletions package.json
Expand Up @@ -19,7 +19,7 @@
"electron:build": "npm run prebuild && vue-cli-service electron:build && npm run postbuild",
"electron:serve": "npm run prebuild && vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"rebuild": "npm rebuild --runtime=electron --target=3.0.0 --disturl=https://atom.io/download/atom-shell --abi=64",
"rebuild": "npm rebuild --runtime=electron --target=6.0.0 --disturl=https://atom.io/download/atom-shell --abi=73",
"prebuild": "et && tsc ./src/prebuild.ts --downlevelIteration && node ./src/prebuild.js && npm run clean",
"postbuild": "node postbuild.js",
"ts:test": "tsc ./src/test.ts && node ./src/test.js && npm run clean",
Expand All @@ -46,9 +46,8 @@
"eazydict-youdao": "^2.1.0",
"electron-clipboard-extended": "^1.1.1",
"electron-updater": "^4.0.6",
"element-ui": "^2.12.0",
"http": "0.0.0",
"iohook": "^0.5.1",
"element-ui": "2.12.0",
"iohook": "0.6.1",
"lodash.compact": "^3.0.1",
"lodash.invert": "^4.3.0",
"lodash.keyby": "^4.6.0",
Expand All @@ -58,11 +57,11 @@
"sbd": "^1.0.15",
"shortcut-capture": "^1.2.1",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vue-router": "3.0.7",
"vuedraggable": "^2.23.0",
"vuex": "^3.1.1"
},
"devDependencies": {
"devDependencies": {
"@types/jest": "^23.3.14",
"@types/lodash.compact": "^3.0.6",
"@types/lodash.invert": "^4.3.6",
Expand All @@ -81,7 +80,7 @@
"babel-eslint": "^10.0.1",
"babel-plugin-component": "^1.1.1",
"babel-plugin-lodash": "^3.3.4",
"electron": "^3.0.0",
"electron": "^6.0.0",
"element-theme-chalk": "^2.11.1",
"eslint": "^5.8.0",
"eslint-plugin-typescript": "^0.14.0",
Expand All @@ -94,7 +93,7 @@
"typescript": "^3.6.3",
"typescript-eslint-parser": "^22.0.0",
"valine": "^1.3.4",
"vue-cli-plugin-electron-builder": "^1.1.3",
"vue-cli-plugin-electron-builder": "^1.4.0",
"vue-template-compiler": "^2.5.21",
"yaml": "^1.5.0"
},
Expand All @@ -105,15 +104,14 @@
"iohook": {
"targets": [
"node-64",
"electron-64"
"electron-73"
],
"platforms": [
"win32",
"darwin"
"win32"
],
"arches": [
"x64"
]
},
"main": "background.js"
}
}
4 changes: 3 additions & 1 deletion src/background.ts
Expand Up @@ -12,7 +12,9 @@ let controller = new Controller();
(<any>global).controller = controller;

// Standard scheme must be registered before the app is ready
protocol.registerStandardSchemes(["app"], { secure: true });
protocol.registerSchemesAsPrivileged([
{ scheme: "app", privileges: { standard: true, secure: true } }
]);

// Quit when all windows are closed.
app.on("window-all-closed", () => {
Expand Down
15 changes: 7 additions & 8 deletions src/core/actionCallback.ts
Expand Up @@ -58,7 +58,7 @@ function handleNormalAction(identifier: string) {
controller.onExit();
break;
case "capture":
controller.capture();
(<any>global).shortcutCapture.shortcutCapture();
break;
case "clear":
controller.clear();
Expand All @@ -73,17 +73,17 @@ function handleNormalAction(identifier: string) {
showSettings();
break;
case "helpAndUpdate":
dialog.showMessageBox(
<BrowserWindow>controller.win.window,
{
dialog
.showMessageBox(<BrowserWindow>controller.win.window, {
title: constants.appName + " " + version,
message:
"If you found it useful, please give me a star on GitHub or introduce to your friend.\n如果您感觉本软件对您有所帮助,请在项目Github上给个star或是介绍给您的朋友,谢谢。\n本软件免费开源,如果您是以付费的方式获得本软件,那么你应该是被骗了。[○・`Д´・ ○]",
buttons: [t("homepage"), t("userManual"), t("checkUpdate"), "cancel"],
cancelId: 3,
icon: nativeImage.createFromPath(env.iconPath)
},
function(response, checkboxChecked) {
})
.then(res => res.response)
.then(response => {
switch (response) {
case 0:
shell.openExternal(constants.homepage);
Expand All @@ -95,8 +95,7 @@ function handleNormalAction(identifier: string) {
checkForUpdates();
break;
}
}
);
});
break;
case "retryTranslate":
controller.doTranslate(controller.src);
Expand Down

0 comments on commit 28715aa

Please sign in to comment.