You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Desktop: Multiple window support (#11181)
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import restoreItems from '@joplin/lib/services/trash/restoreItems';
|
||||
import { NoteEntity } from '@joplin/lib/services/database/types';
|
||||
import { ModelType } from '@joplin/lib/BaseModel';
|
||||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'restoreNote',
|
||||
label: () => _('Restore note'),
|
||||
iconName: 'fas fa-trash-restore',
|
||||
};
|
||||
|
||||
export const runtime = (): CommandRuntime => {
|
||||
return {
|
||||
execute: async (context: CommandContext, noteIds: string[] = null) => {
|
||||
if (noteIds === null) noteIds = context.state.selectedNoteIds;
|
||||
const notes: NoteEntity[] = await Note.byIds(noteIds, { fields: ['id', 'parent_id'] });
|
||||
await restoreItems(ModelType.Note, notes);
|
||||
},
|
||||
enabledCondition: 'allSelectedNotesAreDeleted',
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user