@@ -13,11 +13,11 @@ shared.noteExists = async function(noteId) {
1313shared . saveNoteButton_press = async function ( comp ) {
1414 let note = Object . assign ( { } , comp . state . note ) ;
1515
16- // Note has been deleted while user was modifying it. In that, we
16+ // Note has been deleted while user was modifying it. In that case , we
1717 // just save a new note by clearing the note ID.
1818 if ( note . id && ! ( await shared . noteExists ( note . id ) ) ) delete note . id ;
1919
20- reg . logger ( ) . info ( 'Saving note: ' , note ) ;
20+ // reg.logger().info('Saving note: ', note);
2121
2222 if ( ! note . parent_id ) {
2323 let folder = await Folder . defaultFolder ( ) ;
@@ -46,9 +46,19 @@ shared.saveNoteButton_press = async function(comp) {
4646
4747 const savedNote = await Note . save ( diff ) ;
4848
49+ const stateNote = comp . state . note ;
4950 // Re-assign any property that might have changed during saving (updated_time, etc.)
5051 note = Object . assign ( note , savedNote ) ;
5152
53+ if ( stateNote ) {
54+ // But we preserve the current title and body because
55+ // the user might have changed them between the time
56+ // saveNoteButton_press was called and the note was
57+ // saved (it's done asynchronously)
58+ note . title = stateNote . title ;
59+ note . body = stateNote . body ;
60+ }
61+
5262 comp . setState ( {
5363 lastSavedNote : Object . assign ( { } , note ) ,
5464 note : note ,
@@ -65,7 +75,7 @@ shared.saveOneProperty = async function(comp, name, value) {
6575 // just save a new note by clearing the note ID.
6676 if ( note . id && ! ( await shared . noteExists ( note . id ) ) ) delete note . id ;
6777
68- reg . logger ( ) . info ( 'Saving note property: ' , note . id , name , value ) ;
78+ // reg.logger().info('Saving note property: ', note.id, name, value);
6979
7080 if ( note . id ) {
7181 let toSave = { id : note . id } ;
0 commit comments