Merge pull request #73 from redsquirrel/fix-delete-button

Fixing the Delete button bug
pull/1/head
chriseth 9 years ago
commit 76aa02286f
  1. 8
      src/app.js
  2. 4
      src/app/editor.js
  3. 6
      src/app/renderer.js

@ -32,7 +32,7 @@ var run = function () {
}
window.localStorage[key] = content;
}
editor.setCacheFile(Object.keys(files)[0]);
editor.setCacheFile(utils.fileKey(Object.keys(files)[0]));
updateFiles();
}
@ -198,7 +198,7 @@ var run = function () {
var content = window.localStorage.getItem(utils.fileKey(originalName));
window.localStorage[utils.fileKey(newName)] = content;
window.localStorage.removeItem(utils.fileKey(originalName));
editor.setCacheFile(newName);
editor.setCacheFile(utils.fileKey(newName));
}
updateFiles();
@ -222,13 +222,13 @@ var run = function () {
function showFileHandler (ev) {
ev.preventDefault();
editor.setCacheFile($(this).find('.name').text());
editor.setCacheFile(utils.fileKey($(this).find('.name').text()));
updateFiles();
return false;
}
function activeFileTab () {
var name = editor.getCacheFile();
var name = utils.fileNameFromKey(editor.getCacheFile());
return $('#files .file').filter(function () { return $(this).find('.name').text() === name; });
}

@ -32,11 +32,11 @@ function Editor (loadingFromGist) {
};
this.setCacheFile = function (cacheFile) {
SOL_CACHE_FILE = utils.fileKey(cacheFile);
SOL_CACHE_FILE = cacheFile;
};
this.getCacheFile = function () {
return utils.fileNameFromKey(SOL_CACHE_FILE);
return SOL_CACHE_FILE;
};
this.cacheFileIsPresent = function () {

@ -19,7 +19,7 @@ function Renderer (editor, compiler, updateFiles) {
var errFile = err[1];
var errLine = parseInt(err[2], 10) - 1;
var errCol = err[4] ? parseInt(err[4], 10) : 0;
if (errFile === '' || errFile === editor.getCacheFile()) {
if (errFile === '' || errFile === utils.fileNameFromKey(editor.getCacheFile())) {
compiler.addAnnotation({
row: errLine,
column: errCol,
@ -28,9 +28,9 @@ function Renderer (editor, compiler, updateFiles) {
});
}
$error.click(function (ev) {
if (errFile !== '' && errFile !== editor.getCacheFile() && editor.hasFile(errFile)) {
if (errFile !== '' && errFile !== utils.fileNameFromKey(editor.getCacheFile()) && editor.hasFile(errFile)) {
// Switch to file
editor.setCacheFile(errFile);
editor.setCacheFile(utils.fileKey(errFile));
updateFiles();
// @TODO could show some error icon in files with errors
}

Loading…
Cancel
Save