Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
joplin / usr / lib / joplin / resources / app / commands / restoreNoteRevision.ts
Size: Mime:
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
import RevisionService from '@joplin/lib/services/RevisionService';

export const declaration: CommandDeclaration = {
	name: 'restoreNoteRevision',
	label: 'Restore a note from history',
};

export const runtime = (): CommandRuntime => {
	return {
		execute: async (_context: CommandContext, noteId: string, reverseRevIndex = 0) => {
			try {
				const note = await RevisionService.instance().restoreNoteById(noteId, reverseRevIndex);
				alert(RevisionService.instance().restoreSuccessMessage(note));
			} catch (error) {
				alert(error.message);
			}
		},
	};
};