smaller refactorings in note_tree

This commit is contained in:
zadam
2020-08-24 23:33:27 +02:00
parent b7947a40ea
commit 6a3e27eb62
6 changed files with 85 additions and 133 deletions

View File

@@ -38,13 +38,12 @@ async function createNoteLink(notePath, options = {}) {
const $container = $("<span>").append($noteLink);
if (showNotePath) {
notePath = await treeService.resolveNotePath(notePath);
const resolvedNotePathSegments = await treeService.resolveNotePathToSegments(notePath);
if (notePath) {
const noteIds = notePath.split("/");
noteIds.pop(); // remove last element
resolvedNotePathSegments.pop(); // remove last element
const parentNotePath = noteIds.join("/").trim();
const parentNotePath = resolvedNotePathSegments.join("/").trim();
if (parentNotePath) {
$container.append($("<small>").text(" (" + await treeService.getNotePathTitle(parentNotePath) + ")"));