v2.3 Papierkorb: Bookmark-Loeschen in den Papierkorb umleiten

This commit is contained in:
2026-06-14 09:47:40 +02:00
parent 36d917b420
commit 9abfefc0e0
+10 -1
View File
@@ -254,12 +254,21 @@ function bindBoardListEvents(list, board) {
const bmItem = e.target.closest('.bm-item'); const bmItem = e.target.closest('.bm-item');
if (!bmItem) return; if (!bmItem) return;
// Delete-Button geklickt // Delete-Button geklickt: kein Confirm (wie bisher), aber nicht mehr hart loeschen —
// das Bookmark wandert in den Papierkorb (30 Tage, TRASH-01). Erst per find() greifen,
// dann mit Herkunft (originBoardId), type und Zeitstempel ins trash[] pushen.
if (e.target.closest('.bm-delete')) { if (e.target.closest('.bm-delete')) {
e.stopPropagation(); e.stopPropagation();
const bmId = bmItem.dataset.bmId; const bmId = bmItem.dataset.bmId;
const removed = board.bookmarks.find(b => b.id === bmId);
if (removed) {
// Datensicherheit: ZUERST den Trash-Klon persistieren, DANN die Loeschung committen.
// Falls saveTrash() (Quota) rejectet, ist das Original noch in boards[] -> kein Verlust.
pushToTrash({ item: removed, type: 'bookmark', originBoardId: board.id });
await saveTrash();
board.bookmarks = board.bookmarks.filter(b => b.id !== bmId); board.bookmarks = board.bookmarks.filter(b => b.id !== bmId);
await saveBoards(); await saveBoards();
}
renderBoards(); renderBoards();
return; return;
} }