markdown sync问题

markdown fixConflict有问题
          原因, changeNote保存了笔记, 在nodejs端判断title, content, tags是否修改了,
若修改了才算是dirty [ok]
 markdown 莫名变成了非markdown editor 更新了其它非markdown笔记导致
          send changes 后, server端总会返回IsMarkdown为false [ok]
This commit is contained in:
life
2015-03-01 21:16:58 +08:00
parent 6453959413
commit 2b4b9b3114
6 changed files with 138 additions and 46 deletions

21
node_modules/api.js generated vendored
View File

@@ -498,11 +498,11 @@ var Api = {
Title: note.Title,
NotebookId: serverNotebookId,
Content: note.Content,
IsMarkdown: note.isMarkdown,
IsMarkdown: note.IsMarkdown,
Tags: note.Tags,
IsBlog: note.IsBlog,
Files: note.Files,
FileDatas: note.FileDatas
FileDatas: note.FileDatas,
}
// log('add note');
// log(data);
@@ -543,6 +543,9 @@ var Api = {
updateNote: function(note, callback) {
var me = this;
Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) {
if(!note.Tags || note.Tags.length == 0) {
note.Tags = [''];
}
var data = {
noteId: note.ServerNoteId,
notebookId: serverNotebookId || "",
@@ -551,7 +554,8 @@ var Api = {
isTrash: note.IsTrash,
content: note.Content,
Files: note.Files,
FileDatas: note.FileDatas
FileDatas: note.FileDatas,
tags: note.Tags, // 新添加
}
console.log('update note :');
console.log(data);
@@ -573,6 +577,8 @@ var Api = {
var ret = resp.body;
log('update note ret:');
log(ret);
// 没有传IsMarkdown, 后台会传过来总为false
delete ret['IsMarkdown'];
callback(ret);
/*
if(Common.isOk(ret)) {
@@ -630,11 +636,12 @@ var Api = {
return callback && callback(false);
}
var ret = resp.body;
log('add tag ret ==========');
log(ret);
console.log('add tag ret ==========');
console.log(ret);
if(Common.isOk(ret)) {
// 以后不要再发了
Tag.setNotDirty(title);
// Tag.setNotDirty(title);
// 更新, 添加usn
Tag.setNotDirtyAndUsn(title, ret.Usn);
callback && callback(ret);
} else {
callback && callback(false);