Skip to content

Commit 26f05b3

Browse files
committed
override default values to undefined attributes of config
1 parent f50968f commit 26f05b3

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

browser/main/TopBar/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class TopBar extends React.Component {
4747
this.createNote('SNIPPET_NOTE')
4848
break
4949
case 'ALWAYS_ASK':
50+
default:
5051
let { dispatch, location } = this.props
5152
let { storage, folder } = this.resolveTargetFolder()
5253

@@ -181,7 +182,7 @@ class TopBar extends React.Component {
181182
{
182183
type: 'radio',
183184
label: 'Markdown Note',
184-
checked: config .ui.defaultNote === 'MARKDOWN_NOTE',
185+
checked: config.ui.defaultNote === 'MARKDOWN_NOTE',
185186
click: (e) => this.setDefaultNote('MARKDOWN_NOTE')
186187
},
187188
{

browser/main/lib/ConfigManager.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ function get () {
5353

5454
try {
5555
config = Object.assign({}, defaultConfig, JSON.parse(config))
56+
config.hotkey = Object.assign({}, defaultConfig.hotkey, config.hotkey)
57+
config.ui = Object.assign({}, defaultConfig.ui, config.ui)
58+
config.editor = Object.assign({}, defaultConfig.editor, config.editor)
59+
config.preview = Object.assign({}, defaultConfig.preview, config.preview)
5660
if (!validate(config)) throw new Error('INVALID CONFIG')
5761
} catch (err) {
5862
console.warn('Boostnote resets the malformed configuration.')

0 commit comments

Comments
 (0)