mirror of
https://github.com/zadam/trilium.git
synced 2025-10-31 18:36:30 +01:00
no need to create template relation if there is already one owned
This commit is contained in:
@@ -155,16 +155,19 @@ function createNewNote(params) {
|
||||
|
||||
scanForLinks(note);
|
||||
|
||||
copyChildAttributes(parentNote, note);
|
||||
|
||||
if (params.templateNoteId) {
|
||||
if (!becca.getNote(params.templateNoteId)) {
|
||||
throw new Error(`Template note '${params.templateNoteId}' does not exist.`);
|
||||
}
|
||||
|
||||
note.addRelation('template', params.templateNoteId);
|
||||
// could be already copied from the parent via `child:`, no need to have 2
|
||||
if (!note.hasOwnedRelation('template', params.templateNoteId)) {
|
||||
note.addRelation('template', params.templateNoteId);
|
||||
}
|
||||
}
|
||||
|
||||
copyChildAttributes(parentNote, note);
|
||||
|
||||
triggerNoteTitleChanged(note);
|
||||
triggerChildNoteCreated(note, parentNote);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user