From 153de63f4dbf7624abe2f202a51faf921c5f410d Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 20 Aug 2020 15:45:33 +0200 Subject: [PATCH] update note title in link map when note is renamed --- .../app/widgets/collapsible_widgets/link_map.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/public/app/widgets/collapsible_widgets/link_map.js b/src/public/app/widgets/collapsible_widgets/link_map.js index fc1adcf6b..7d04d5279 100644 --- a/src/public/app/widgets/collapsible_widgets/link_map.js +++ b/src/public/app/widgets/collapsible_widgets/link_map.js @@ -1,4 +1,5 @@ import CollapsibleWidget from "../collapsible_widget.js"; +import treeCache from "../../services/tree_cache.js"; let linkMapContainerIdCtr = 1; @@ -89,5 +90,19 @@ export default class LinkMapWidget extends CollapsibleWidget { if (loadResults.getAttributes().find(attr => attr.type === 'relation' && (attr.noteId === this.noteId || attr.value === this.noteId))) { this.noteSwitched(); } + + const changedNoteIds = loadResults.getNoteIds(); + + if (changedNoteIds.length > 0) { + const $linkMapContainer = this.$body.find('.link-map-container'); + + for (const noteId of changedNoteIds) { + const note = treeCache.notes[noteId]; + + if (note) { + $linkMapContainer.find(`a[data-note-path="${noteId}"]`).text(note.title); + } + } + } } } \ No newline at end of file