mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
option to erase notes immediately
This commit is contained in:
@@ -205,12 +205,17 @@ function setExpandedForSubtree(req) {
|
||||
|
||||
function deleteBranch(req) {
|
||||
const last = req.query.last === 'true';
|
||||
const eraseNotes = req.query.eraseNotes === 'true';
|
||||
const branch = becca.getBranch(req.params.branchId);
|
||||
const taskContext = TaskContext.getInstance(req.query.taskId, 'delete-notes');
|
||||
|
||||
const deleteId = utils.randomString(10);
|
||||
const noteDeleted = noteService.deleteBranch(branch, deleteId, taskContext);
|
||||
|
||||
if (eraseNotes) {
|
||||
noteService.eraseNotesWithDeleteId(deleteId);
|
||||
}
|
||||
|
||||
if (last) {
|
||||
taskContext.taskSucceeded();
|
||||
}
|
||||
|
||||
@@ -121,6 +121,22 @@ function getSearchRoot() {
|
||||
return searchRoot;
|
||||
}
|
||||
|
||||
function getSpecialNoteRoot() {
|
||||
let specialNoteRoot = becca.getNote('special');
|
||||
|
||||
if (!specialNoteRoot) {
|
||||
specialNoteRoot = noteService.createNewNote({
|
||||
noteId: 'special',
|
||||
title: 'special',
|
||||
type: 'text',
|
||||
content: '',
|
||||
parentNoteId: getHiddenRoot().noteId
|
||||
}).note;
|
||||
}
|
||||
|
||||
return specialNoteRoot;
|
||||
}
|
||||
|
||||
function getSqlConsoleRoot() {
|
||||
let sqlConsoleRoot = becca.getNote('sqlconsole');
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ function updateNote(req) {
|
||||
function deleteNote(req) {
|
||||
const noteId = req.params.noteId;
|
||||
const taskId = req.query.taskId;
|
||||
const eraseNotes = req.query.eraseNotes === 'true';
|
||||
const last = req.query.last === 'true';
|
||||
|
||||
// note how deleteId is separate from taskId - single taskId produces separate deleteId for each "top level" deleted note
|
||||
@@ -76,6 +77,10 @@ function deleteNote(req) {
|
||||
noteService.deleteBranch(branch, deleteId, taskContext);
|
||||
}
|
||||
|
||||
if (eraseNotes) {
|
||||
noteService.eraseNotesWithDeleteId(deleteId);
|
||||
}
|
||||
|
||||
if (last) {
|
||||
taskContext.taskSucceeded();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user