diff --git a/src/node_modules/note.js b/src/node_modules/note.js index 3f1a9be2..6573cdc7 100644 --- a/src/node_modules/note.js +++ b/src/node_modules/note.js @@ -197,8 +197,8 @@ var Note = { // 更新之 else { var histories = history.Histories; - histories.push(content); - db.noteHistories.update({_id: noteId}, {$set: {Histories: histories, "UpdatedTime": new Date()}}); + histories.push({Content: content, UpdatedTime: new Date()}); + db.noteHistories.update({_id: noteId}, {$set: {Histories: histories}}); } }); }); @@ -214,7 +214,17 @@ var Note = { else { var histories = []; for(var i = doc.Histories.length - 1; i >= 0; --i) { - histories.push({Content: doc.Histories[i], UpdatedTime: doc.UpdatedTime || new Date()}); + var history = doc.Histories[i]; + var content, updatedTime; + if (typeof history == 'object') { + content = history.Content; + updatedTime = history.UpdatedTime; + } + else { + content = history; + updatedTime = doc.UpdatedTime || new Date(); + } + histories.push({Content: content, UpdatedTime: updatedTime}); } callback(histories); } diff --git a/src/note.html b/src/note.html index 489603ec..128ce023 100755 --- a/src/note.html +++ b/src/note.html @@ -7,7 +7,7 @@ - +