mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 23:55:50 +00:00
防止移动复制笔记本时, 重置数量找不到
This commit is contained in:
@@ -29,6 +29,7 @@ Notebook.getCurNotebook = function() {
|
|||||||
// 还没显示到web上
|
// 还没显示到web上
|
||||||
// 放在这里, 让addNote时调用
|
// 放在这里, 让addNote时调用
|
||||||
Notebook._newNotebookNumberNotes = {}; // notebookId => count
|
Notebook._newNotebookNumberNotes = {}; // notebookId => count
|
||||||
|
Notebook._subNotebookNumberNotes = {};
|
||||||
Notebook.reRenderNotebookNumberNotesIfIsNewNotebook = function(notebookId) {
|
Notebook.reRenderNotebookNumberNotesIfIsNewNotebook = function(notebookId) {
|
||||||
var count = Notebook._newNotebookNumberNotes[notebookId];
|
var count = Notebook._newNotebookNumberNotes[notebookId];
|
||||||
if(count) {
|
if(count) {
|
||||||
@@ -43,12 +44,18 @@ Notebook.reRenderNotebookNumberNotesIfIsNewNotebook = function(notebookId) {
|
|||||||
Notebook.updateNotebookNumberNotes = function(notebookId, count) {
|
Notebook.updateNotebookNumberNotes = function(notebookId, count) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var notebook = self.getNotebook(notebookId);
|
var notebook = self.getNotebook(notebookId);
|
||||||
// 为什么可能会没有? 因为可能是新加的笔记本, 此时该笔记本又有笔记, 一起同步过来
|
// 为什么可能会没有? 因为可能是新加的笔记本, 此时该笔记本又有笔记, 一起同步过来
|
||||||
// 还没显示到web上
|
// 可能是子笔记本, 显示不出
|
||||||
|
// 还没显示到web上
|
||||||
if(!notebook) {
|
if(!notebook) {
|
||||||
Notebook._newNotebookNumberNotes[notebookId] = count;
|
Notebook._newNotebookNumberNotes[notebookId] = count;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!$("#numberNotes_" + notebookId).length) {
|
||||||
|
Notebook._subNotebookNumberNotes[notebookId] = count;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
notebook.NumberNotes = count;
|
notebook.NumberNotes = count;
|
||||||
$("#numberNotes_" + notebookId).html(count);
|
$("#numberNotes_" + notebookId).html(count);
|
||||||
};
|
};
|
||||||
@@ -142,7 +149,7 @@ Notebook.getSubNotebooks = function(parentNotebookId) {
|
|||||||
return nodes;
|
return nodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
Notebook.getTreeSetting = function(isSearch, isShare){
|
Notebook.getTreeSetting = function(isSearch, isShare) {
|
||||||
var noSearch = !isSearch;
|
var noSearch = !isSearch;
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -280,6 +287,22 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
|||||||
onDrop: onDrop,
|
onDrop: onDrop,
|
||||||
onClick: onClick,
|
onClick: onClick,
|
||||||
onDblClick: onDblClick,
|
onDblClick: onDblClick,
|
||||||
|
onExpand: function (event, treeId, treeNode) {
|
||||||
|
// 展开时, 会有子笔记本, 如果之前有设置数量, 则重新设置
|
||||||
|
// 为了防止移动, 复制过来时没有该sub
|
||||||
|
if (treeNode.isParent) {
|
||||||
|
var childNotes = self.getSubNotebooks(treeNode.NotebookId);
|
||||||
|
if (childNotes) {
|
||||||
|
childNotes.forEach(function (node) {
|
||||||
|
var notebookId = node.NotebookId;
|
||||||
|
if (Notebook._subNotebookNumberNotes[notebookId] !== undefined) {
|
||||||
|
$('#numberNotes_' + notebookId).html(Notebook._subNotebookNumberNotes[notebookId]);
|
||||||
|
Notebook._subNotebookNumberNotes[notebookId] = undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
beforeRename: function(treeId, treeNode, newName, isCancel) {
|
beforeRename: function(treeId, treeNode, newName, isCancel) {
|
||||||
if(newName == "") {
|
if(newName == "") {
|
||||||
if(treeNode.IsNew) {
|
if(treeNode.IsNew) {
|
||||||
@@ -307,10 +330,6 @@ Notebook.getTreeSetting = function(isSearch, isShare){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 搜索不能拖拽
|
|
||||||
if(isSearch) {
|
|
||||||
}
|
|
||||||
|
|
||||||
return setting;
|
return setting;
|
||||||
}
|
}
|
||||||
Notebook.allNotebookId = "0";
|
Notebook.allNotebookId = "0";
|
||||||
@@ -349,7 +368,7 @@ Notebook.renderNotebooks = function(notebooks) {
|
|||||||
}, function() {
|
}, function() {
|
||||||
$(this).removeClass("showIcon");
|
$(this).removeClass("showIcon");
|
||||||
});
|
});
|
||||||
|
|
||||||
// 缓存所有notebooks信息
|
// 缓存所有notebooks信息
|
||||||
if(!isEmpty(notebooks)) {
|
if(!isEmpty(notebooks)) {
|
||||||
Notebook.curNotebookId = notebooks[0].NotebookId;
|
Notebook.curNotebookId = notebooks[0].NotebookId;
|
||||||
|
Reference in New Issue
Block a user