-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Desktop: Allow restoring a delete note from note history using comman…
…d palette
- Loading branch information
Showing
6 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
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: number = 0) => { | ||
try { | ||
const note = await RevisionService.instance().restoreNoteById(noteId, reverseRevIndex); | ||
alert(RevisionService.instance().restoreSuccessMessage(note)); | ||
} catch (error) { | ||
alert(error.message); | ||
} | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters