move, copy notebooks contextmenu ok
This commit is contained in:
@ -61,13 +61,14 @@
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
border-radius: 0;
|
||||
border-radius: 3px;
|
||||
margin:0;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
border: 1px solid @hColor;
|
||||
/*overflow-x: hidden; */
|
||||
/*overflow-y: scroll;*/
|
||||
box-shadow: rgba(0, 0, 0, 0.172549) 0px 6px 12px 0px;
|
||||
}
|
||||
|
||||
.dropdown-menu li {
|
||||
@ -143,11 +144,11 @@
|
||||
}
|
||||
|
||||
// 动画
|
||||
.open > .dropdown-list {
|
||||
.open > .dropdown-menu {
|
||||
-webkit-transform: scale(1, 1);
|
||||
transform: scale(1, 1);
|
||||
}
|
||||
.dropdown-list {
|
||||
.dropdown-menu {
|
||||
-webkit-transform-origin: left;
|
||||
transform-origin: top;
|
||||
-webkit-animation-fill-mode: forwards;
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1153,13 +1153,37 @@ Note.copyNote = function(target, data, isShared) {
|
||||
}
|
||||
|
||||
Note.contextmenu = null;
|
||||
Note.getContextNotebooks = function(notebooks) {
|
||||
var moves = [];
|
||||
var copys = [];
|
||||
for(var i in notebooks) {
|
||||
var notebook = notebooks[i];
|
||||
var move = {text: notebook.Title, notebookId: notebook.NotebookId, action: Note.moveNote}
|
||||
var copy = {text: notebook.Title, notebookId: notebook.NotebookId, action: Note.copyNote}
|
||||
if(!isEmpty(notebook.Subs)) {
|
||||
var mc = Note.getContextNotebooks(notebook.Subs);
|
||||
move.items = mc[0];
|
||||
copy.items = mc[1];
|
||||
$.extend(move, {type: "group", width: 150});
|
||||
$.extend(copy, {type: "group", width: 150});
|
||||
}
|
||||
moves.push(move);
|
||||
copys.push(copy);
|
||||
}
|
||||
return [moves, copys];
|
||||
}
|
||||
Note.initContextmenu = function() {
|
||||
var self = Note;
|
||||
if(Note.contextmenu) {
|
||||
Note.contextmenu.unbind("contextmenu");
|
||||
}
|
||||
// 得到可移动的notebook
|
||||
var notebooksMove = [];
|
||||
var notebooksCopy = [];
|
||||
var notebooks = Notebook.everNotebooks;
|
||||
var mc = self.getContextNotebooks(notebooks);
|
||||
var notebooksMove = mc[0];
|
||||
var notebooksCopy = mc[1];
|
||||
|
||||
/*
|
||||
$("#notebookNavForNewNote li div.new-note-left").each(function() {
|
||||
var notebookId = $(this).attr("notebookId");
|
||||
var title = $(this).text();
|
||||
@ -1168,6 +1192,7 @@ Note.initContextmenu = function() {
|
||||
notebooksMove.push(move);
|
||||
notebooksCopy.push(copy);
|
||||
});
|
||||
*/
|
||||
|
||||
//---------------------
|
||||
// context menu
|
||||
@ -1180,7 +1205,7 @@ Note.initContextmenu = function() {
|
||||
{ text: "公开为博客", alias: 'set2Blog', icon: "", action: Note.setNote2Blog },
|
||||
{ text: "取消公开为博客", alias: 'unset2Blog', icon: "", action: Note.setNote2Blog },
|
||||
{ type: "splitLine" },
|
||||
// { text: "发送长微博", alias: 'html2Image', icon: "", action: Note.html2Image },
|
||||
// { text: "发送长微博", alias: 'html2Image', icon: "", action: Note.html2Image , width: 150, type: "group", items:[{text: "a"}]},
|
||||
// { type: "splitLine" },
|
||||
{ text: "删除", icon: "", faIcon: "fa-trash-o", action: Note.deleteNote },
|
||||
{ text: "移动", alias: "move", icon: "",
|
||||
|
@ -336,44 +336,14 @@ Notebook.everNotebooks = [];
|
||||
Notebook.changeNav = function() {
|
||||
var self = Notebook;
|
||||
|
||||
var navForNewNote = "";
|
||||
|
||||
var notebooks = Notebook.tree.getNodes();
|
||||
var html = self.getChangedNotebooks(notebooks);
|
||||
var pureNotebooks = notebooks.slice(1, -1); // 不含新和垃圾
|
||||
var html = self.getChangedNotebooks(pureNotebooks);
|
||||
|
||||
self.everNavForNewNote = html;
|
||||
self.everNotebooks = notebooks;
|
||||
self.everNotebooks = pureNotebooks;
|
||||
|
||||
/*
|
||||
var i = 0;
|
||||
var $list = $("#notebookList li a");
|
||||
var len = $list.length - 1;
|
||||
$list.each(function() {
|
||||
var notebookId = $(this).attr("notebookId");
|
||||
var notebook = Notebook.cache[notebookId];
|
||||
if(notebook) {
|
||||
var each = t('<li role="presentation"><a role="menuitem" tabindex="-1" href="#" notebookId="?">?</a></li>', notebook.NotebookId, notebook.Title);
|
||||
var eachForNew = t('<li role="presentation" class="clearfix"><div class="new-note-left pull-left" title="为该笔记本新建笔记" href="#" notebookId="?">?</div><div title="为该笔记本新建markdown笔记" class="new-note-right pull-left" notebookId="?">Markdown</div></li>', notebook.NotebookId, notebook.Title, notebook.NotebookId);
|
||||
|
||||
navForListNote += each;
|
||||
var isActive = $(this).hasClass('active'); // 万一修改的是已选择的, 那么...
|
||||
if(isActive) {
|
||||
$("#curNotebookForListNote").html(notebook.Title);
|
||||
}
|
||||
if(i != 0 && i != len) {
|
||||
navForNewNote += eachForNew;
|
||||
if(isActive) {
|
||||
$("#curNotebookForNewNote").html(notebook.Title);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
$("#notebookNavForListNote").html(html);
|
||||
$("#notebookNavForNewNote").html(html);
|
||||
$("#notebookNavForMoveNote").html(html);
|
||||
|
||||
// 移动, 复制重新来, 因为nav变了, 移动至-----的notebook导航也变了
|
||||
Note.initContextmenu();
|
||||
|
@ -21,7 +21,8 @@ LEA.cmroot = 1;
|
||||
this.disable = obj.disable;
|
||||
this.className = "b-m-idisable";
|
||||
}
|
||||
$(this).width(obj.width).click(returnfalse).mousedown(returnfalse).appendTo($("body"));
|
||||
$(this).width(obj.width).click(function(){}).mousedown(returnfalse).appendTo($("body"));
|
||||
|
||||
obj = null;
|
||||
return this;
|
||||
};
|
||||
@ -73,19 +74,29 @@ LEA.cmroot = 1;
|
||||
// log(items[i].alias);
|
||||
}
|
||||
items[i].gidx = gidx;
|
||||
if (items[i].type == "group") {
|
||||
if (items[i].type == "group" && !items[i].action) {
|
||||
//group
|
||||
buildGroup.apply(gTemplet.clone()[0], [items[i]]);
|
||||
arguments.callee(items[i].alias, items[i].items, items[i].alias); // life 传上级的alias, 避免重复
|
||||
items[i].type = "arrow";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [items[i]]);
|
||||
} else {
|
||||
//normal item
|
||||
items[i].type = "ibody";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [items[i]]);
|
||||
// 如果group有action还是可以点击的 life
|
||||
if(items[i].type == "group") {
|
||||
//group
|
||||
buildGroup.apply(gTemplet.clone()[0], [items[i]]);
|
||||
arguments.callee(items[i].alias, items[i].items, items[i].alias); // life 传上级的alias, 避免重复
|
||||
items[i].type = "arrow";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [items[i]]);
|
||||
} else {
|
||||
//normal item
|
||||
items[i].type = "ibody";
|
||||
tmp = buildItem.apply(iTemplet.clone()[0], [items[i]]);
|
||||
}
|
||||
//
|
||||
var thisItem = items[i];
|
||||
|
||||
// 点击item
|
||||
// 用闭包来存储变量
|
||||
(function(thisItem, tmp) {
|
||||
$(tmp).click(function(e) {
|
||||
|
Reference in New Issue
Block a user