Skip to content

Build your personal knowledge base with Trilium Notes

using globalTree consistently

azivner7bc322f9a15b
diff --git a/static/js/note.js b/static/js/note.js
index e09dd877e9..77bcf525d2 100644
--- a/static/js/note.js
+++ b/static/js/note.js
@@ -94,7 +94,7 @@ $(document).ready(function() {
var globalNote;
function createNewTopLevelNote() {
- let rootNode = $("#tree").fancytree("getRootNode");
+ let rootNode = globalTree.fancytree("getRootNode");
createNote(rootNode, "root", "into");
}
diff --git a/static/js/tree.js b/static/js/tree.js
index 48d811d42e..546dc01a5f 100644
--- a/static/js/tree.js
+++ b/static/js/tree.js
@@ -372,7 +372,7 @@ $("input[name=search]").keyup(function (e) {
console.log("search: ", resp);
// Pass a string to perform case insensitive matching
- const tree = $("#tree").fancytree("getTree");
+ const tree = globalTree.fancytree("getTree");
tree.filterBranches(function(node) {
return resp.includes(node.data.note_id);
});
@@ -383,12 +383,12 @@ $("input[name=search]").keyup(function (e) {
$("button#btnResetSearch").click(function () {
$("input[name=search]").val("");
- const tree = $("#tree").fancytree("getTree");
+ const tree = globalTree.fancytree("getTree");
tree.clearFilter();
});
function collapseTree() {
- $("#tree").fancytree("getRootNode").visit(function(node){
+ globalTree.fancytree("getRootNode").visit(function(node){
node.setExpanded(false);
});
}