client: format the note paths displayed in the note links

This commit is contained in:
Adorian Doran 2024-12-10 22:24:53 +02:00
parent 0588c91d1d
commit 2b36bde9a9
2 changed files with 8 additions and 7 deletions

View File

@ -102,15 +102,15 @@ async function createLink(notePath, options = {}) {
$container.append($noteLink); $container.append($noteLink);
if (showNotePath) { if (showNotePath) {
const resolvedNotePathSegments = await treeService.resolveNotePathToSegments(notePath); const resolvedPathSegments = await treeService.resolveNotePathToSegments(notePath);
resolvedPathSegments.pop(); // Remove last element
if (resolvedNotePathSegments) { const resolvedPath = resolvedPathSegments.join("/");
resolvedNotePathSegments.pop(); // remove last element const pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
const parentNotePath = resolvedNotePathSegments.join("/").trim(); if (pathSegments) {
if (pathSegments.length) {
if (parentNotePath) { $container.append($("<small>").append(treeService.formatNotePath(pathSegments)));
$container.append($("<small>").text(` (${await treeService.getNotePathTitle(parentNotePath)})`));
} }
} }
} }

View File

@ -310,6 +310,7 @@ export default {
resolveNotePathToSegments, resolveNotePathToSegments,
getParentProtectedStatus, getParentProtectedStatus,
getNotePath, getNotePath,
getNotePathTitleComponents,
getNoteIdFromUrl, getNoteIdFromUrl,
getNoteIdAndParentIdFromUrl, getNoteIdAndParentIdFromUrl,
getBranchIdFromUrl, getBranchIdFromUrl,