1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Mobile: Fixes #393: Fixed moving new notes before they are saved

This commit is contained in:
Laurent Cozic
2018-05-01 18:53:45 +01:00
parent 05faf55e8d
commit 398946d39a
2 changed files with 12 additions and 5 deletions

View File

@ -10,14 +10,16 @@ shared.noteExists = async function(noteId) {
return !!existingNote;
}
shared.saveNoteButton_press = async function(comp) {
shared.saveNoteButton_press = async function(comp, folderId = null) {
let note = Object.assign({}, comp.state.note);
// Note has been deleted while user was modifying it. In that case, we
// just save a new note by clearing the note ID.
if (note.id && !(await shared.noteExists(note.id))) delete note.id;
if (!note.parent_id) {
if (folderId) {
note.parent_id = folderId;
} else if (!note.parent_id) {
let folder = await Folder.defaultFolder();
if (!folder) return;
note.parent_id = folder.id;