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