mirror of
https://github.com/zadam/trilium.git
synced 2025-11-05 04:45:47 +01:00
Merge branch 'master' into dev
# Conflicts: # package-lock.json # package.json # src/public/app/widgets/dialogs/note_revisions.js # src/services/handlers.js # src/services/hidden_subtree.js # src/services/search/services/parse.js
This commit is contained in:
@@ -108,8 +108,13 @@ function getAndValidateParent(params) {
|
||||
throw new ValidationError(`Only 'launcher' notes can be created in parent '${params.parentNoteId}'`);
|
||||
}
|
||||
|
||||
if (!params.ignoreForbiddenParents && (['_lbRoot', '_hidden'].includes(parentNote.noteId) || parentNote.isOptions())) {
|
||||
throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);
|
||||
if (!params.ignoreForbiddenParents) {
|
||||
if (['_lbRoot', '_hidden'].includes(parentNote.noteId)
|
||||
|| parentNote.noteId.startsWith("_lbTpl")
|
||||
|| parentNote.isOptions()) {
|
||||
|
||||
throw new ValidationError(`Creating child notes into '${parentNote.noteId}' is not allowed.`);
|
||||
}
|
||||
}
|
||||
|
||||
return parentNote;
|
||||
@@ -283,8 +288,12 @@ function protectNote(note, protect) {
|
||||
|
||||
note.isProtected = protect;
|
||||
|
||||
// this will force de/encryption
|
||||
note.setContent(content);
|
||||
// see https://github.com/zadam/trilium/issues/3523
|
||||
// IIRC a zero-sized buffer can be returned as null from the database
|
||||
if (content !== null) {
|
||||
// this will force de/encryption
|
||||
note.setContent(content);
|
||||
}
|
||||
|
||||
note.save();
|
||||
}
|
||||
@@ -592,11 +601,6 @@ function updateNoteContent(noteId, content) {
|
||||
content = saveLinks(note, content);
|
||||
|
||||
note.setContent(content);
|
||||
|
||||
eventService.emit(eventService.ENTITY_CHANGED, {
|
||||
entityName: 'note_contents',
|
||||
entity: note
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user