|
|
@ -132,22 +132,24 @@ THE SOFTWARE. |
|
|
|
$filesEl.on( 'click','.file:not(.active)', showFileHandler ) |
|
|
|
$filesEl.on( 'click','.file:not(.active)', showFileHandler ) |
|
|
|
|
|
|
|
|
|
|
|
$filesEl.on( 'click','.file.active', function(ev){ |
|
|
|
$filesEl.on( 'click','.file.active', function(ev){ |
|
|
|
var $fileTabEl = $(this) |
|
|
|
var $fileTabEl = $(this); |
|
|
|
var originalName = $fileTabEl.find('.name').text() |
|
|
|
var originalName = $fileTabEl.find('.name').text(); |
|
|
|
ev.preventDefault() |
|
|
|
ev.preventDefault(); |
|
|
|
if ($(this).find('input').length > 0 ) return false; |
|
|
|
if ($(this).find('input').length > 0 ) return false; |
|
|
|
var $fileNameInputEl = $('<input value="'+originalName+'"/>'); |
|
|
|
var $fileNameInputEl = $('<input value="'+originalName+'"/>'); |
|
|
|
$fileTabEl.html( $fileNameInputEl ) |
|
|
|
$fileTabEl.html( $fileNameInputEl ); |
|
|
|
$fileNameInputEl.focus() |
|
|
|
$fileNameInputEl.focus(); |
|
|
|
$fileNameInputEl.select() |
|
|
|
$fileNameInputEl.select(); |
|
|
|
$fileNameInputEl.on( 'blur', handleRename ) |
|
|
|
$fileNameInputEl.on( 'blur', handleRename ); |
|
|
|
$fileNameInputEl.keyup( handleRename ); |
|
|
|
$fileNameInputEl.keyup( handleRename ); |
|
|
|
|
|
|
|
|
|
|
|
function handleRename (ev) { |
|
|
|
function handleRename (ev) { |
|
|
|
ev.preventDefault() |
|
|
|
ev.preventDefault(); |
|
|
|
if (ev.which && ev.which !== 13) return false; |
|
|
|
if (ev.which && ev.which !== 13) return false; |
|
|
|
var newName = ev.target.value; |
|
|
|
var newName = ev.target.value; |
|
|
|
var $new = null |
|
|
|
$fileNameInputEl.off('blur'); |
|
|
|
|
|
|
|
$fileNameInputEl.off('keyup'); |
|
|
|
|
|
|
|
|
|
|
|
if ( newName !== originalName && confirm( "Are you sure you want to rename: " + originalName + " to " + newName + '?' )) { |
|
|
|
if ( newName !== originalName && confirm( "Are you sure you want to rename: " + originalName + " to " + newName + '?' )) { |
|
|
|
|
|
|
|
|
|
|
|
solFiles.splice( solFiles.indexOf(originalName), 1, newName ); |
|
|
|
solFiles.splice( solFiles.indexOf(originalName), 1, newName ); |
|
|
|