bug fixed

This commit is contained in:
Van 2014-11-06 15:47:05 +08:00
parent 6b4dcbbb5a
commit 6ae2ce8960
6 changed files with 40 additions and 15 deletions

View File

@ -83,6 +83,7 @@
.frame li.disabled { .frame li.disabled {
color: #999; color: #999;
text-shadow: 0 0 0 !important;
} }
.frame li:hover, .frame li:hover,
@ -303,7 +304,7 @@
.bottom-window-group .output .test-error, .bottom-window-group .output .test-error,
.bottom-window-group .output .install-error, .bottom-window-group .output .install-error,
.bottom-window-group .output .get-error { .bottom-window-group .output .get-error {
color: #eb0000; color: #9d0000;
} }
.bottom-window-group table { .bottom-window-group table {
@ -364,7 +365,7 @@
float: right; float: right;
display: none; display: none;
cursor: pointer; cursor: pointer;
background-color: #eb0000; background-color: #9d0000;
color: #FFF; color: #FFF;
margin: 1px 5px; margin: 1px 5px;
padding: 0 2px; padding: 0 2px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -103,7 +103,7 @@ var hotkeys = {
return false; return false;
} }
if (wide.curNode.iconSkin === "ico-ztree-dir ") { // 选中节点是目录 if (tree.isDir()) { // 选中节点是目录
// 不做任何处理 // 不做任何处理
return false; return false;
} }
@ -130,7 +130,7 @@ var hotkeys = {
} }
var preNode = wide.curNode.getPreNode(); var preNode = wide.curNode.getPreNode();
if (preNode && preNode.iconSkin === "ico-ztree-dir " if (preNode && tree.isDir()
&& preNode.open) { && preNode.open) {
// 当前节点的上一个节点是目录且打开时,获取打开节点中的最后一个节点 // 当前节点的上一个节点是目录且打开时,获取打开节点中的最后一个节点
node = tree.getCurrentNodeLastNode(preNode); node = tree.getCurrentNodeLastNode(preNode);
@ -153,7 +153,7 @@ var hotkeys = {
} }
node = wide.curNode.getNextNode(); node = wide.curNode.getNextNode();
if (wide.curNode.iconSkin === "ico-ztree-dir " && wide.curNode.open) { if (tree.isDir() && wide.curNode.open) {
// 当前节点是目录且打开时 // 当前节点是目录且打开时
node = wide.curNode.children[0]; node = wide.curNode.children[0];
} }
@ -181,7 +181,7 @@ var hotkeys = {
return false; return false;
} }
if (wide.curNode.iconSkin !== "ico-ztree-dir " || !wide.curNode.open) { if (!tree.isDir() || !wide.curNode.open) {
return false; return false;
} }
@ -196,7 +196,7 @@ var hotkeys = {
return false; return false;
} }
if (wide.curNode.iconSkin !== "ico-ztree-dir " || wide.curNode.open) { if (!tree.isDir() || wide.curNode.open) {
return false; return false;
} }

View File

@ -73,6 +73,12 @@ var tree = {
} }
} }
}, },
isDir: function () {
if (wide.curNode.iconSkin.indexOf("ico-ztree-dir") === 0) {
return true;
}
return false;
},
newFile: function () { newFile: function () {
$("#dirRMenu").hide(); $("#dirRMenu").hide();
$("#dialogNewFilePrompt").dialog("open"); $("#dialogNewFilePrompt").dialog("open");
@ -81,7 +87,18 @@ var tree = {
$("#dirRMenu").hide(); $("#dirRMenu").hide();
$("#dialogNewDirPrompt").dialog("open"); $("#dialogNewDirPrompt").dialog("open");
}, },
removeIt: function () { removeIt: function (it) {
if (it) {
if ($(it).hasClass("disabled")) {
return false;
}
} else {
// 直接调用时,如果为 api 及其子目录或者 workspace 则不能进行删除
if (wide.curNode.iconSkin === 'ico-ztree-dir-workspace ') {
return false;
}
}
$("#dirRMenu").hide(); $("#dirRMenu").hide();
$("#fileRMenu").hide(); $("#fileRMenu").hide();
$("#dialogRemoveConfirm").dialog("open"); $("#dialogRemoveConfirm").dialog("open");
@ -123,15 +140,22 @@ var tree = {
wide.curNode = treeNode; wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode); tree.fileTree.selectNode(treeNode);
if ("ico-ztree-dir " !== treeNode.iconSkin) { // 如果右击了文件 if (!tree.isDir()) { // 如果右击了文件
$("#fileRMenu ul").show(); $("#fileRMenu").show();
fileRMenu.css({ fileRMenu.css({
"top": event.clientY - 10 + "px", "top": event.clientY - 10 + "px",
"left": event.clientX + "px", "left": event.clientX + "px",
"display": "block" "display": "block"
}); });
} else { // 右击了目录 } else { // 右击了目录
$("#dirRMenu ul").show(); if (wide.curNode.iconSkin === "ico-ztree-dir-workspace ") {
$("#dirRMenu .remove").addClass("disabled");
} else {
$("#dirRMenu .remove").removeClass("disabled");
}
$("#dirRMenu").show();
dirRMenu.css({ dirRMenu.css({
"top": event.clientY - 10 + "px", "top": event.clientY - 10 + "px",
"left": event.clientX + "px", "left": event.clientX + "px",
@ -171,7 +195,7 @@ var tree = {
} }
} }
if ("ico-ztree-dir " !== treeNode.iconSkin) { // 如果单击了文件 if (!tree.isDir()) { // 如果单击了文件
var request = newWideRequest(); var request = newWideRequest();
request.path = treeNode.path; request.path = treeNode.path;

View File

@ -56,7 +56,7 @@ var wide = {
$("#dialogRemoveConfirm").dialog("close"); $("#dialogRemoveConfirm").dialog("close");
tree.fileTree.removeNode(wide.curNode); tree.fileTree.removeNode(wide.curNode);
if ("ico-ztree-dir " !== wide.curNode.iconSkin) { if (!tree.isDir()) {
// 是文件的话,查看 editor 中是否被打开,如打开则移除 // 是文件的话,查看 editor 中是否被打开,如打开则移除
for (var i = 0, ii = editors.data.length; i < ii; i++) { for (var i = 0, ii = editors.data.length; i < ii; i++) {
if (editors.data[i].id === wide.curNode.tId) { if (editors.data[i].id === wide.curNode.tId) {

View File

@ -133,14 +133,14 @@
<ul> <ul>
<li onclick="tree.newFile();">{{.i18n.create_file}}</li> <li onclick="tree.newFile();">{{.i18n.create_file}}</li>
<li onclick="tree.newDir();">{{.i18n.create_dir}}</li> <li onclick="tree.newDir();">{{.i18n.create_dir}}</li>
<li onclick="tree.removeIt();">{{.i18n.delete}}</li> <li class="remove" onclick="tree.removeIt(this);">{{.i18n.delete}}</li>
</ul> </ul>
</div> </div>
<!-- 文件右键菜单 --> <!-- 文件右键菜单 -->
<div id="fileRMenu" class="frame"> <div id="fileRMenu" class="frame">
<ul> <ul>
<li onclick="tree.removeIt();">{{.i18n.delete}}</li> <li onclick="tree.removeIt(this);">{{.i18n.delete}}</li>
</ul> </ul>
</div> </div>
</div> </div>