Commit 4698cc12 authored by d11e9's avatar d11e9

fix removal bug and focus editor on tab change

parent 374305df
...@@ -161,8 +161,8 @@ THE SOFTWARE. ...@@ -161,8 +161,8 @@ THE SOFTWARE.
var index = getFiles().indexOf( fileKey(name) ); var index = getFiles().indexOf( fileKey(name) );
if (confirm("Are you sure you want to remove: " + name + " from local storage?")) { if (confirm("Are you sure you want to remove: " + name + " from local storage?")) {
SOL_CACHE_FILE = getFiles()[ Math.max(0, index - 1)];
window.localStorage.removeItem( fileKey( name ) ); window.localStorage.removeItem( fileKey( name ) );
SOL_CACHE_FILE = getFiles()[ Math.max(0, index - 1)];
updateFiles(); updateFiles();
} }
return false; return false;
...@@ -187,10 +187,16 @@ THE SOFTWARE. ...@@ -187,10 +187,16 @@ THE SOFTWARE.
for (var f in files) { for (var f in files) {
$filesEl.append(fileTabTemplate(files[f])); $filesEl.append(fileTabTemplate(files[f]));
} }
if (SOL_CACHE_FILE) {
var active = fileTabFromKey(SOL_CACHE_FILE); var active = fileTabFromKey(SOL_CACHE_FILE);
active.addClass('active'); active.addClass('active');
editor.setValue( window.localStorage[SOL_CACHE_FILE] || '', -1); editor.setValue( window.localStorage[SOL_CACHE_FILE] || '', -1);
editor.focus();
$('#input').toggle( true ); $('#input').toggle( true );
} else {
$('#input').toggle( false );
}
} }
function fileTabTemplate(key) { function fileTabTemplate(key) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment