From 424dc3d82cb6ef71d0101cd25313d1b765d06acf Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 17 Oct 2014 04:18:13 -0400 Subject: [PATCH] fix(dom) changePanel: after copy/move on tab, panel changed to ".." --- lib/client/dom.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 6cb6ded0..e2b57a9f 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -698,9 +698,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; /** * get current file by name */ - this.getCurrentByName = function(name) { + this.getCurrentByName = function(name, panelParam) { var element, - panel = CurrentInfo.panel; + panel = panelParam || CurrentInfo.panel; name = 'js-file-' + name; element = DOM.getByDataName(name, panel); @@ -1686,7 +1686,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; }; this.changePanel = function() { - var id, files, + var id, files, name, Info = CurrentInfo, current = Info.element, panel = Info.panel, @@ -1703,8 +1703,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (current) files = current.parentElement; - if (!files || !files.parentElement) - current = filesPassive[0]; + if (!files || !files.parentElement) { + name = DOM.getCurrentName(current); + current = DOM.getCurrentByName(name, panel); + + if (!current) + current = filesPassive[0]; + } DOM.setCurrentFile(current, { history: true