From ac180def951eb5ee8ddddab24e496fd16ae91cbd Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Thu, 20 Apr 2023 00:37:41 +0900
Subject: [PATCH] Don't show shortcut help modal during typing on textbox
---
src/main/index.ts | 7 +++----
src/renderer/App.vue | 10 ++++++++++
.../components/TimelineSpace/Modals/Shortcut.vue | 4 ----
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/main/index.ts b/src/main/index.ts
index 80d6259b..d49d31d0 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -1036,16 +1036,15 @@ const ApplicationMenu = (accountsChange: Array, menu
]
},
{
- label: i18n.t("main_menu.help.name"),
- role: "help",
+ label: i18n.t('main_menu.help.name'),
+ role: 'help',
submenu: [
{
label: i18n.t('main_menu.application.shortcuts'),
- accelerator: 'Shift+?',
click: () => {
mainWindow!.webContents.send('open-shortcuts-list')
}
- },
+ }
]
}
]
diff --git a/src/renderer/App.vue b/src/renderer/App.vue
index 071dcee1..e5b11c11 100644
--- a/src/renderer/App.vue
+++ b/src/renderer/App.vue
@@ -9,6 +9,9 @@ import { defineComponent, computed, onMounted, onUnmounted } from 'vue'
import { useI18next } from 'vue3-i18next'
import { useStore } from '@/store'
import { ACTION_TYPES } from '@/store/App'
+import { useActiveElement, useMagicKeys, whenever } from '@vueuse/core'
+import { logicAnd } from '@vueuse/math'
+import { MUTATION_TYPES } from '@/store/TimelineSpace/Modals/Shortcut'
export default defineComponent({
name: 'Whalebird',
@@ -16,6 +19,8 @@ export default defineComponent({
const space = 'App'
const store = useStore()
const i18n = useI18next()
+ const { Shift_Slash } = useMagicKeys()
+ const activeElement = useActiveElement()
const theme = computed(() => ({
'--theme-background-color': store.state.App.theme.background_color,
@@ -33,6 +38,7 @@ export default defineComponent({
'--base-font-size': `${store.state.App.fontSize}px`,
'--specified-fonts': store.state.App.defaultFonts.join(', ')
}))
+ const shortcutEnabled = computed(() => activeElement.value?.tagName !== 'TEXTAREA' && activeElement.value?.tagName !== 'INPUT')
onMounted(() => {
store.dispatch(`${space}/${ACTION_TYPES.WATCH_SHORTCUT_EVENTS}`)
@@ -44,6 +50,10 @@ export default defineComponent({
store.dispatch(`${space}/${ACTION_TYPES.REMOVE_SHORTCUT_EVENTS}`)
})
+ whenever(logicAnd(Shift_Slash, shortcutEnabled), async () => {
+ store.commit(`TimelineSpace/Modals/Shortcut/${MUTATION_TYPES.CHANGE_MODAL}`, true)
+ })
+
return {
theme
}
diff --git a/src/renderer/components/TimelineSpace/Modals/Shortcut.vue b/src/renderer/components/TimelineSpace/Modals/Shortcut.vue
index 04495b89..7b667c21 100644
--- a/src/renderer/components/TimelineSpace/Modals/Shortcut.vue
+++ b/src/renderer/components/TimelineSpace/Modals/Shortcut.vue
@@ -11,10 +11,6 @@
Ctrl(Cmd) + k |
{{ $t('modals.shortcut.ctrl_k') }} |
-
- Ctrl(Cmd) + n |
- {{ $t('modals.shortcut.ctrl_n') }} |
-
Ctrl(Cmd) + Enter |
{{ $t('modals.shortcut.ctrl_enter') }} |