mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-18 09:24:55 +00:00
ace编辑器优化, 同步标签问题, 一次性上传多张图片
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -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]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user