import TabAwareWidget from "./tab_aware_widget.js";
import treeService from "../services/tree.js";
import linkService from "../services/link.js";
const TPL = `
")
.attr('href', '#' + curPath)
.addClass('no-tooltip-preview')
.text(await treeService.getNoteTitle(noteId, parentNoteId))
);
if (i !== noteIdsPath.length - 1) {
this.$currentPath.append(' / ');
}
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() {
this.$notePathList.empty();
if (this.noteId === 'root') {
await this.addPath('root', true);
return;
}
const pathSegments = treeService.parseNotePath(this.notePath);
const activeNoteParentNoteId = pathSegments[pathSegments.length - 2]; // we know this is not root so there must be a parent
for (const parentNote of this.note.getParentNotes()) {
const parentNotePath = await treeService.getSomeNotePath(parentNote);
// this is to avoid having root notes leading '/'
const notePath = parentNotePath ? (parentNotePath + '/' + this.noteId) : this.noteId;
const isCurrent = activeNoteParentNoteId === parentNote.noteId;
await this.addPath(notePath, isCurrent);
}
const cloneLink = $("")
.addClass("dropdown-item")
.append(
$('