1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Mobile: Fixed auto-assignment of title for new notes

This commit is contained in:
Laurent Cozic 2017-12-07 21:32:22 +00:00
parent 5cd55cada6
commit f3751e4ba6

View File

@ -29,9 +29,11 @@ shared.saveNoteButton_press = async function(comp) {
} }
let isNew = !note.id; let isNew = !note.id;
let titleWasAutoAssigned = false;
if (isNew && !note.title) { if (isNew && !note.title) {
note.title = Note.defaultTitle(note); note.title = Note.defaultTitle(note);
titleWasAutoAssigned = true;
} }
// Save only the properties that have changed // Save only the properties that have changed
@ -54,8 +56,11 @@ shared.saveNoteButton_press = async function(comp) {
// But we preserve the current title and body because // But we preserve the current title and body because
// the user might have changed them between the time // the user might have changed them between the time
// saveNoteButton_press was called and the note was // saveNoteButton_press was called and the note was
// saved (it's done asynchronously) // saved (it's done asynchronously).
note.title = stateNote.title; //
// If the title was auto-assigned above, we don't restore
// it from the state because it will be empty there.
if (!titleWasAutoAssigned) note.title = stateNote.title;
note.body = stateNote.body; note.body = stateNote.body;
} }