You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Added concept of provisional note to simplify creation and handling of newly created notes
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
const Setting = require('lib/models/Setting');
|
||||
const Tag = require('lib/models/Tag');
|
||||
const Note = require('lib/models/Note');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const ResourceFetcher = require('lib/services/ResourceFetcher');
|
||||
|
||||
@ -28,16 +29,22 @@ const reduxSharedMiddleware = async function(store, next, action) {
|
||||
refreshTags = true;
|
||||
}
|
||||
|
||||
if (action.type === 'NOTE_SELECT') {
|
||||
const noteIds = newState.provisionalNoteIds.slice();
|
||||
for (const noteId of noteIds) {
|
||||
if (action.id === noteId) continue;
|
||||
await Note.delete(noteId);
|
||||
}
|
||||
}
|
||||
|
||||
if (action.type === 'NOTE_DELETE' ||
|
||||
action.type === 'NOTE_SELECT' ||
|
||||
action.type === 'NOTE_SELECT_TOGGLE' ||
|
||||
action.type === 'NOTE_SET_NEW_ONE') {
|
||||
action.type === 'NOTE_SELECT_TOGGLE') {
|
||||
let noteTags = [];
|
||||
|
||||
// We don't need to show tags unless only one note is selected.
|
||||
// For new notes, the old note is still selected, but we don't want to show any tags.
|
||||
if (action.type !== 'NOTE_SET_NEW_ONE' &&
|
||||
newState.selectedNoteIds &&
|
||||
if (newState.selectedNoteIds &&
|
||||
newState.selectedNoteIds.length === 1) {
|
||||
noteTags = await Tag.tagsByNoteId(newState.selectedNoteIds[0]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user