Add shortcuts and update translations
This commit is contained in:
2
Note.md
2
Note.md
@@ -1,3 +1,5 @@
|
||||
多语言地址:https://www.yuque.com/zhangyurang/ghwvmn/idhcg59wc2204o5n#Ah4t
|
||||
|
||||
例句:On Jan. 20, former Sen. Barack Obama became the 44th President of the U.S. Millions attended the Inauguration.
|
||||
sentence-tokenizer
|
||||
可以正常断句,但无法识别例句
|
||||
|
||||
@@ -61,7 +61,7 @@ const settingStore = useSettingStore()
|
||||
icon="ph:star-fill"/>
|
||||
|
||||
<Tooltip
|
||||
:title="`跳过(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.Skip]})`"
|
||||
:title="`跳过(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.Next]})`"
|
||||
>
|
||||
<IconWrapper>
|
||||
<Icon icon="icon-park-outline:go-ahead" class="menu"
|
||||
|
||||
@@ -77,6 +77,16 @@ function next() {
|
||||
repeat()
|
||||
}
|
||||
|
||||
function prev() {
|
||||
// console.log('next')
|
||||
if (store.currentDict.chapterIndex === 0) {
|
||||
ElMessage.warning('已经在第一章了~')
|
||||
} else {
|
||||
store.currentDict.chapterIndex--
|
||||
repeat()
|
||||
}
|
||||
}
|
||||
|
||||
function toggleShowTranslate() {
|
||||
settingStore.translate = !settingStore.translate
|
||||
}
|
||||
@@ -93,7 +103,7 @@ function openDictDetail() {
|
||||
runtimeStore.showDictModal = true
|
||||
}
|
||||
|
||||
function toggleConciseMode(){
|
||||
function toggleConciseMode() {
|
||||
settingStore.showToolbar = !settingStore.showToolbar
|
||||
settingStore.showPanel = !settingStore.showPanel
|
||||
}
|
||||
@@ -104,6 +114,7 @@ onMounted(() => {
|
||||
emitter.on(EventKey.repeat, repeat)
|
||||
|
||||
emitter.on(ShortcutKey.NextChapter, next)
|
||||
emitter.on(ShortcutKey.PreviousChapter, prev)
|
||||
emitter.on(ShortcutKey.RepeatChapter, repeat)
|
||||
emitter.on(ShortcutKey.DictationChapter, write)
|
||||
emitter.on(ShortcutKey.ToggleShowTranslate, toggleShowTranslate)
|
||||
@@ -121,6 +132,7 @@ onUnmounted(() => {
|
||||
emitter.off(EventKey.repeat, repeat)
|
||||
|
||||
emitter.off(ShortcutKey.NextChapter, next)
|
||||
emitter.off(ShortcutKey.PreviousChapter, prev)
|
||||
emitter.off(ShortcutKey.RepeatChapter, repeat)
|
||||
emitter.off(ShortcutKey.DictationChapter, write)
|
||||
emitter.off(ShortcutKey.ToggleShowTranslate, toggleShowTranslate)
|
||||
|
||||
@@ -145,10 +145,6 @@ function next(isTyping: boolean = true) {
|
||||
}
|
||||
}
|
||||
|
||||
function prev() {
|
||||
data.index--
|
||||
}
|
||||
|
||||
function onKeyUp(e: KeyboardEvent) {
|
||||
typingRef.hideWord()
|
||||
}
|
||||
@@ -174,6 +170,11 @@ async function onKeyDown(e: KeyboardEvent) {
|
||||
|
||||
useOnKeyboardEventListener(onKeyDown, onKeyUp)
|
||||
|
||||
//TODO 略过忽略的单词上
|
||||
function prev() {
|
||||
data.index--
|
||||
}
|
||||
|
||||
function skip(e: KeyboardEvent) {
|
||||
next(false)
|
||||
// e.preventDefault()
|
||||
@@ -203,7 +204,8 @@ function play() {
|
||||
|
||||
onMounted(() => {
|
||||
emitter.on(ShortcutKey.ShowWord, show)
|
||||
emitter.on(ShortcutKey.Skip, skip)
|
||||
emitter.on(ShortcutKey.Previous, prev)
|
||||
emitter.on(ShortcutKey.Next, skip)
|
||||
emitter.on(ShortcutKey.ToggleCollect, collect)
|
||||
emitter.on(ShortcutKey.ToggleSimple, toggleWordSimpleWrapper)
|
||||
emitter.on(ShortcutKey.PlayWordPronunciation, play)
|
||||
@@ -211,7 +213,8 @@ onMounted(() => {
|
||||
|
||||
onUnmounted(() => {
|
||||
emitter.off(ShortcutKey.ShowWord, show)
|
||||
emitter.off(ShortcutKey.Skip, skip)
|
||||
emitter.off(ShortcutKey.Previous, prev)
|
||||
emitter.off(ShortcutKey.Next, skip)
|
||||
emitter.off(ShortcutKey.ToggleCollect, collect)
|
||||
emitter.off(ShortcutKey.ToggleSimple, toggleWordSimpleWrapper)
|
||||
emitter.off(ShortcutKey.PlayWordPronunciation, play)
|
||||
@@ -232,7 +235,7 @@ onUnmounted(() => {
|
||||
@click="next(false)"
|
||||
v-if="nextWord">
|
||||
<Tooltip
|
||||
:title="`下一个(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.Skip]})`"
|
||||
:title="`下一个(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.Next]})`"
|
||||
>
|
||||
<div class="word" :class="settingStore.dictation && 'text-shadow'">{{ nextWord.name }}</div>
|
||||
</Tooltip>
|
||||
|
||||
@@ -31,9 +31,25 @@
|
||||
"de": "",
|
||||
"fr": ""
|
||||
},
|
||||
"Skip": {
|
||||
"Next": {
|
||||
"en": "",
|
||||
"zh": "跳过",
|
||||
"zh": "下一个",
|
||||
"id": "",
|
||||
"tw": "",
|
||||
"th": "",
|
||||
"ru": "",
|
||||
"vi": "",
|
||||
"es": "",
|
||||
"pt": "",
|
||||
"ja": "",
|
||||
"uk": "",
|
||||
"ko": "",
|
||||
"de": "",
|
||||
"fr": ""
|
||||
},
|
||||
"Previous": {
|
||||
"en": "",
|
||||
"zh": "上一个",
|
||||
"id": "",
|
||||
"tw": "",
|
||||
"th": "",
|
||||
@@ -95,6 +111,22 @@
|
||||
"de": "",
|
||||
"fr": ""
|
||||
},
|
||||
"PreviousChapter": {
|
||||
"en": "",
|
||||
"zh": "上一章",
|
||||
"id": "",
|
||||
"tw": "",
|
||||
"th": "",
|
||||
"ru": "",
|
||||
"vi": "",
|
||||
"es": "",
|
||||
"pt": "",
|
||||
"ja": "",
|
||||
"uk": "",
|
||||
"ko": "",
|
||||
"de": "",
|
||||
"fr": ""
|
||||
},
|
||||
"RepeatChapter": {
|
||||
"en": "",
|
||||
"zh": "重复本章",
|
||||
@@ -127,7 +159,7 @@
|
||||
"de": "",
|
||||
"fr": ""
|
||||
},
|
||||
"PlaySound": {
|
||||
"PlayWordPronunciation": {
|
||||
"en": "",
|
||||
"zh": "播放发音",
|
||||
"id": "",
|
||||
|
||||
Binary file not shown.
10
src/types.ts
10
src/types.ts
@@ -171,16 +171,18 @@ export const SaveDict = {
|
||||
}
|
||||
export const SaveConfig = {
|
||||
key: 'typing-word-config',
|
||||
version: 6
|
||||
version: 7
|
||||
}
|
||||
|
||||
export enum ShortcutKey {
|
||||
ShowWord = 'ShowWord',
|
||||
EditArticle = 'EditArticle',
|
||||
Skip = 'Skip',
|
||||
Next = 'Next',
|
||||
Previous = 'Previous',
|
||||
ToggleSimple = 'ToggleSimple',
|
||||
ToggleCollect = 'ToggleCollect',
|
||||
NextChapter = 'NextChapter',
|
||||
PreviousChapter = 'PreviousChapter',
|
||||
RepeatChapter = 'RepeatChapter',
|
||||
DictationChapter = 'DictationChapter',
|
||||
PlayWordPronunciation = 'PlayWordPronunciation',
|
||||
@@ -196,9 +198,11 @@ export enum ShortcutKey {
|
||||
export const DefaultShortcutKeyMap = {
|
||||
[ShortcutKey.EditArticle]: 'Ctrl+E',
|
||||
[ShortcutKey.ShowWord]: 'Escape',
|
||||
[ShortcutKey.Skip]: 'Tab',
|
||||
[ShortcutKey.Previous]: 'Alt+⬅',
|
||||
[ShortcutKey.Next]: 'Tab',
|
||||
[ShortcutKey.ToggleSimple]: '`',
|
||||
[ShortcutKey.ToggleCollect]: 'Enter',
|
||||
[ShortcutKey.PreviousChapter]: 'Ctrl+⬅',
|
||||
[ShortcutKey.NextChapter]: 'Ctrl+➡',
|
||||
[ShortcutKey.RepeatChapter]: 'Ctrl+Enter',
|
||||
[ShortcutKey.DictationChapter]: 'Alt+Enter',
|
||||
|
||||
Reference in New Issue
Block a user