From 99af94f38e6a7e99382f66b420625a9b5af0e3f7 Mon Sep 17 00:00:00 2001 From: 18alantom <2.alan.tom@gmail.com> Date: Thu, 20 Apr 2023 17:40:52 +0530 Subject: [PATCH] fix(ui): hanging border when using bg header - focus not found issue - save shortcut in Settings --- src/components/PageHeader.vue | 18 ++++++++++++++++-- src/components/SearchBar.vue | 2 +- src/pages/Settings/Settings.vue | 21 ++++++++++++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/components/PageHeader.vue b/src/components/PageHeader.vue index 99785b4e..f6c030ed 100644 --- a/src/components/PageHeader.vue +++ b/src/components/PageHeader.vue @@ -10,10 +10,13 @@
-

+

{{ title }}

@@ -53,6 +56,17 @@ export default defineComponent({ showBorder() { return !!this.$slots.default && this.searchborder; }, + spacerClass() { + if (this.showSidebar) { + return ''; + } + + if (this.border) { + return 'w-tl me-4 border-e'; + } + + return 'w-tl me-4'; + }, }, }); diff --git a/src/components/SearchBar.vue b/src/components/SearchBar.vue index 6090c23f..58cbb494 100644 --- a/src/components/SearchBar.vue +++ b/src/components/SearchBar.vue @@ -305,7 +305,7 @@ export default defineComponent({ this.searcher?.updateKeywords(); nextTick(() => { - (this.$refs.input as HTMLInputElement).focus(); + (this.$refs.input as HTMLInputElement)?.focus(); }); }, close(): void { diff --git a/src/pages/Settings/Settings.vue b/src/pages/Settings/Settings.vue index e2e1e647..be22d8b2 100644 --- a/src/pages/Settings/Settings.vue +++ b/src/pages/Settings/Settings.vue @@ -78,16 +78,24 @@ import FormHeader from 'src/components/FormHeader.vue'; import { handleErrorWithDialog } from 'src/errorHandling'; import { getErrorMessage } from 'src/utils'; import { evaluateHidden } from 'src/utils/doc'; +import { showToast } from 'src/utils/interactive'; import { reloadWindow } from 'src/utils/ipcCalls'; import { docsPathMap } from 'src/utils/misc'; import { docsPathRef } from 'src/utils/refs'; import { UIGroupedFields } from 'src/utils/types'; -import { showToast } from 'src/utils/interactive'; -import { computed, defineComponent } from 'vue'; +import { computed, defineComponent, inject } from 'vue'; import CommonFormSection from '../CommonForm/CommonFormSection.vue'; +import { shortcutsKey } from 'src/utils/injectionKeys'; + +const COMPONENT_NAME = 'Settings'; export default defineComponent({ components: { FormContainer, Button, FormHeader, CommonFormSection }, + setup() { + return { + shortcuts: inject(shortcutsKey), + }; + }, data() { return { errors: {}, @@ -119,10 +127,17 @@ export default defineComponent({ } docsPathRef.value = docsPathMap.Settings ?? ''; + this.shortcuts?.pmod.set(COMPONENT_NAME, ['KeyS'], () => { + if (!this.canSave) { + return; + } + + this.sync(); + }); }, async deactivated(): Promise { docsPathRef.value = ''; - + this.shortcuts?.delete(COMPONENT_NAME); if (!this.canSave) { return; }