1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00
joplin/packages/app-desktop/commands/exportNotes.ts
2020-11-17 14:50:28 +00:00

23 lines
720 B
TypeScript

import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
import InteropService from '@joplin/lib/services/interop/InteropService';
import { ExportOptions, FileSystemItem } from '@joplin/lib/services/interop/types';
export const declaration: CommandDeclaration = {
name: 'exportNotes',
};
export const runtime = (): CommandRuntime => {
return {
execute: async (_context: any, noteIds: string[], format: string, targetDirectoryPath: string) => {
const exportOptions: ExportOptions = {
path: targetDirectoryPath,
format: format,
target: FileSystemItem.Directory,
sourceNoteIds: noteIds,
};
return InteropService.instance().export(exportOptions);
},
};
};