Fixes false file-exists error message on file renaming

pull/1/head
holgerd77 7 years ago
parent 70c7710b56
commit 74b0ff2d3e
  1. 7
      src/app/files/file-explorer.js

@ -128,6 +128,7 @@ function fileExplorer (appAPI, files) {
var filepath = null var filepath = null
var focusElement = null var focusElement = null
var textUnderEdit = null var textUnderEdit = null
var textInRename = false
var events = new EventManager() var events = new EventManager()
this.events = events this.events = events
@ -243,14 +244,16 @@ function fileExplorer (appAPI, files) {
} }
if (event.which === 13) event.preventDefault() 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 isFolder = label.className.indexOf('folder') !== -1
var save = textUnderEdit !== label.innerText var save = textUnderEdit !== label.innerText
if (save && event.which !== 13) { if (save) {
modalDialogCustom.confirm(null, `Do you want to rename?`, () => { rename() }, () => { cancelRename() }) modalDialogCustom.confirm(null, `Do you want to rename?`, () => { rename() }, () => { cancelRename() })
} }
label.removeAttribute('contenteditable') label.removeAttribute('contenteditable')
label.classList.remove(css.rename) label.classList.remove(css.rename)
textInRename = false
} }
} }

Loading…
Cancel
Save