v2.3 Papierkorb: Bookmark-Loeschen in den Papierkorb umleiten
This commit is contained in:
+12
-3
@@ -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;
|
||||||
board.bookmarks = board.bookmarks.filter(b => b.id !== bmId);
|
const removed = board.bookmarks.find(b => b.id === bmId);
|
||||||
await saveBoards();
|
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);
|
||||||
|
await saveBoards();
|
||||||
|
}
|
||||||
renderBoards();
|
renderBoards();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user