mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-26 10:49:17 +00:00
delete files changes selector, delete current file reloads
This commit is contained in:
parent
95feff49da
commit
8c7981b8d0
22
src/ui.ts
22
src/ui.ts
@ -101,6 +101,13 @@ function setLastPreset(id:string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unsetLastPreset() {
|
||||||
|
if (hasLocalStorage) {
|
||||||
|
delete qs['file'];
|
||||||
|
localStorage.removeItem("__lastid_"+platform_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initProject() {
|
function initProject() {
|
||||||
current_project = new CodeProject(newWorker(), platform_id, platform, store);
|
current_project = new CodeProject(newWorker(), platform_id, platform, store);
|
||||||
projectWindows = new ProjectWindows($("#workspace")[0] as HTMLElement, current_project);
|
projectWindows = new ProjectWindows($("#workspace")[0] as HTMLElement, current_project);
|
||||||
@ -337,8 +344,9 @@ function handleFileUpload(files: File[]) {
|
|||||||
alert("Error uploading " + path + ": " + err);
|
alert("Error uploading " + path + ": " + err);
|
||||||
else {
|
else {
|
||||||
console.log("Uploaded " + path + " " + data.length + " bytes");
|
console.log("Uploaded " + path + " " + data.length + " bytes");
|
||||||
if (index == 1)
|
if (index == 1) {
|
||||||
qs['file'] = path; // TODO?
|
qs['file'] = path; // TODO?
|
||||||
|
}
|
||||||
uploadNextFile();
|
uploadNextFile();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -494,10 +502,14 @@ function _deleteFile(e) {
|
|||||||
if (fn.startsWith("local/")) {
|
if (fn.startsWith("local/")) {
|
||||||
if (confirm("Delete '" + fn + "'?")) {
|
if (confirm("Delete '" + fn + "'?")) {
|
||||||
store.removeItem(fn, () => {
|
store.removeItem(fn, () => {
|
||||||
alert("Deleted " + fn);
|
// if we delete what is selected
|
||||||
updateSelector();
|
if (qs['file'] == fn) {
|
||||||
// TODO: rebuild?
|
unsetLastPreset();
|
||||||
//gotoNewLocation();
|
gotoNewLocation();
|
||||||
|
} else {
|
||||||
|
updateSelector();
|
||||||
|
alert("Deleted " + fn);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user