fixes in working with top level nodes and root node

This commit is contained in:
azivner
2017-12-23 12:19:15 -05:00
parent 14f44b3271
commit 8bc12a2654
4 changed files with 34 additions and 14 deletions

View File

@@ -4,7 +4,7 @@ const treeUtils = (function() {
const treeEl = $("#tree");
function getParentProtectedStatus(node) {
return node.getParent() === null ? 0 : node.getParent().data.is_protected;
return isTopLevelNode(node) ? 0 : node.getParent().data.is_protected;
}
function getNodeByKey(key) {
@@ -20,7 +20,7 @@ const treeUtils = (function() {
function getNotePath(node) {
const path = [];
while (node) {
while (node && !isRootNode(node)) {
if (node.data.note_id) {
path.push(node.data.note_id);
}