You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-12 22:57:38 +02:00
Electron: Improved the way new note are created, and automatically add a title. Made saving and loading notes more reliable.
This commit is contained in:
@ -29,6 +29,7 @@ const defaultState = {
|
||||
appState: 'starting',
|
||||
//windowContentSize: { width: 0, height: 0 },
|
||||
hasDisabledSyncItems: false,
|
||||
newNote: null,
|
||||
};
|
||||
|
||||
function arrayHasEncryptedItems(array) {
|
||||
@ -144,12 +145,14 @@ function changeSelectedNotes(state, action) {
|
||||
|
||||
if (action.type === 'NOTE_SELECT') {
|
||||
newState.selectedNoteIds = noteIds;
|
||||
newState.newNote = null;
|
||||
return newState;
|
||||
}
|
||||
|
||||
if (action.type === 'NOTE_SELECT_ADD') {
|
||||
if (!noteIds.length) return state;
|
||||
newState.selectedNoteIds = ArrayUtils.unique(newState.selectedNoteIds.concat(noteIds));
|
||||
newState.newNote = null;
|
||||
return newState;
|
||||
}
|
||||
|
||||
@ -164,6 +167,7 @@ function changeSelectedNotes(state, action) {
|
||||
newSelectedNoteIds.push(id);
|
||||
}
|
||||
newState.selectedNoteIds = newSelectedNoteIds;
|
||||
newState.newNote = null;
|
||||
|
||||
return newState;
|
||||
}
|
||||
@ -177,6 +181,8 @@ function changeSelectedNotes(state, action) {
|
||||
newState = changeSelectedNotes(state, { type: 'NOTE_SELECT_ADD', id: noteIds[0] });
|
||||
}
|
||||
|
||||
newState.newNote = null;
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
@ -455,6 +461,12 @@ const reducer = (state = defaultState, action) => {
|
||||
newState.hasDisabledSyncItems = true;
|
||||
break;
|
||||
|
||||
case 'NOTE_SET_NEW_ONE':
|
||||
|
||||
newState = Object.assign({}, state);
|
||||
newState.newNote = action.item;
|
||||
break;
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
error.message = 'In reducer: ' + error.message + ' Action: ' + JSON.stringify(action);
|
||||
|
Reference in New Issue
Block a user