1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-08-13 22:12:50 +02:00

All: Allow longer folder paths

This commit is contained in:
Laurent Cozic
2019-04-04 08:01:16 +01:00
parent 6ebc77cbba
commit 0cebae8032

View File

@@ -236,12 +236,24 @@ class Folder extends BaseItem {
return path;
}
static folderPathString(folders, folderId) {
static folderPathString(folders, folderId, maxTotalLength = 80) {
const path = this.folderPath(folders, folderId);
let currentTotalLength = 0;
for (let i = 0; i < path.length; i++) {
currentTotalLength += path[i].title.length;
}
let pieceLength = maxTotalLength;
if (currentTotalLength > maxTotalLength) {
pieceLength = maxTotalLength / path.length;
}
const output = [];
for (let i = 0; i < path.length; i++) {
output.push(substrWithEllipsis(path[i].title, 0, 16));
output.push(substrWithEllipsis(path[i].title, 0, pieceLength));
}
return output.join(' / ');
}