From 74b0ff2d3ed0d795fbbdf8be57a8e4a1a79a02b6 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Fri, 29 Sep 2017 14:57:25 +0200 Subject: [PATCH] Fixes false file-exists error message on file renaming --- src/app/files/file-explorer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/files/file-explorer.js b/src/app/files/file-explorer.js index 174965c103..28da9ceca8 100755 --- a/src/app/files/file-explorer.js +++ b/src/app/files/file-explorer.js @@ -128,6 +128,7 @@ function fileExplorer (appAPI, files) { var filepath = null var focusElement = null var textUnderEdit = null + var textInRename = false var events = new EventManager() this.events = events @@ -243,14 +244,16 @@ function fileExplorer (appAPI, files) { } if (event.which === 13) event.preventDefault() - if ((event.type === 'blur' || event.which === 27 || event.which === 13) && label.getAttribute('contenteditable')) { + if (!textInRename && (event.type === 'blur' || event.which === 27 || event.which === 13) && label.getAttribute('contenteditable')) { + textInRename = true var isFolder = label.className.indexOf('folder') !== -1 var save = textUnderEdit !== label.innerText - if (save && event.which !== 13) { + if (save) { modalDialogCustom.confirm(null, `Do you want to rename?`, () => { rename() }, () => { cancelRename() }) } label.removeAttribute('contenteditable') label.classList.remove(css.rename) + textInRename = false } }