Remember the scroll position in the drive tree

pull/1/head
yflory 8 years ago
parent 5d0535966c
commit 419fb15425

@ -1793,7 +1793,11 @@ define([
module.resetTree(); module.resetTree();
// in history mode we want to focus the version number input // in history mode we want to focus the version number input
if (!history.isHistoryMode && !APP.mobile()) { $tree.find('#searchInput').focus(); } if (!history.isHistoryMode && !APP.mobile()) {
var st = $tree.scrollTop() || 0;
$tree.find('#searchInput').focus();
$tree.scrollTop(st);
}
$tree.find('#searchInput')[0].selectionStart = getSearchCursor(); $tree.find('#searchInput')[0].selectionStart = getSearchCursor();
$tree.find('#searchInput')[0].selectionEnd = getSearchCursor(); $tree.find('#searchInput')[0].selectionEnd = getSearchCursor();
@ -2080,12 +2084,14 @@ define([
}; };
module.resetTree = function () { module.resetTree = function () {
var s = $tree.scrollTop() || 0;
$tree.html(''); $tree.html('');
if (displayedCategories.indexOf(SEARCH) !== -1) { createSearch($tree); } if (displayedCategories.indexOf(SEARCH) !== -1) { createSearch($tree); }
if (displayedCategories.indexOf(ROOT) !== -1) { createTree($tree, [ROOT]); } if (displayedCategories.indexOf(ROOT) !== -1) { createTree($tree, [ROOT]); }
if (displayedCategories.indexOf(TEMPLATE) !== -1) { createTemplate($tree, [TEMPLATE]); } if (displayedCategories.indexOf(TEMPLATE) !== -1) { createTemplate($tree, [TEMPLATE]); }
if (displayedCategories.indexOf(FILES_DATA) !== -1) { createAllFiles($tree, [FILES_DATA]); } if (displayedCategories.indexOf(FILES_DATA) !== -1) { createAllFiles($tree, [FILES_DATA]); }
if (displayedCategories.indexOf(TRASH) !== -1) { createTrash($tree, [TRASH]); } if (displayedCategories.indexOf(TRASH) !== -1) { createTrash($tree, [TRASH]); }
$tree.scrollTop(s);
}; };
module.hideMenu = function () { module.hideMenu = function () {

Loading…
Cancel
Save