From 6e2407e6cf8304c8aa366286150ff9bffbe8fade Mon Sep 17 00:00:00 2001 From: hotleave Date: Thu, 11 Mar 2021 11:22:08 +0800 Subject: [PATCH] Open source --- src/components/Racing.vue | 12 ++++++++---- src/docs/help.md | 15 +++++++++++++++ src/views/Home.vue | 5 ++--- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/components/Racing.vue b/src/components/Racing.vue index 9ac4b72..cf3d411 100644 --- a/src/components/Racing.vue +++ b/src/components/Racing.vue @@ -47,11 +47,15 @@ export default class Racing extends Vue { case 'typing': setTimeout(this.focus, 50) break - case 'finished': - document.addEventListener('copy', this.copy, true) - document.execCommand('copy') - this.$notify({ title: '成功', message: this.result, type: 'success', duration: 10000, showClose: true }) + case 'finished': { + const result = this.result + navigator.clipboard.writeText(result).then(() => result, () => { + document.addEventListener('copy', this.copy, true) + document.execCommand('copy') + }) + this.$notify({ title: '成功', message: result, type: 'success', duration: 10000, showClose: true }) break + } } } diff --git a/src/docs/help.md b/src/docs/help.md index 7d1cab1..a688a38 100644 --- a/src/docs/help.md +++ b/src/docs/help.md @@ -8,6 +8,12 @@ QuickTyping,中式英语,直译快打,快来打,打得快,越来越快 - [玫枫跟打器](https://kylebing.cn/tools/typepad/) - [三码郑码](https://www.yuque.com/smzm/zhengma/el4l0a) +## Contributing + +- 有问题,提个[Issue](https://gitee.com/hotleave/quick-typing/issues) +- 有想法,提个[Issue](https://gitee.com/hotleave/quick-typing/issues) +- 有能力,提个[PR](https://gitee.com/hotleave/quick-typing/pulls) + ## 声明 1. 本程序系私人用途,非商业产品,即不提供相应的服务 @@ -26,6 +32,15 @@ QuickTyping,中式英语,直译快打,快来打,打得快,越来越快 - [ ] 词库练习 - [ ] 看打模式 +## 浏览器要求 + +> 在`Chrome`及`Safari`最新版本下测试通过,`Edge`未经过测试 +> **不支持`IE`** + +- 支持[IndexedDB](https://caniuse.com/indexeddb) +- 支持[clipboard.writeText](https://caniuse.com/mdn-api_clipboard_writetext) +- 支持[clipboard.readText](https://caniuse.com/mdn-api_clipboard_readtext) + ## 快速上手 - 复制要打的文字 diff --git a/src/views/Home.vue b/src/views/Home.vue index 6125169..1797055 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -99,10 +99,9 @@ export default class Home extends Vue { } } - async loadFromClipboard () { + loadFromClipboard () { try { - const text = await navigator.clipboard.readText() - this.loadArticle(text) + navigator.clipboard.readText().then(text => { this.loadArticle(text) }) } catch (err) { console.error('Failed to read clipboard contents: ', err) }