mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
fix delete and restore note
This commit is contained in:
@@ -137,6 +137,9 @@ export const ActionSheetComponent = ({
|
|||||||
|
|
||||||
if (!nodispatch) {
|
if (!nodispatch) {
|
||||||
dispatch({type: type});
|
dispatch({type: type});
|
||||||
|
if (type === "note") {
|
||||||
|
eSendEvent(refreshNotesPage)
|
||||||
|
}
|
||||||
dispatch({type: Actions.FAVORITES});
|
dispatch({type: Actions.FAVORITES});
|
||||||
}
|
}
|
||||||
setNote({...toAdd});
|
setNote({...toAdd});
|
||||||
@@ -234,8 +237,11 @@ export const ActionSheetComponent = ({
|
|||||||
name: 'Restore',
|
name: 'Restore',
|
||||||
icon: 'delete-restore',
|
icon: 'delete-restore',
|
||||||
func: async () => {
|
func: async () => {
|
||||||
|
await db.trash.restore(note.id);
|
||||||
dispatch({type: Actions.TRASH});
|
dispatch({type: Actions.TRASH});
|
||||||
localRefresh(note.type);
|
dispatch({type: note.itemType});
|
||||||
|
dispatch({type: Actions.FAVORITES});
|
||||||
|
eSendEvent(refreshNotesPage)
|
||||||
ToastEvent.show(
|
ToastEvent.show(
|
||||||
item.type === 'note' ? 'Note restored' : 'Notebook restored',
|
item.type === 'note' ? 'Note restored' : 'Notebook restored',
|
||||||
'success',
|
'success',
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export async function deleteItems(item) {
|
|||||||
if (history.selectedItemsList[0].type !== 'topic') {
|
if (history.selectedItemsList[0].type !== 'topic') {
|
||||||
ToastEvent.show(
|
ToastEvent.show(
|
||||||
message,
|
message,
|
||||||
'success',
|
'error',
|
||||||
'global',
|
'global',
|
||||||
6000,
|
6000,
|
||||||
async () => {
|
async () => {
|
||||||
@@ -53,6 +53,7 @@ export async function deleteItems(item) {
|
|||||||
'Undo',
|
'Undo',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
updateEvent({type: Actions.TRASH});
|
||||||
updateEvent({type: Actions.CLEAR_SELECTION});
|
updateEvent({type: Actions.CLEAR_SELECTION});
|
||||||
updateEvent({type: Actions.SELECTION_MODE, enabled: false});
|
updateEvent({type: Actions.SELECTION_MODE, enabled: false});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user