feat: impl permanent delete in multi select trash

This commit is contained in:
thecodrr
2020-04-21 13:03:25 +05:00
parent 78f0d6e0ce
commit deaecda502

View File

@@ -31,6 +31,7 @@ const DeleteOption = createOption("deleteOption", Icon.Trash, async function (
)
return;
const item = state.selectedItems[0];
var isAnyNoteOpened = false;
const items = state.selectedItems.map((item) => {
if (item.id === editorStore.get().session.id) isAnyNoteOpened = true;
@@ -38,6 +39,13 @@ const DeleteOption = createOption("deleteOption", Icon.Trash, async function (
return item.id;
});
if (item.dateDeleted) {
// we are in trash
await db.trash.delete(...items);
trashStore.refresh();
return;
}
if (isAnyNoteOpened) {
editorStore.newSession();
}