From 7d4747ea1692f42b9ae007cf5da654a95c610ec3 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 23 Jun 2014 16:35:11 +0200 Subject: Fix blurring of invalid file name on rename When renaming to an existing file name, blurring the field should not remove it. This fix keeps the field until escape is pressed instead of replacing it with a broken empty space. --- apps/files/js/filelist.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index fb97b2f4595..fc08d9b54fc 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1195,9 +1195,20 @@ return true; }; + function restore() { + input.tipsy('hide'); + tr.data('renaming',false); + form.remove(); + td.children('a.name').show(); + } + form.submit(function(event) { event.stopPropagation(); event.preventDefault(); + if (input.hasClass('error')) { + return; + } + try { var newName = input.val(); input.tipsy('hide'); @@ -1267,10 +1278,7 @@ input.addClass('error'); } if (event.keyCode === 27) { - input.tipsy('hide'); - tr.data('renaming',false); - form.remove(); - td.children('a.name').show(); + restore(); } }); input.click(function(event) { -- cgit v1.2.3