Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pasteResult Action #279

Merged
merged 4 commits into from Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guide/10.0.0.md
Expand Up @@ -345,7 +345,7 @@ export const constantActionTypes = [

### 自定义全局快捷键

对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcut.json`来绑定全局快捷键。
对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcuts.json`来绑定全局快捷键。
::: warning
当快捷键已被其他应用程序占用时,绑定将失败。
:::
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/8.3.0.md
Expand Up @@ -226,7 +226,7 @@ CSS文件的编写可以参考[HTML中文网](https://www.html.cn/book/css/all-p

### 自定义全局快捷键

对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcut.json`来绑定全局快捷键。
对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcuts.json`来绑定全局快捷键。
::: warning
当快捷键已被其他应用程序占用时,绑定将失败。
:::
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/8.4.0.md
Expand Up @@ -232,7 +232,7 @@ CSS文件的编写可以参考[HTML中文网](https://www.html.cn/book/css/all-p

### 自定义全局快捷键

对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcut.json`来绑定全局快捷键。
对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcuts.json`来绑定全局快捷键。
::: warning
当快捷键已被其他应用程序占用时,绑定将失败。
:::
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/9.0.0.md
Expand Up @@ -334,7 +334,7 @@ export const constantActionTypes = [

### 自定义全局快捷键

对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcut.json`来绑定全局快捷键。
对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)的`shortcuts.json`来绑定全局快捷键。
::: warning
当快捷键已被其他应用程序占用时,绑定将失败。
:::
Expand Down
2 changes: 1 addition & 1 deletion docs/userland/shortcut.md
Expand Up @@ -3,7 +3,7 @@ sidebarDepth: 6
---
# 全局快捷键
## 使用方法
对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)下的`shortcut.json`来绑定全局快捷键。
对于大多数[动作](#动作系统),您可以通过修改[配置目录](/guide/questions.html#copytranslator%E7%9A%84%E9%85%8D%E7%BD%AE%E7%9B%AE%E5%BD%95%E5%9C%A8%E5%93%AA%E9%87%8C)下的`shortcuts.json`来绑定全局快捷键。

::: warning
当快捷键已被其他应用程序占用时,绑定将失败。
Expand Down
1 change: 1 addition & 0 deletions src/common/action.ts
Expand Up @@ -220,6 +220,7 @@ class ActionManager {

this.append(normalAction("copySource"));
this.append(normalAction("copyResult"));
this.append(normalAction("pasteResult"));
this.append(normalAction("clear"));
this.append(normalAction("notify"));
this.append(normalAction("retryTranslate"));
Expand Down
1 change: 1 addition & 0 deletions src/common/configuration.ts
Expand Up @@ -236,6 +236,7 @@ function initConfig(
"hideDirect",
"copySource",
"copyResult",
"pasteResult",
"clear",
"retryTranslate",
"autoCopy",
Expand Down
1 change: 1 addition & 0 deletions src/common/locales.ts
Expand Up @@ -95,6 +95,7 @@ export const en = new Map<Identifier, string>([
["translate", "Translate"],
["copySource", "Copy Source"],
["copyResult", "Copy Result"], //复制结果
["pasteResult", "Paste Result"], //粘贴结果
["source", "Source"], // 原文
["result", "Result"], //译文
["sourceLanguage", "Source Language"],
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Expand Up @@ -5,6 +5,7 @@ export const normalActionTypes = [
"translate", //翻译
"copySource", //复制原文
"copyResult", //复制译文
"pasteResult", //粘贴译文
"clear", //清空
"helpAndUpdate",
"exit",
Expand Down
4 changes: 4 additions & 0 deletions src/main/translate-controller.ts
Expand Up @@ -68,6 +68,10 @@ class TranslateController {
case "copyResult":
clipboard.writeText(this.resultString);
break;
case "pasteResult":
this.handle("copyResult","");
simulate.paste();
break;
case "retryTranslate":
this.translate(this.text);
break;
Expand Down