Skip to content

Commit

Permalink
Merge pull request #279 from Andy-AO/增加pasteResult动作
Browse files Browse the repository at this point in the history
Add pasteResult Action
  • Loading branch information
elliottzheng committed Oct 7, 2020
2 parents da8a0d2 + eed3a47 commit 008a5df
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/guide/10.0.0.md
Expand Up @@ -352,7 +352,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("toast"));
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 @@ -7,6 +7,7 @@ export const normalActionTypes = [
"selectionQuery", //翻译
"copySource", //复制原文
"copyResult", //复制译文
"pasteResult", //粘贴译文
"clear", //清空
"helpAndUpdate",
"exit",
Expand Down
4 changes: 4 additions & 0 deletions src/main/translate-controller.ts
Expand Up @@ -76,6 +76,10 @@ class TranslateController {
clipboard.writeText(this.resultString);
logger.toast("已复制译文");
break;
case "pasteResult":
this.handle("copyResult","");
simulate.paste();
break;
case "retryTranslate":
this.translate(this.text);
break;
Expand Down

0 comments on commit 008a5df

Please sign in to comment.