mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 07:31:33 +00:00
笔记本数量, contextmenu
This commit is contained in:
1
node_modules/note.js
generated
vendored
1
node_modules/note.js
generated
vendored
@@ -1356,6 +1356,7 @@ var Note = {
|
||||
},
|
||||
// 彻底删除笔记时调用
|
||||
updateTagCount: function(tags) {
|
||||
var me = this;
|
||||
if(!tags) {
|
||||
return;
|
||||
}
|
||||
|
4
node_modules/tag.js
generated
vendored
4
node_modules/tag.js
generated
vendored
@@ -82,9 +82,9 @@ var Tag = {
|
||||
updateTagCount: function(title, count) {
|
||||
userId = User.getCurActiveUserId();
|
||||
// 更新Tag's Count
|
||||
Tags.update({UserId: userId, Tag: title}, {$set: {Count: cnt}});
|
||||
Tags.update({UserId: userId, Tag: title}, {$set: {Count: count}});
|
||||
// 更新web
|
||||
Web.updateTagCount({Tag: title, Count: cnt});
|
||||
Web.updateTagCount({Tag: title, Count: count});
|
||||
},
|
||||
|
||||
getTag: function(title, callback) {
|
||||
|
2
node_modules/web.js
generated
vendored
2
node_modules/web.js
generated
vendored
@@ -81,7 +81,7 @@ var Web = {
|
||||
// TODO test
|
||||
updateTagCount: function(tag) {
|
||||
var me = this;
|
||||
me.Tag.updateTagCount(tag);
|
||||
// me.Tag.updateTagCount(tag);
|
||||
},
|
||||
|
||||
//
|
||||
|
@@ -1467,6 +1467,7 @@ top: 4px;
|
||||
}
|
||||
.tag-delete {
|
||||
display: none;
|
||||
margin-left: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
li:hover {
|
||||
|
@@ -1328,6 +1328,7 @@ h3 {
|
||||
}
|
||||
#tagNav .tag-delete {
|
||||
display: none;
|
||||
margin-left: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
#tagNav li:hover .tag-delete {
|
||||
|
@@ -1328,6 +1328,7 @@ h3 {
|
||||
}
|
||||
#tagNav .tag-delete {
|
||||
display: none;
|
||||
margin-left: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
#tagNav li:hover .tag-delete {
|
||||
|
@@ -1328,6 +1328,7 @@ h3 {
|
||||
}
|
||||
#tagNav .tag-delete {
|
||||
display: none;
|
||||
margin-left: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
#tagNav li:hover .tag-delete {
|
||||
|
@@ -1328,6 +1328,7 @@ h3 {
|
||||
}
|
||||
#tagNav .tag-delete {
|
||||
display: none;
|
||||
margin-left: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
#tagNav li:hover .tag-delete {
|
||||
|
@@ -102,7 +102,7 @@ Note.clearCacheByNotebookId = function(notebookId) {
|
||||
Note.notebookHasNotes = function(notebookId) {
|
||||
var notes = Note.getNotesByNotebookId(notebookId);
|
||||
return !isEmpty(notes);
|
||||
}
|
||||
};
|
||||
|
||||
// 得到notebook下的notes, 按什么排序 updatedTime?
|
||||
Note.getNotesByNotebookId = function(notebookId, sortBy, isAsc) {
|
||||
@@ -1201,6 +1201,18 @@ Note.deleteNote = function(target, contextmenuItem, isShared) {
|
||||
Notebook.minusNotebookNumberNotes(note.NotebookId);
|
||||
}
|
||||
|
||||
if(note.IsNew) {
|
||||
Note.changeToNext(target);
|
||||
$(target).remove();
|
||||
// 删除缓存
|
||||
if(note) {
|
||||
Note.clearCacheByNotebookId(note.NotebookId);
|
||||
delete Note.cache[noteId];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
serverFunc.call(NoteService, noteId, function(ret) {
|
||||
if(ret) {
|
||||
Note.changeToNext(target);
|
||||
|
@@ -39,8 +39,24 @@ Notebook._updateNotebookNumberNotes = function(notebookId, n) {
|
||||
if(notebook.NumberNotes < 0) {
|
||||
notebook.NumberNotes = 0;
|
||||
}
|
||||
$("#numberNotes_" + notebookId).html(notebook.NumberNotes);
|
||||
|
||||
// 得到笔记本下笔记的数量, v2, 重新统计
|
||||
var notes = Note.getNotesByNotebookId(notebookId);
|
||||
var cnt = notes ? notes.length : 0;
|
||||
|
||||
if(!cnt) {
|
||||
$("#numberNotes_" + notebookId).html(notebook.NumberNotes);
|
||||
} else {
|
||||
if(n == -1) {
|
||||
cnt += n;
|
||||
}
|
||||
if(cnt < 0) {
|
||||
cnt = 0;
|
||||
}
|
||||
$("#numberNotes_" + notebookId).html(cnt);
|
||||
}
|
||||
};
|
||||
|
||||
// addNote, copyNote, moveNote
|
||||
Notebook.incrNotebookNumberNotes = function(notebookId) {
|
||||
var self = this;
|
||||
@@ -712,7 +728,7 @@ Notebook.hideNoteAndEditorLoading = function() {
|
||||
// called by Note
|
||||
Notebook.isCurNotebook = function(notebookId) {
|
||||
return $(tt('#notebookList [notebookId="?"], #shareNotebooks [notebookId="?"]', notebookId, notebookId)).attr("class") == "active";
|
||||
}
|
||||
};
|
||||
|
||||
// 改变nav, 为了新建note
|
||||
// called by Note
|
||||
@@ -953,12 +969,12 @@ $(function() {
|
||||
var notebookListMenu = {
|
||||
width: 180,
|
||||
items: [
|
||||
{ text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
|
||||
{ type: "splitLine" },
|
||||
{ text: getMsg("publicAsBlog"), alias: 'set2Blog', faIcon: "fa-bold", action: Notebook.setNotebook2Blog },
|
||||
{ text: getMsg("cancelPublic"), alias: 'unset2Blog',faIcon: "fa-undo", action: Notebook.setNotebook2Blog }, // Unset
|
||||
{ type: "splitLine" },
|
||||
{ text: getMsg("addChildNotebook"), faIcon: "fa-sitemap", action: Notebook.addChildNotebook },
|
||||
// { text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
|
||||
// { type: "splitLine" },
|
||||
// { text: getMsg("publicAsBlog"), alias: 'set2Blog', faIcon: "fa-bold", action: Notebook.setNotebook2Blog },
|
||||
// { text: getMsg("cancelPublic"), alias: 'unset2Blog',faIcon: "fa-undo", action: Notebook.setNotebook2Blog }, // Unset
|
||||
// { type: "splitLine" },
|
||||
{ text: 'Add sub notebook', faIcon: "fa-sitemap", action: Notebook.addChildNotebook },
|
||||
{ text: getMsg("rename"), faIcon: "fa-pencil", action: Notebook.updateNotebookTitle },
|
||||
{ text: getMsg("delete"), icon: "", alias: 'delete', faIcon: "fa-trash-o", action: Notebook.deleteNotebook }
|
||||
],
|
||||
@@ -972,11 +988,11 @@ $(function() {
|
||||
var notebookListMenu2 = {
|
||||
width: 180,
|
||||
items: [
|
||||
{ text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
|
||||
{ type: "splitLine" },
|
||||
{ text: getMsg("publicAsBlog"), alias: 'set2Blog', faIcon: "fa-bold", action: Notebook.setNotebook2Blog },
|
||||
{ text: getMsg("cancelPublic"), alias: 'unset2Blog',faIcon: "fa-undo", action: Notebook.setNotebook2Blog }, // Unset
|
||||
{ type: "splitLine" },
|
||||
// { text: getMsg("shareToFriends"), alias: 'shareToFriends', icon: "", faIcon: "fa-share-square-o", action: Notebook.listNotebookShareUserInfo},
|
||||
// { type: "splitLine" },
|
||||
// { text: getMsg("publicAsBlog"), alias: 'set2Blog', faIcon: "fa-bold", action: Notebook.setNotebook2Blog },
|
||||
// { text: getMsg("cancelPublic"), alias: 'unset2Blog',faIcon: "fa-undo", action: Notebook.setNotebook2Blog }, // Unset
|
||||
// { type: "splitLine" },
|
||||
{ text: getMsg("rename"), icon: "", action: Notebook.updateNotebookTitle },
|
||||
{ text: getMsg("delete"), icon: "", alias: 'delete', faIcon: "fa-trash-o", action: Notebook.deleteNotebook }
|
||||
],
|
||||
|
@@ -51,7 +51,7 @@ Service.dispatch = function(router, param, callback) {
|
||||
*/
|
||||
|
||||
// 右键菜单
|
||||
$(document).on('contextmenu', function (e) {
|
||||
$('#noteTitle, #searchNoteInput, #searchNotebookForList, #addTagInput, #wmd-input, #editorContent').on('contextmenu', function (e) {
|
||||
e.preventDefault();
|
||||
var $target = $(e.target);
|
||||
// var selectionType = window.getSelection().type.toUpperCase();
|
||||
|
@@ -261,7 +261,8 @@ Tag.renderTagNav = function(tags) {
|
||||
}
|
||||
*/
|
||||
var classes = Tag.classes[tag] || "label label-default";
|
||||
$("#tagNav").append(tt('<li data-tag="?"><a> <span class="?">? <em>(?)</em></span> <i class="tag-delete">X</i></li>', tag, classes, text, noteTag.Count));
|
||||
// 笔记数量先隐藏, 不准确
|
||||
$("#tagNav").append(tt('<li data-tag="?"><a> <span class="?">? <em style="display: none">(?)</em></span> <i class="tag-delete">X</i></li>', tag, classes, text, noteTag.Count));
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user