Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fixes for "add child note" button
azivnerab26216cbe98
diff --git a/src/public/javascripts/services/note_detail_relation_map.js b/src/public/javascripts/services/note_detail_relation_map.jsindex 882e0ae25b..fc29e26d99 100644--- a/src/public/javascripts/services/note_detail_relation_map.js+++ b/src/public/javascripts/services/note_detail_relation_map.js@@ -402,11 +402,15 @@ $createChildNote.click(async () => {target: 'into'});+ // reloading tree so that the new note appears there+ // no need to wait for it to finish+ treeService.reload();+const [x, y] = getFreePosition();mapData.notes.push({ id: note.noteId, x, y });- await createNoteBox(id, title, x, y);+ await createNoteBox(note.noteId, title, x, y);});export default {diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.jsindex 9d5d85925e..fe00f6d5bc 100644--- a/src/public/javascripts/services/tree.js+++ b/src/public/javascripts/services/tree.js@@ -482,13 +482,13 @@ async function createNote(node, parentNoteId, target, isProtected, saveSelectionawait noteDetailService.saveNoteIfChanged();+ noteDetailService.newNoteCreated();+const noteEntity = new NoteShort(treeCache, note);const branchEntity = new Branch(treeCache, branch);treeCache.add(noteEntity, branchEntity);- noteDetailService.newNoteCreated();-const newNode = {title: newNoteName,noteId: branchEntity.noteId,diff --git a/src/views/index.ejs b/src/views/index.ejsindex 00d880b942..cdc453d03c 100644--- a/src/views/index.ejs+++ b/src/views/index.ejs@@ -266,6 +266,8 @@<button id="relation-map-add-child-notes" class="btn" type="button"title="Add all child notes of this relation map note">Add child notes</button>+ +<button id="relation-map-create-child-note" class="btn" type="button"title="Create new child note and add it into this relation map">Create child note</button>