1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-06 23:56:13 +02:00

Mobile: Resolves #10763: Support permanent note deletion on mobile (#10786)

This commit is contained in:
Henry Heino
2024-09-21 05:05:27 -07:00
committed by GitHub
parent 050a896c8b
commit 220f867814
9 changed files with 88 additions and 65 deletions

View File

@ -0,0 +1,28 @@
import { CommandRuntime, CommandDeclaration, CommandContext } from '../services/CommandService';
import { _ } from '../locale';
import Note from '../models/Note';
export const declaration: CommandDeclaration = {
name: 'deleteNote',
label: () => _('Delete note'),
iconName: 'fa-times',
};
export const runtime = (): CommandRuntime => {
return {
execute: async (context: CommandContext, noteIds: string[] = null) => {
if (noteIds === null) noteIds = context.state.selectedNoteIds;
if (!noteIds.length) return;
await Note.batchDelete(noteIds, { toTrash: true, sourceDescription: 'deleteNote command' });
context.dispatch({
type: 'ITEMS_TRASHED',
value: {
noteIds,
folderIds: [],
},
});
},
enabledCondition: '!noteIsReadOnly && !inTrash && someNotesSelected',
};
};