Feature prompt before delete (#48)

* fix: file rename bug

* feat: prompt user before deleting
This commit is contained in:
Jacobtread 2024-05-01 20:40:26 +12:00 committed by GitHub
parent 6823de48a0
commit bf9ac5636c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -363,6 +363,9 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle
.setIcon("lucide-trash") .setIcon("lucide-trash")
.setDisabled(entryRunning) .setDisabled(entryRunning)
.onClick(async () => { .onClick(async () => {
if (!confirm("Are you sure you want to delete this entry?")) {
return;
}
removeEntry(tracker.entries, entry); removeEntry(tracker.entries, entry);
await saveTracker(tracker, this.app, getFile(), getSectionInfo()); await saveTracker(tracker, this.app, getFile(), getSectionInfo());
}); });