mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
Merge pull request #8977 from streetwriters/web/archive-drag-drop
web: allow archiving when notes drag-n-dropped on nav item
This commit is contained in:
@@ -30,13 +30,18 @@ export async function handleDrop(
|
|||||||
item:
|
item:
|
||||||
| ItemReference
|
| ItemReference
|
||||||
| Context
|
| Context
|
||||||
| { type: "trash" | "notebooks" | "favorites" | undefined }
|
| { type: "trash" | "notebooks" | "favorites" | "archive" | undefined }
|
||||||
) {
|
) {
|
||||||
if (!item.type) return;
|
if (!item.type) return;
|
||||||
|
|
||||||
const noteIds = getDragData(dataTransfer, "note");
|
const noteIds = getDragData(dataTransfer, "note");
|
||||||
const notebookIds = getDragData(dataTransfer, "notebook");
|
const notebookIds = getDragData(dataTransfer, "notebook");
|
||||||
const { setColor, favorite, delete: trashNotes } = useNoteStore.getState();
|
const {
|
||||||
|
setColor,
|
||||||
|
favorite,
|
||||||
|
delete: trashNotes,
|
||||||
|
archive
|
||||||
|
} = useNoteStore.getState();
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case "notebook":
|
case "notebook":
|
||||||
if (noteIds.length > 0) {
|
if (noteIds.length > 0) {
|
||||||
@@ -83,5 +88,8 @@ export async function handleDrop(
|
|||||||
await useNoteStore.getState().refresh();
|
await useNoteStore.getState().refresh();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "archive":
|
||||||
|
archive(true, ...noteIds);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -506,6 +506,8 @@ function RouteItem({
|
|||||||
? "trash"
|
? "trash"
|
||||||
: item.path === "/favorites"
|
: item.path === "/favorites"
|
||||||
? "favorites"
|
? "favorites"
|
||||||
|
: item.path == "/archive"
|
||||||
|
? "archive"
|
||||||
: undefined
|
: undefined
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user