Skip to content

Commit 469e715

Browse files
committed
feat(constants): add default editor settings to constants
1 parent 4076f69 commit 469e715

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/main/store/constants.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1+
import type { EditorSettings } from './types'
2+
13
export const APP_DEFAULTS = {
24
sizes: {
35
sidebar: 180,
46
snippetList: 250,
57
tagsList: 50, // в %
68
},
79
}
10+
11+
export const EDITOR_DEFAULTS: EditorSettings = {
12+
fontSize: 13,
13+
fontFamily: 'SF Mono, Consolas, Menlo, Ubuntu Mono, monospace',
14+
wrap: false,
15+
tabSize: 2,
16+
trailingComma: 'all',
17+
semi: false,
18+
singleQuote: false,
19+
highlightLine: false,
20+
matchBrackets: true,
21+
}
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { PreferencesStore } from '../types'
22
import { homedir, platform } from 'node:os'
33
import Store from 'electron-store'
4+
import { EDITOR_DEFAULTS } from '../constants'
45

56
const isWin = platform() === 'win32'
67

@@ -17,16 +18,6 @@ export default new Store<PreferencesStore>({
1718
apiPort: 4321,
1819
language: 'en_US',
1920
theme: 'auto',
20-
editor: {
21-
fontSize: 13,
22-
fontFamily: 'SF Mono, Consolas, Menlo, Ubuntu Mono, monospace',
23-
wrap: false,
24-
tabSize: 2,
25-
trailingComma: 'all',
26-
semi: false,
27-
singleQuote: false,
28-
highlightLine: false,
29-
matchBrackets: true,
30-
},
21+
editor: EDITOR_DEFAULTS,
3122
},
3223
})

src/renderer/components/editor/Editor.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useEditor, useSnippets, useSnippetUpdate } from '@/composables'
44
import { i18n, ipc } from '@/electron'
55
import { useDark, useDebounceFn } from '@vueuse/core'
66
import CodeMirror from 'codemirror'
7+
import { EDITOR_DEFAULTS } from '~/main/store/constants'
78
import 'codemirror/addon/edit/closebrackets'
89
import 'codemirror/addon/edit/matchbrackets'
910
import 'codemirror/addon/search/search'
@@ -95,7 +96,7 @@ async function init() {
9596
})
9697
9798
ipc.on('main-menu:font-size-reset', () => {
98-
settings.fontSize = 13
99+
settings.fontSize = EDITOR_DEFAULTS.fontSize
99100
})
100101
101102
watch(selectedSnippetContent, (v) => {

0 commit comments

Comments
 (0)