From e741d6c6a5cfd1fb99d62e541d88a7074cfc2d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20H=C3=A4usler?= Date: Sun, 2 Jan 2022 20:58:14 +0100 Subject: [PATCH] Fix preference scaling and improve UX (#2815) --- src/main/config.js | 2 + src/main/windows/setting.js | 6 +- .../prefComponents/common/compound/index.vue | 7 + src/renderer/prefComponents/editor/config.js | 14 + src/renderer/prefComponents/editor/index.vue | 286 ++++++++++-------- src/renderer/prefComponents/general/index.vue | 193 +++++++----- src/renderer/prefComponents/image/index.vue | 37 ++- .../prefComponents/markdown/config.js | 14 - .../prefComponents/markdown/index.vue | 198 ++++++------ src/renderer/prefComponents/sideBar/index.vue | 16 +- .../prefComponents/spellchecker/index.vue | 68 +++-- src/renderer/prefComponents/theme/index.vue | 7 +- 12 files changed, 492 insertions(+), 356 deletions(-) diff --git a/src/main/config.js b/src/main/config.js index 7420487f..4e152ea1 100644 --- a/src/main/config.js +++ b/src/main/config.js @@ -19,6 +19,8 @@ export const editorWinOptions = Object.freeze({ }) export const preferencesWinOptions = Object.freeze({ + minWidth: 450, + minHeight: 350, width: 950, height: 650, webPreferences: { diff --git a/src/main/windows/setting.js b/src/main/windows/setting.js index 9facbbbf..dbcd9e21 100644 --- a/src/main/windows/setting.js +++ b/src/main/windows/setting.js @@ -4,7 +4,7 @@ import { enable as remoteEnable } from '@electron/remote/main' import electronLocalshortcut from '@hfelix/electron-localshortcut' import BaseWindow, { WindowLifecycle, WindowType } from './base' import { centerWindowOptions } from './utils' -import { TITLE_BAR_HEIGHT, preferencesWinOptions, isLinux, isOsx, isWindows } from '../config' +import { TITLE_BAR_HEIGHT, preferencesWinOptions, isLinux, isOsx } from '../config' class SettingWindow extends BaseWindow { /** @@ -30,9 +30,7 @@ class SettingWindow extends BaseWindow { // WORKAROUND: Electron has issues with different DPI per monitor when // setting a fixed window size. - if (isWindows) { - winOptions.resizable = true - } + winOptions.resizable = true // Enable native or custom/frameless window and titlebar const { titleBarStyle, theme } = preferences.getAll() diff --git a/src/renderer/prefComponents/common/compound/index.vue b/src/renderer/prefComponents/common/compound/index.vue index e730b5e6..c71ef20f 100644 --- a/src/renderer/prefComponents/common/compound/index.vue +++ b/src/renderer/prefComponents/common/compound/index.vue @@ -29,10 +29,17 @@ export default { margin: 20px 0; color: var(--editorColor); + & .pref-compound-head h6.title { + font-weight: 400; + font-size: 1.1em; + padding-bottom: 6px; + } + & .pref-compound-body { padding: 8px 16px 8px 16px; margin-top: -12px; background: rgba(0, 0, 0, .04); + border: 1px solid rgba(255, 255, 255, .03); } & .description { diff --git a/src/renderer/prefComponents/editor/config.js b/src/renderer/prefComponents/editor/config.js index 6fc3eaa5..b7f1dff7 100644 --- a/src/renderer/prefComponents/editor/config.js +++ b/src/renderer/prefComponents/editor/config.js @@ -1,5 +1,19 @@ import { ENCODING_NAME_MAP } from 'common/encoding' +export const tabSizeOptions = [{ + label: '1', + value: 1 +}, { + label: '2', + value: 2 +}, { + label: '3', + value: 3 +}, { + label: '4', + value: 4 +}] + export const endOfLineOptions = [{ label: 'Default', value: 'default' diff --git a/src/renderer/prefComponents/editor/index.vue b/src/renderer/prefComponents/editor/index.vue index 6a23efd4..4a866eb1 100644 --- a/src/renderer/prefComponents/editor/index.vue +++ b/src/renderer/prefComponents/editor/index.vue @@ -1,132 +1,172 @@