Skip to content
Closed
Changes from 6 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
26 changes: 26 additions & 0 deletions src/lib/openFolder.js
Original file line number Diff line number Diff line change
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,28 @@
);
}

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

await Promise.all(
Array.from($els).map(async ($el) => {
if (!(helpers.isDir($el.dataset.type) || $el.dataset.type === "root")) {
return;
}

const fileTree = getLoadedFileTree($el);
if (fileTree) {
await fileTree.removeEntry(url);
}
}),
);
}

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

View workflow job for this annotation

GitHub Actions / Linting and formatting

parse

Expected a statement but instead found '}'.

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

View workflow job for this annotation

GitHub Actions / Linting and formatting

parse

Expected a statement but instead found '}'.
Comment thread
UnschooledGamer marked this conversation as resolved.
Outdated

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