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);
if (showNotePath) {
const resolvedNotePathSegments = await treeService.resolveNotePathToSegments(notePath);
const resolvedPathSegments = await treeService.resolveNotePathToSegments(notePath);
resolvedPathSegments.pop(); // Remove last element
if (resolvedNotePathSegments) {
resolvedNotePathSegments.pop(); // remove last element
const resolvedPath = resolvedPathSegments.join("/");
const pathSegments = await treeService.getNotePathTitleComponents(resolvedPath);
const parentNotePath = resolvedNotePathSegments.join("/").trim();
if (parentNotePath) {
$container.append($("<small>").text(` (${await treeService.getNotePathTitle(parentNotePath)})`));
if (pathSegments) {
if (pathSegments.length) {
$container.append($("<small>").append(treeService.formatNotePath(pathSegments)));
}
}
}

View File

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