mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
note path widget tweaks
This commit is contained in:
parent
6cc3e3cdf6
commit
9c04ef9fb7
@ -3,8 +3,15 @@ import treeService from "../services/tree.js";
|
|||||||
import linkService from "../services/link.js";
|
import linkService from "../services/link.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div style="display: flex; flex-direction: row; padding: 10px;">
|
<div class="note-paths-widget">
|
||||||
<style>
|
<style>
|
||||||
|
.note-paths-widget {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
border-bottom: 1px solid var(--main-border-color);
|
||||||
|
padding: 5px 10px 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.note-path-list a.current {
|
.note-path-list a.current {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
@ -67,6 +74,7 @@ export default class NotePathsWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
curPath += (curPath ? '/' : '') + noteId;
|
curPath += (curPath ? '/' : '') + noteId;
|
||||||
|
|
||||||
|
if (noteId !== 'root' || noteIdsPath.length < 3) {
|
||||||
this.$currentPath.append(
|
this.$currentPath.append(
|
||||||
$("<a>")
|
$("<a>")
|
||||||
.attr('href', '#' + curPath)
|
.attr('href', '#' + curPath)
|
||||||
@ -77,19 +85,19 @@ export default class NotePathsWidget extends TabAwareWidget {
|
|||||||
if (i !== noteIdsPath.length - 1) {
|
if (i !== noteIdsPath.length - 1) {
|
||||||
this.$currentPath.append(' / ');
|
this.$currentPath.append(' / ');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
parentNoteId = noteId;
|
parentNoteId = noteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pathCount = note.noteId === 'root'
|
|
||||||
? 1 // root doesn't have any parent, but it's still technically 1 path
|
|
||||||
: note.getBranchIds().length;
|
|
||||||
|
|
||||||
this.$notePathCount.html(pathCount + " path" + (pathCount > 1 ? "s" : ""));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async renderDropdown() {
|
async renderDropdown() {
|
||||||
this.$notePathList.empty();
|
this.$notePathList.empty();
|
||||||
|
this.$notePathList.append(
|
||||||
|
$("<div>")
|
||||||
|
.addClass("dropdown-header")
|
||||||
|
.text('This note is placed into the following paths:')
|
||||||
|
);
|
||||||
|
|
||||||
if (this.noteId === 'root') {
|
if (this.noteId === 'root') {
|
||||||
await this.addPath('root', true);
|
await this.addPath('root', true);
|
||||||
@ -109,7 +117,7 @@ export default class NotePathsWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cloneLink = $("<div>")
|
const cloneLink = $("<div>")
|
||||||
.addClass("dropdown-item")
|
.addClass("dropdown-header")
|
||||||
.append(
|
.append(
|
||||||
$('<button class="btn btn-sm">')
|
$('<button class="btn btn-sm">')
|
||||||
.text('Clone note to new location...')
|
.text('Clone note to new location...')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user