From e1b502b1380c31277999df62246119e8055358bd Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Wed, 22 Mar 2023 22:58:36 +0530 Subject: [PATCH] refactor: remove global shortcuts, move Shortcuts - update injections in a few components - use Shift+Backspace for back (prevent clashes with the \b) - use string context for single instance components --- src/App.vue | 6 +- src/components/BackLink.vue | 23 +- src/components/Report/ListReport.vue | 8 +- src/components/SearchBar.vue | 6 +- src/components/ShortcutsHelper.vue | 4 +- src/components/Sidebar.vue | 8 +- src/pages/ChartOfAccounts.vue | 8 +- src/pages/TemplateBuilder/TemplateBuilder.vue | 14 +- src/utils/injectionKeys.ts | 7 +- src/utils/misc.ts | 4 + src/utils/shortcuts.ts | 222 ++++++++++++++++- src/utils/vueUtils.ts | 228 +----------------- utils/types.ts | 12 + 13 files changed, 293 insertions(+), 257 deletions(-) diff --git a/src/App.vue b/src/App.vue index 92041c96..11602eff 100644 --- a/src/App.vue +++ b/src/App.vue @@ -57,9 +57,9 @@ import { checkForUpdates } from './utils/ipcCalls'; import { updateConfigFiles } from './utils/misc'; import { updatePrintTemplates } from './utils/printTemplates'; import { Search } from './utils/search'; -import { setGlobalShortcuts } from './utils/shortcuts'; +import { Shortcuts } from './utils/shortcuts'; import { routeTo } from './utils/ui'; -import { Shortcuts, useKeys } from './utils/vueUtils'; +import { useKeys } from './utils/vueUtils'; enum Screen { Desk = 'Desk', @@ -102,7 +102,7 @@ export default defineComponent({ WindowsTitleBar, }, async mounted() { - setGlobalShortcuts(this.shortcuts as Shortcuts); + // setGlobalShortcuts(this.shortcuts as Shortcuts); this.setInitialScreen(); }, watch: { diff --git a/src/components/BackLink.vue b/src/components/BackLink.vue index 176552d7..8ed0d3b4 100644 --- a/src/components/BackLink.vue +++ b/src/components/BackLink.vue @@ -1,5 +1,6 @@