ace编辑器优化, 同步标签问题, 一次性上传多张图片

This commit is contained in:
life
2015-03-19 10:13:35 +08:00
parent c146d819c8
commit ebcab93fd7
314 changed files with 184 additions and 143 deletions

View File

@@ -2785,7 +2785,7 @@ Note.updateNoteCacheForServer = function(notes) {
for(var i in notes) {
var note = notes[i];
// alert(note.NoteId + " " + note.IsBlog);
Note.addNoteCache({NoteId: note.NoteId,
Note.setNoteCache({NoteId: note.NoteId,
ServerNoteId: note.ServerNoteId,
IsBlog: note.IsBlog,
});

View File

@@ -1283,21 +1283,29 @@ function initUploadImage() {
var $this = $(this);
var imagePath = $this.val();
$this.val('');
// 上传之
FileService.uploadImage(imagePath, function(newImage, msg) {
if(newImage) {
var note = Note.getCurNote();
var url = EvtService.getImageLocalUrl(newImage.FileId);
if(!note.IsMarkdown) {
tinymce.activeEditor.insertContent('<img src="' + url + '">');
} else {
// TODO markdown insert Image
MD.insertLink(url, '', true);
}
} else {
alert(msg || "error");
}
});
var imagePaths = imagePath.split(';'); // 一次性可上传多张图片
for(var i = 0; i < imagePaths.length; ++i) {
(function(k) {
var imagePath = imagePaths[k];
// 上传之
FileService.uploadImage(imagePath, function(newImage, msg) {
if(newImage) {
var note = Note.getCurNote();
var url = EvtService.getImageLocalUrl(newImage.FileId);
if(!note.IsMarkdown) {
tinymce.activeEditor.insertContent('<img src="' + url + '">');
} else {
// TODO markdown insert Image
MD.insertLink(url, '', true);
}
} else {
alert(msg || "error");
}
});
})(i);
}
});
}

View File

@@ -192,6 +192,8 @@ Tag.appendTag = function(tag, save) {
// nodejs端调用
Tag.addTagsNav = function(tags) {
tags = tags || [];
console.error('add tags --------');
console.error(tags);
for(var i = 0; i < tags.length; ++i) {
Tag.addTagNav(tags[i]);
}