树节点 bug 修改

This commit is contained in:
Van 2014-09-25 11:35:28 +08:00
parent dbf3b37741
commit 6f960c3760
3 changed files with 24 additions and 24 deletions

View File

@ -25,9 +25,10 @@
"Files": [
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\1123",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\time\\main.go",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\2.json"
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\2.json",
"E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go"
],
"CurrentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\1123"
"CurrentFile": "E:\\Work\\go\\src\\github.com\\b3log\\wide\\data\\user_workspaces\\admin\\src\\mytest\\hello\\main.go"
}
}
]

View File

@ -58,8 +58,9 @@ var hotkeys = {
}
},
_bindFileTree: function () {
// TODO: 滚动处理
$("#files").keydown(function (event) {
event.preventDefault();
switch (event.which) {
case 46: // 删除
tree.removeIt();
@ -132,8 +133,11 @@ var hotkeys = {
}
}
if (node) {
wide.curNode = node;
tree.fileTree.selectNode(node);
}
$("#files").focus();
break;
case 37: // 左
@ -168,8 +172,6 @@ var hotkeys = {
break;
}
event.preventDefault();
});
},
init: function () {

View File

@ -136,7 +136,8 @@ var tree = {
});
},
_onClick: function (treeNode) {
if (wide.curNode) {
wide.curNode = treeNode;
for (var i = 0, ii = editors.data.length; i < ii; i++) {
// 该节点文件已经打开
if (editors.data[i].id === treeNode.tId) {
@ -147,7 +148,6 @@ var tree = {
return false;
}
}
}
if ("ico-ztree-dir " !== treeNode.iconSkin) { // 如果单击了文件
var request = newWideRequest();
@ -166,12 +166,9 @@ var tree = {
return false;
}
wide.curNode = treeNode;
if ("img" === data.mode) { // 是图片文件的话新建 tab 打开
// 最好是开 tab但这个最终取决于浏览器设置
var w = window.open(data.path);
return false;
}