save
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
"uuid": "^9.0.1",
|
||||
"vue": "^3.3.4",
|
||||
"vue-activity-calendar": "^1.2.2",
|
||||
"vue-i18n": "9",
|
||||
"vue-virtual-list-v3": "^1.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
36
pnpm-lock.yaml
generated
36
pnpm-lock.yaml
generated
@@ -62,6 +62,9 @@ dependencies:
|
||||
vue-activity-calendar:
|
||||
specifier: ^1.2.2
|
||||
version: 1.2.2
|
||||
vue-i18n:
|
||||
specifier: '9'
|
||||
version: 9.6.5(vue@3.3.4)
|
||||
vue-virtual-list-v3:
|
||||
specifier: ^1.5.1
|
||||
version: 1.5.1
|
||||
@@ -734,6 +737,27 @@ packages:
|
||||
vue: 3.3.4
|
||||
dev: true
|
||||
|
||||
/@intlify/core-base@9.6.5:
|
||||
resolution: {integrity: sha512-LzbGXiZkMWPIHnHI0g6q554S87Cmh2mmCmjytK/3pDQfjI84l+dgGoeQuKj02q7EbULRuUUgYVZVqAwEUawXGg==}
|
||||
engines: {node: '>= 16'}
|
||||
dependencies:
|
||||
'@intlify/message-compiler': 9.6.5
|
||||
'@intlify/shared': 9.6.5
|
||||
dev: false
|
||||
|
||||
/@intlify/message-compiler@9.6.5:
|
||||
resolution: {integrity: sha512-WeJ499thIj0p7JaIO1V3JaJbqdqfBykS5R8fElFs5hNeotHtPAMBs4IiA+8/KGFkAbjJusgFefCq6ajP7F7+4Q==}
|
||||
engines: {node: '>= 16'}
|
||||
dependencies:
|
||||
'@intlify/shared': 9.6.5
|
||||
source-map-js: 1.0.2
|
||||
dev: false
|
||||
|
||||
/@intlify/shared@9.6.5:
|
||||
resolution: {integrity: sha512-gD7Ey47Xi4h/t6P+S04ymMSoA3wVRxGqjxuIMglwRO8POki9h164Epu2N8wk/GHXM/hR6ZGcsx2HArCCENjqSQ==}
|
||||
engines: {node: '>= 16'}
|
||||
dev: false
|
||||
|
||||
/@jridgewell/gen-mapping@0.3.3:
|
||||
resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
@@ -3121,6 +3145,18 @@ packages:
|
||||
vue: 3.3.4
|
||||
dev: false
|
||||
|
||||
/vue-i18n@9.6.5(vue@3.3.4):
|
||||
resolution: {integrity: sha512-dpUEjKHg7pEsaS7ZPPxp1CflaR7bGmsvZJEhnszHPKl9OTNyno5j/DvMtMSo41kpddq4felLA7GK2prjpnXVlw==}
|
||||
engines: {node: '>= 16'}
|
||||
peerDependencies:
|
||||
vue: ^3.0.0
|
||||
dependencies:
|
||||
'@intlify/core-base': 9.6.5
|
||||
'@intlify/shared': 9.6.5
|
||||
'@vue/devtools-api': 6.5.0
|
||||
vue: 3.3.4
|
||||
dev: false
|
||||
|
||||
/vue-template-compiler@2.7.14:
|
||||
resolution: {integrity: sha512-zyA5Y3ArvVG0NacJDkkzJuPQDF8RFeRlzV2vLeSnhSpieO6LK2OVbdLPi5MPPs09Ii+gMO8nY4S3iKQxBxDmWQ==}
|
||||
dependencies:
|
||||
|
||||
@@ -27,7 +27,7 @@ const settingStore = useSettingStore()
|
||||
|
||||
<template>
|
||||
<div class="options">
|
||||
<Tooltip v-if="showEdit" :title="`编辑(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.Edit]})`">
|
||||
<Tooltip v-if="showEdit" :title="`编辑(快捷键:${settingStore.shortcutKeyMap[ShortcutKey.EditArticle]})`">
|
||||
<IconWrapper>
|
||||
<Icon icon="tabler:edit" class="menu"
|
||||
@click="emit('edit')"/>
|
||||
|
||||
@@ -185,7 +185,7 @@ function play() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
emitter.on(ShortcutKey.Show, show)
|
||||
emitter.on(ShortcutKey.ShowWord, show)
|
||||
emitter.on(ShortcutKey.Skip, skip)
|
||||
emitter.on(ShortcutKey.ToggleCollect, collect)
|
||||
emitter.on(ShortcutKey.ToggleSimple, toggleWordSimpleWrapper)
|
||||
@@ -193,7 +193,7 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
emitter.off(ShortcutKey.Show, show)
|
||||
emitter.off(ShortcutKey.ShowWord, show)
|
||||
emitter.off(ShortcutKey.Skip, skip)
|
||||
emitter.off(ShortcutKey.ToggleCollect, collect)
|
||||
emitter.off(ShortcutKey.ToggleSimple, toggleWordSimpleWrapper)
|
||||
|
||||
@@ -25,7 +25,7 @@ useWatchAllSound()
|
||||
|
||||
let editShortcutKey = $ref('')
|
||||
|
||||
const disabledDefaultKeyboardEvent = $computed(()=>{
|
||||
const disabledDefaultKeyboardEvent = $computed(() => {
|
||||
return editShortcutKey && tabIndex === 2
|
||||
})
|
||||
|
||||
@@ -53,6 +53,11 @@ useEventListener('keydown', (e: KeyboardEvent) => {
|
||||
}
|
||||
})
|
||||
|
||||
function resetShortcutKeyMap() {
|
||||
settingStore.shortcutKeyMap = cloneDeep(DefaultShortcutKeyMap)
|
||||
ElMessage.success('恢复成功')
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -288,7 +293,7 @@ useEventListener('keydown', (e: KeyboardEvent) => {
|
||||
<div class="row">
|
||||
<label class="item-title"></label>
|
||||
<div class="wrapper">
|
||||
<BaseButton @click="settingStore.shortcutKeyMap = cloneDeep(DefaultShortcutKeyMap)">恢复默认</BaseButton>
|
||||
<BaseButton @click="resetShortcutKeyMap">恢复默认</BaseButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -98,11 +98,16 @@ export const useSettingStore = defineStore('setting', {
|
||||
setDefaultConfig()
|
||||
} else {
|
||||
if (obj.version !== SaveConfig.version) {
|
||||
debugger
|
||||
for (const [key, value] of Object.entries(this.shortcutKeyMap)) {
|
||||
if (obj.val.shortcutKeyMap[key]) this.shortcutKeyMap[key] = obj.val.shortcutKeyMap[key]
|
||||
}
|
||||
delete obj.val.shortcutKeyMap
|
||||
|
||||
for (const [key, value] of Object.entries(this.fontSize)) {
|
||||
if (obj.val.fontSize[key]) this.fontSize[key] = obj.val.fontSize[key]
|
||||
}
|
||||
delete obj.val.fontSize
|
||||
|
||||
this.setState(obj.val)
|
||||
} else {
|
||||
this.setState(obj.val)
|
||||
|
||||
25
src/types.ts
25
src/types.ts
@@ -18,14 +18,6 @@ export const DefaultWord: Word = {
|
||||
trans: []
|
||||
}
|
||||
|
||||
export const SaveDict = {
|
||||
key: 'typing-word-dict',
|
||||
version: 1
|
||||
}
|
||||
export const SaveConfig = {
|
||||
key: 'typing-word-config',
|
||||
version: 6
|
||||
}
|
||||
|
||||
export const PronunciationApi = 'https://dict.youdao.com/dictvoice?audio='
|
||||
|
||||
@@ -171,9 +163,18 @@ export const ShortcutKeyMap = {
|
||||
Collect: 'Enter',
|
||||
}
|
||||
|
||||
export const SaveDict = {
|
||||
key: 'typing-word-dict',
|
||||
version: 1
|
||||
}
|
||||
export const SaveConfig = {
|
||||
key: 'typing-word-config',
|
||||
version: 5
|
||||
}
|
||||
|
||||
export enum ShortcutKey {
|
||||
Show = 'Show',
|
||||
Edit = 'Edit',
|
||||
ShowWord = 'ShowWord',
|
||||
EditArticle = 'EditArticle',
|
||||
Skip = 'Skip',
|
||||
ToggleSimple = 'ToggleSimple',
|
||||
ToggleCollect = 'ToggleCollect',
|
||||
@@ -190,8 +191,8 @@ export enum ShortcutKey {
|
||||
}
|
||||
|
||||
export const DefaultShortcutKeyMap = {
|
||||
[ShortcutKey.Edit]: 'Ctrl+E',
|
||||
[ShortcutKey.Show]: 'Escape',
|
||||
[ShortcutKey.EditArticle]: 'Ctrl+E',
|
||||
[ShortcutKey.ShowWord]: 'Escape',
|
||||
[ShortcutKey.Skip]: 'Tab',
|
||||
[ShortcutKey.ToggleSimple]: '`',
|
||||
[ShortcutKey.ToggleCollect]: 'Enter',
|
||||
|
||||
Reference in New Issue
Block a user