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 {
color: #999;
text-shadow: 0 0 0 !important;
}
.frame li:hover,
@ -303,7 +304,7 @@
.bottom-window-group .output .test-error,
.bottom-window-group .output .install-error,
.bottom-window-group .output .get-error {
color: #eb0000;
color: #9d0000;
}
.bottom-window-group table {
@ -364,7 +365,7 @@
float: right;
display: none;
cursor: pointer;
background-color: #eb0000;
background-color: #9d0000;
color: #FFF;
margin: 1px 5px;
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;
}
if (wide.curNode.iconSkin === "ico-ztree-dir ") { // 选中节点是目录
if (tree.isDir()) { // 选中节点是目录
// 不做任何处理
return false;
}
@ -130,7 +130,7 @@ var hotkeys = {
}
var preNode = wide.curNode.getPreNode();
if (preNode && preNode.iconSkin === "ico-ztree-dir "
if (preNode && tree.isDir()
&& preNode.open) {
// 当前节点的上一个节点是目录且打开时,获取打开节点中的最后一个节点
node = tree.getCurrentNodeLastNode(preNode);
@ -153,7 +153,7 @@ var hotkeys = {
}
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];
}
@ -181,7 +181,7 @@ var hotkeys = {
return false;
}
if (wide.curNode.iconSkin !== "ico-ztree-dir " || !wide.curNode.open) {
if (!tree.isDir() || !wide.curNode.open) {
return false;
}
@ -196,7 +196,7 @@ var hotkeys = {
return false;
}
if (wide.curNode.iconSkin !== "ico-ztree-dir " || wide.curNode.open) {
if (!tree.isDir() || wide.curNode.open) {
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 () {
$("#dirRMenu").hide();
$("#dialogNewFilePrompt").dialog("open");
@ -81,7 +87,18 @@ var tree = {
$("#dirRMenu").hide();
$("#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();
$("#fileRMenu").hide();
$("#dialogRemoveConfirm").dialog("open");
@ -123,15 +140,22 @@ var tree = {
wide.curNode = treeNode;
tree.fileTree.selectNode(treeNode);
if ("ico-ztree-dir " !== treeNode.iconSkin) { // 如果右击了文件
$("#fileRMenu ul").show();
if (!tree.isDir()) { // 如果右击了文件
$("#fileRMenu").show();
fileRMenu.css({
"top": event.clientY - 10 + "px",
"left": event.clientX + "px",
"display": "block"
});
} 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({
"top": event.clientY - 10 + "px",
"left": event.clientX + "px",
@ -171,7 +195,7 @@ var tree = {
}
}
if ("ico-ztree-dir " !== treeNode.iconSkin) { // 如果单击了文件
if (!tree.isDir()) { // 如果单击了文件
var request = newWideRequest();
request.path = treeNode.path;

View File

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

View File

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