From 3a2dd5e0a89afd6574031d4ec5a7ea3b229b5baa Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 12 Jun 2019 15:46:42 +0200 Subject: [PATCH] Renaming current folder now keep current folder opened --- www/drive/inner.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/www/drive/inner.js b/www/drive/inner.js index ae1d8350f..9ffdfc955 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -774,7 +774,16 @@ define([ e.stopPropagation(); if (e.which === 13) { 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; } if (e.which === 27) { @@ -1610,7 +1619,7 @@ define([ } return title; }; */ - + var drivePathOverflowing = function () { var $container = $(".cp-app-drive-path"); if ($container.length) { @@ -1695,7 +1704,7 @@ define([ var $inner = $('
', {'class': 'cp-app-drive-path-inner'}); $container.prepend($inner); - + var skipNext = false; // When encountering a shared folder, skip a key in the path path.forEach(function (p, idx) { if (skipNext) { skipNext = false; return; } @@ -1737,11 +1746,11 @@ define([ 'class': 'cp-app-drive-path-element cp-app-drive-path-collapse' }).text(' ... '); $inner.append($spanCollapse); - + collapseDrivePath(); }; - + var createInfoBox = function (path) { var $box = $('
', {'class': 'cp-app-drive-content-info-box'}); @@ -2398,7 +2407,7 @@ define([ var roClass = typeof(ro) === 'undefined' ? ' cp-app-drive-element-noreadonly' : ro ? ' cp-app-drive-element-readonly' : ''; var $element = $('
  • ', { - '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 () { openFile(id);