listen to <enter> key on rename

pull/1/head
d11e9 9 years ago
parent a939f78bc0
commit bfbbcf0c36
  1. 10
      index.html

@ -128,9 +128,12 @@ THE SOFTWARE.
var $fileNameInputEl = $('<input value="'+originalName+'"/>');
$fileTabEl.html( $fileNameInputEl )
$fileNameInputEl.focus()
$fileNameInputEl.on( 'blur', handleRename )
$fileNameInputEl.keyup( handleRename );
$fileNameInputEl.on( 'blur', function(ev){
function handleRename (ev) {
ev.preventDefault()
if (ev.which && ev.which !== 13) return false;
var newName = ev.target.value;
var $new = null
if ( newName !== originalName && confirm( "Are you sure you want to rename: " + originalName + " to " + newName + '?' )) {
@ -144,7 +147,8 @@ THE SOFTWARE.
updateFiles()
return false;
})
}
return false;
})
@ -161,7 +165,7 @@ THE SOFTWARE.
updateFiles()
}
return false;
})
});
function showFileHandler (ev) {
ev.preventDefault()

Loading…
Cancel
Save