mirror of
https://github.com/leanote/desktop-app.git
synced 2026-01-14 07:04:21 +08:00
历史记录回滚时强制保存当前为历史记录
This commit is contained in:
11
node_modules/note.js
generated
vendored
11
node_modules/note.js
generated
vendored
@@ -208,10 +208,11 @@ var Note = {
|
||||
Histories []EachHistory `Histories`
|
||||
}
|
||||
*/
|
||||
addNoteHistory: function(noteId, content) {
|
||||
addNoteHistory: function(noteId, content, callback) {
|
||||
var me = this;
|
||||
db.noteHistories.loadDB(function (ok) {
|
||||
if (!ok) {
|
||||
callback && callback(false);
|
||||
return;
|
||||
}
|
||||
// 先判断是否存在, 不存在则新建之
|
||||
@@ -219,7 +220,9 @@ var Note = {
|
||||
var now = new Date();
|
||||
// 新建之
|
||||
if(!history) {
|
||||
db.noteHistories.insert({_id: noteId, Histories: [{Content: content, "UpdatedTime": now}], "UpdatedTime": now});
|
||||
db.noteHistories.insert({_id: noteId, Histories: [{Content: content, "UpdatedTime": now}], "UpdatedTime": now}, function () {
|
||||
callback && callback(true);
|
||||
});
|
||||
}
|
||||
// 更新之
|
||||
else {
|
||||
@@ -235,7 +238,9 @@ var Note = {
|
||||
}
|
||||
}
|
||||
|
||||
db.noteHistories.update({_id: noteId}, {$set: {Histories: histories}});
|
||||
db.noteHistories.update({_id: noteId}, {$set: {Histories: histories}}, function () {
|
||||
callback && callback(true);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user