Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/lib/openFolder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fsOperation from "fileSystem";

Check failure on line 1 in src/lib/openFolder.js

View workflow job for this annotation

GitHub Actions / Linting and formatting

format

File content differs from formatting output
import sidebarApps from "sidebarApps";
import collapsableList from "components/collapsableList";
import FileTree from "components/fileTree";
Expand Down Expand Up @@ -579,13 +579,15 @@
async function deleteFile() {
const msg = strings["delete entry"].replace("{name}", name);
const confirmation = await confirm(strings.warning, msg);
let $parent;
if (!confirmation) return;
startLoading();
if (!(await fsOperation(url).exists())) return;
// await fsOperation(url).delete();
recents.removeFile(url);
if (helpers.isFile(type)) {
await fsOperation(url).delete();
$parent = $target.parentElement;
$target.remove();
const file = editorManager.getFile(url, "uri");
if (file) file.uri = null;
Expand Down Expand Up @@ -617,13 +619,15 @@
}
recents.removeFolder(url);
helpers.updateUriOfAllActiveFiles(url, null);
$parent = $target.parentElement?.parentElement;
$target.parentElement.remove();
editorManager.onupdate("delete-folder");
editorManager.emit("update", "delete-folder");
}

toast(strings.success);
FileList.remove(url);
await removeEntryFromFileTree(url, $parent);
}

async function renameFile() {
Expand Down Expand Up @@ -1055,6 +1059,14 @@
);
}

async function removeEntryFromFileTree(url, $parent){
const fileTree = $parent?._fileTree;
if (fileTree) {
await fileTree.removeEntry(url);
return;
}
}

/**
* Create a folder tile
* @param {string} name
Expand Down
Loading