client: format note paths: each segment and delimiter as a separate span

This commit is contained in:
Adorian Doran 2024-12-05 02:06:32 +02:00
parent 4016c76cc7
commit 79b1d01267

View File

@ -273,10 +273,23 @@ async function getNoteTitleWithPathAsSuffix(notePath) {
.append($('<span class="note-title">').text(title));
if (path.length > 0) {
$titleWithPath
.append($('<span class="note-path">').text(` (${path.join(' / ')})`));
}
const $notePath = $('<span class="note-path">');
$notePath.append($(`<span class="path-bracket">(</span>)`));
for (let segmentIndex = 0; segmentIndex < path.length; segmentIndex++) {
$notePath.append($(`<span>`).text(path[segmentIndex]));
if (segmentIndex < path.length - 1) {
$notePath.append($(`<span class="path-bracket">`).text(" / "));
}
}
$notePath.append($(`<span class="path-wrapper">)</span>)`));
$titleWithPath.append($notePath);
}
return $titleWithPath;
}