mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 16:26:31 +01:00
more refactoring
This commit is contained in:
27
static/js/tree_utils.js
Normal file
27
static/js/tree_utils.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function getParentKey(node) {
|
||||
return (node.getParent() === null || node.getParent().key === "root_1") ? "root" : node.getParent().key;
|
||||
}
|
||||
|
||||
function getParentEncryption(node) {
|
||||
return node.getParent() === null ? 0 : node.getParent().data.encryption;
|
||||
}
|
||||
|
||||
function getNodeByKey(noteId) {
|
||||
return globalTree.fancytree('getNodeByKey', noteId);
|
||||
}
|
||||
|
||||
function getFullName(noteId) {
|
||||
let note = getNodeByKey(noteId);
|
||||
const path = [];
|
||||
|
||||
while (note) {
|
||||
path.push(note.title);
|
||||
|
||||
note = note.getParent();
|
||||
}
|
||||
|
||||
// remove "root" element
|
||||
path.pop();
|
||||
|
||||
return path.reverse().join(" > ");
|
||||
}
|
||||
Reference in New Issue
Block a user