From f0f275133cdaf95ac92c75691564d90455446eae Mon Sep 17 00:00:00 2001 From: Van Date: Thu, 9 Oct 2014 15:48:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=8F=98=E6=A0=91=E7=82=B9=E5=87=BB?= =?UTF-8?q?=EF=BC=8C=E5=8F=8C=E5=87=BB=EF=BC=8C=E5=8F=B3=E5=87=BB=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/hotkeys.js | 2 +- static/js/session.js | 2 +- static/js/tree.js | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/static/js/hotkeys.js b/static/js/hotkeys.js index 0b11b4c..13497bc 100644 --- a/static/js/hotkeys.js +++ b/static/js/hotkeys.js @@ -76,7 +76,7 @@ var hotkeys = { } // 模拟点击:打开文件 - tree._onClick(wide.curNode); + tree.openFile(wide.curNode); break; case 38: // 上 diff --git a/static/js/session.js b/static/js/session.js index 6fc0b17..4c9ea64 100644 --- a/static/js/session.js +++ b/static/js/session.js @@ -70,7 +70,7 @@ var session = { for (var m = 0, mm = files.length; m < mm; m++) { for (var n = 0, nn = nodesToOpen.length; n < nn; n++) { if (nodesToOpen[n].path === files[m]) { - tree._onClick(nodesToOpen[n]); + tree.openFile(nodesToOpen[n]); break; } } diff --git a/static/js/tree.js b/static/js/tree.js index 2dec82a..f9b4618 100644 --- a/static/js/tree.js +++ b/static/js/tree.js @@ -103,9 +103,16 @@ var tree = { selectedMulti: false }, callback: { + onDblClick: function (event, treeId, treeNode) { + if (treeNode) { + tree._openFile(treeNode); + } + }, onRightClick: function (event, treeId, treeNode) { if (treeNode) { wide.curNode = treeNode; + tree.fileTree.selectNode(treeNode); + if ("ico-ztree-dir " !== treeNode.iconSkin) { // 如果右击了文件 $("#fileRMenu ul").show(); fileRMenu.css({ @@ -121,10 +128,15 @@ var tree = { "display": "block" }); } + $("#files").focus(); } }, onClick: function (event, treeId, treeNode, clickFlag) { - tree._onClick(treeNode); + if (treeNode) { + wide.curNode = treeNode; + tree.fileTree.selectNode(treeNode); + $("#files").focus(); + } } } }; @@ -135,7 +147,7 @@ var tree = { } }); }, - _onClick: function (treeNode) { + openFile: function (treeNode) { wide.curNode = treeNode; for (var i = 0, ii = editors.data.length; i < ii; i++) {