diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-23 16:35:11 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-23 16:35:11 +0200 |
commit | 7d4747ea1692f42b9ae007cf5da654a95c610ec3 (patch) | |
tree | bd580d068fd479bb7ef96d3b107eefd8653e796e /apps/files/js/filelist.js | |
parent | 8c8209828126a55b9bf775e00cbc14d7ef7db5ae (diff) | |
download | nextcloud-server-7d4747ea1692f42b9ae007cf5da654a95c610ec3.tar.gz nextcloud-server-7d4747ea1692f42b9ae007cf5da654a95c610ec3.zip |
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.
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 16 |
1 files changed, 12 insertions, 4 deletions
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) { |