From 3846bb422c8a66895b2802a40920634f24d26092 Mon Sep 17 00:00:00 2001 From: Thomas <27960254+thomiceli@users.noreply.github.com> Date: Sat, 27 Jun 2026 23:50:08 +0700 Subject: [PATCH] Add confirmation prompt before deleting a file in editor (#740) --- public/ts/editor.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/ts/editor.ts b/public/ts/editor.ts index 5660a6d..862e142 100644 --- a/public/ts/editor.ts +++ b/public/ts/editor.ts @@ -117,6 +117,7 @@ document.addEventListener("DOMContentLoaded", () => { let deleteBtns = dom.querySelector("button.delete-file"); if (deleteBtns !== null) { deleteBtns.onclick = () => { + if (!confirm("Are you sure you want to delete this file?")) return; // For both text and binary files, just remove from DOM if (!dom.hasAttribute('data-binary-original-name')) { // Only remove from editors array for text files @@ -209,6 +210,7 @@ document.addEventListener("DOMContentLoaded", () => { let deleteBtn = el.querySelector("button.delete-file"); if (deleteBtn) { deleteBtn.onclick = () => { + if (!confirm("Are you sure you want to delete this file?")) return; el.remove(); checkForFirstDeleteButton(); };