mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fixed "paths" styling for BS4 and fix for special case of root note
This commit is contained in:
parent
d19fa89f69
commit
3fee263355
@ -207,13 +207,40 @@ async function getRunPath(notePath) {
|
|||||||
return effectivePath.reverse();
|
return effectivePath.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function addPath(notePath, isCurrent) {
|
||||||
|
const title = await treeUtils.getNotePathTitle(notePath);
|
||||||
|
|
||||||
|
const noteLink = await linkService.createNoteLink(notePath, title);
|
||||||
|
|
||||||
|
noteLink
|
||||||
|
.addClass("no-tooltip-preview")
|
||||||
|
.addClass("dropdown-item");
|
||||||
|
|
||||||
|
if (isCurrent) {
|
||||||
|
noteLink.addClass("current");
|
||||||
|
}
|
||||||
|
|
||||||
|
$notePathList.append(noteLink);
|
||||||
|
}
|
||||||
|
|
||||||
async function showPaths(noteId, node) {
|
async function showPaths(noteId, node) {
|
||||||
utils.assertArguments(noteId, node);
|
utils.assertArguments(noteId, node);
|
||||||
|
|
||||||
const note = await treeCache.getNote(noteId);
|
const note = await treeCache.getNote(noteId);
|
||||||
|
|
||||||
|
if (note.noteId === 'root') {
|
||||||
|
// root doesn't have any parent, but it's still technically 1 path
|
||||||
|
|
||||||
|
$notePathCount.html("1 path");
|
||||||
|
|
||||||
|
$notePathList.empty();
|
||||||
|
|
||||||
|
await addPath('root', true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
const parents = await note.getParentNotes();
|
const parents = await note.getParentNotes();
|
||||||
|
|
||||||
$notePathCount.html(parents.length + " path" + (parents.length > 0 ? "s" : ""));
|
$notePathCount.html(parents.length + " path" + (parents.length > 1 ? "s" : ""));
|
||||||
|
|
||||||
$notePathList.empty();
|
$notePathList.empty();
|
||||||
|
|
||||||
@ -221,19 +248,10 @@ async function showPaths(noteId, node) {
|
|||||||
const parentNotePath = await getSomeNotePath(parentNote);
|
const parentNotePath = await getSomeNotePath(parentNote);
|
||||||
// this is to avoid having root notes leading '/'
|
// this is to avoid having root notes leading '/'
|
||||||
const notePath = parentNotePath ? (parentNotePath + '/' + noteId) : noteId;
|
const notePath = parentNotePath ? (parentNotePath + '/' + noteId) : noteId;
|
||||||
const title = await treeUtils.getNotePathTitle(notePath);
|
const isCurrent = node.getParent().data.noteId === parentNote.noteId;
|
||||||
|
|
||||||
const noteLink = await linkService.createNoteLink(notePath, title);
|
await addPath(notePath, isCurrent);
|
||||||
|
|
||||||
noteLink.addClass("no-tooltip-preview");
|
|
||||||
|
|
||||||
const item = $("<li/>").append(noteLink);
|
|
||||||
|
|
||||||
if (node.getParent().data.noteId === parentNote.noteId) {
|
|
||||||
item.addClass("current");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$notePathList.append(item);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ div.ui-tooltip {
|
|||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#note-path-list .current a {
|
#note-path-list a.current {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<li>click on Options button in the top right</li>
|
<li>click on Options button in the top right</li>
|
||||||
<li>click on Sync tab</li>
|
<li>click on Sync tab</li>
|
||||||
<li>configure server instance address to the: <span id="current-host"></span> and click save.</li>
|
<li>configure server instance address to the: <span id="current-host"></span> and click save.</li>
|
||||||
<li>click on "Sync document to the server instance" button</li>
|
<li>click on "Test sync" button</li>
|
||||||
<li>once you've done all this, click <a href="/">here</a></li>
|
<li>once you've done all this, click <a href="/">here</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user