Renaming current folder now keep current folder opened

pull/1/head
ClemDee 6 years ago
parent 8a9f60e477
commit 3a2dd5e0a8

@ -774,7 +774,16 @@ define([
e.stopPropagation(); e.stopPropagation();
if (e.which === 13) { if (e.which === 13) {
removeInput(true); removeInput(true);
manager.rename(path, $input.val(), refresh); if (JSON.stringify(path) === JSON.stringify(currentPath)) {
var newName = $input.val();
manager.rename(path, $input.val(), function () {
path[path.length - 1] = newName;
APP.displayDirectory(path);
});
}
else {
manager.rename(path, $input.val(), refresh);
}
return; return;
} }
if (e.which === 27) { if (e.which === 27) {
@ -1610,7 +1619,7 @@ define([
} }
return title; return title;
}; */ }; */
var drivePathOverflowing = function () { var drivePathOverflowing = function () {
var $container = $(".cp-app-drive-path"); var $container = $(".cp-app-drive-path");
if ($container.length) { if ($container.length) {
@ -1695,7 +1704,7 @@ define([
var $inner = $('<div>', {'class': 'cp-app-drive-path-inner'}); var $inner = $('<div>', {'class': 'cp-app-drive-path-inner'});
$container.prepend($inner); $container.prepend($inner);
var skipNext = false; // When encountering a shared folder, skip a key in the path var skipNext = false; // When encountering a shared folder, skip a key in the path
path.forEach(function (p, idx) { path.forEach(function (p, idx) {
if (skipNext) { skipNext = false; return; } if (skipNext) { skipNext = false; return; }
@ -1737,11 +1746,11 @@ define([
'class': 'cp-app-drive-path-element cp-app-drive-path-collapse' 'class': 'cp-app-drive-path-element cp-app-drive-path-collapse'
}).text(' ... '); }).text(' ... ');
$inner.append($spanCollapse); $inner.append($spanCollapse);
collapseDrivePath(); collapseDrivePath();
}; };
var createInfoBox = function (path) { var createInfoBox = function (path) {
var $box = $('<div>', {'class': 'cp-app-drive-content-info-box'}); var $box = $('<div>', {'class': 'cp-app-drive-content-info-box'});
@ -2398,7 +2407,7 @@ define([
var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' : var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' :
ro ? ' cp-app-drive-element-readonly' : ''; ro ? ' cp-app-drive-element-readonly' : '';
var $element = $('<li>', { var $element = $('<li>', {
'class': 'cp-app-drive-element cp-app-drive-element-row' + roClass 'class': 'cp-app-drive-element cp-app-drive-element-row' + roClass
}); });
$element.prepend($icon).dblclick(function () { $element.prepend($icon).dblclick(function () {
openFile(id); openFile(id);

Loading…
Cancel
Save