refactor: minor improvements

This commit is contained in:
Fabio Di Stasio 2022-06-27 18:28:04 +02:00
parent e42c424a13
commit 822af44a47
4 changed files with 16 additions and 4 deletions

View File

@ -94,7 +94,7 @@ else {
}
});
ipcMain.on('change-window-title', (event, title: string) => {
ipcMain.on('change-window-title', (_, title: string) => {
if (mainWindow) mainWindow.setTitle(title);
});

View File

@ -377,7 +377,6 @@ export default defineComponent({
// fix position when the component is created and opened at the same time
if (isOpen.value) {
setTimeout(() => {
deactivate();
adjustListPosition();
}, 50);
}

View File

@ -125,7 +125,7 @@ const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
const { getWorkspace } = workspacesStore;
const { trapRef } = useFocusTrap();
const { trapRef } = useFocusTrap({ disableAutofocus: true });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const localRow: Ref<{[key: string]: any}> = ref({});
@ -274,6 +274,14 @@ const wrapNumber = (num: number) => {
window.addEventListener('keydown', onKey);
onMounted(() => {
setTimeout(() => {
const inputs = Array.from(document.querySelectorAll<HTMLInputElement>('.modal-container .form-input'));
if (inputs?.length) {
const firstEnabledInput = inputs.find((el) => !el.disabled);
firstEnabledInput?.focus();
}
}, 50);
const rowObj: {[key: string]: unknown} = {};
for (const field of props.fields) {

View File

@ -36,12 +36,13 @@
</template>
<script setup lang="ts">
import { computed, onUnmounted, ref } from 'vue';
import { computed, onUnmounted, ref, watch } from 'vue';
import { storeToRefs } from 'pinia';
import { getCurrentWindow } from '@electron/remote';
import { useConnectionsStore } from '@/stores/connections';
import { useWorkspacesStore } from '@/stores/workspaces';
import { useI18n } from 'vue-i18n';
import { ipcRenderer } from 'electron';
const { t } = useI18n();
@ -90,6 +91,10 @@ const onResize = () => {
isMaximized.value = w.value.isMaximized();
};
watch(windowTitle, (val) => {
ipcRenderer.send('change-window-title', val);
});
window.addEventListener('resize', onResize);
onUnmounted(() => {