mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 09:56:36 +01:00
add keyboard action to force creating note revisions, #2147
This commit is contained in:
@@ -6,6 +6,7 @@ const sql = require('../../services/sql');
|
||||
const utils = require('../../services/utils');
|
||||
const log = require('../../services/log');
|
||||
const TaskContext = require('../../services/task_context');
|
||||
const protectedSessionService = require('../../services/protected_session');
|
||||
const fs = require('fs');
|
||||
const becca = require("../../becca/becca");
|
||||
|
||||
@@ -305,6 +306,21 @@ function uploadModifiedFile(req) {
|
||||
note.setContent(fileContent);
|
||||
}
|
||||
|
||||
function forceSaveNoteRevision(req) {
|
||||
const {noteId} = req.params;
|
||||
const note = becca.getNote(noteId);
|
||||
|
||||
if (!note) {
|
||||
return [404, `Note ${noteId} not found.`];
|
||||
}
|
||||
|
||||
if (!note.isContentAvailable()) {
|
||||
return [400, `Note revision of a protected note cannot be created outside of a protected session.`];
|
||||
}
|
||||
|
||||
note.saveNoteRevision();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getNote,
|
||||
updateNoteContent,
|
||||
@@ -319,5 +335,6 @@ module.exports = {
|
||||
duplicateSubtree,
|
||||
eraseDeletedNotesNow,
|
||||
getDeleteNotesPreview,
|
||||
uploadModifiedFile
|
||||
uploadModifiedFile,
|
||||
forceSaveNoteRevision
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user