diff --git a/.boostnoterc.sample b/.boostnoterc.sample index a7981f7f..2d581a48 100644 --- a/.boostnoterc.sample +++ b/.boostnoterc.sample @@ -22,7 +22,9 @@ "fontSize": "14", "lineNumber": true }, - "sortBy": "UPDATED_AT", + "sortBy": { + "default": "UPDATED_AT" + }, "sortTagsBy": "ALPHABETICAL", "ui": { "defaultNote": "ALWAYS_ASK", diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 94b32f4c..f7dd0764 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -912,7 +912,7 @@ class NoteList extends React.Component { const { location, config, params: { folderKey } } = this.props let { notes } = this.props const { selectedNoteKeys } = this.state - const sortBy = _.get(config, [folderKey, 'sortBy'], config.sortBy) + const sortBy = _.get(config, [folderKey, 'sortBy'], config.sortBy.default) const sortFunc = sortBy === 'CREATED_AT' ? sortByCreatedAt : sortBy === 'ALPHABETICAL' diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index 0f6264be..434b0d22 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -16,7 +16,9 @@ export const DEFAULT_CONFIG = { isSideNavFolded: false, listWidth: 280, navWidth: 200, - sortBy: 'UPDATED_AT', // 'CREATED_AT', 'UPDATED_AT', 'APLHABETICAL' + sortBy: { + default: 'UPDATED_AT' // 'CREATED_AT', 'UPDATED_AT', 'APLHABETICAL' + }, sortTagsBy: 'ALPHABETICAL', // 'ALPHABETICAL', 'COUNTER' listStyle: 'DEFAULT', // 'DEFAULT', 'SMALL' amaEnabled: true, diff --git a/tests/lib/rc-parser-test.js b/tests/lib/rc-parser-test.js index 21d70d3c..024a2d36 100644 --- a/tests/lib/rc-parser-test.js +++ b/tests/lib/rc-parser-test.js @@ -5,7 +5,7 @@ const { parse } = require('browser/lib/RcParser') // Unit test test('RcParser should return a json object', t => { const validJson = { 'editor': { 'keyMap': 'vim', 'switchPreview': 'BLUR', 'theme': 'monokai' }, 'hotkey': { 'toggleMain': 'Control + L' }, 'listWidth': 135, 'navWidth': 135 } - const allJson = { 'amaEnabled': true, 'editor': { 'fontFamily': 'Monaco, Consolas', 'fontSize': '14', 'indentSize': '2', 'indentType': 'space', 'keyMap': 'vim', 'switchPreview': 'BLUR', 'theme': 'monokai' }, 'hotkey': { 'toggleMain': 'Cmd + Alt + L' }, 'isSideNavFolded': false, 'listStyle': 'DEFAULT', 'listWidth': 174, 'navWidth': 200, 'preview': { 'codeBlockTheme': 'dracula', 'fontFamily': 'Lato', 'fontSize': '14', 'lineNumber': true }, 'sortBy': 'UPDATED_AT', 'ui': { 'defaultNote': 'ALWAYS_ASK', 'disableDirectWrite': false, 'theme': 'default' }, 'zoom': 1 } + const allJson = { 'amaEnabled': true, 'editor': { 'fontFamily': 'Monaco, Consolas', 'fontSize': '14', 'indentSize': '2', 'indentType': 'space', 'keyMap': 'vim', 'switchPreview': 'BLUR', 'theme': 'monokai' }, 'hotkey': { 'toggleMain': 'Cmd + Alt + L' }, 'isSideNavFolded': false, 'listStyle': 'DEFAULT', 'listWidth': 174, 'navWidth': 200, 'preview': { 'codeBlockTheme': 'dracula', 'fontFamily': 'Lato', 'fontSize': '14', 'lineNumber': true }, 'sortBy': { 'default': 'UPDATED_AT' }, 'ui': { 'defaultNote': 'ALWAYS_ASK', 'disableDirectWrite': false, 'theme': 'default' }, 'zoom': 1 } // [input, expected] const validTestCases = [