From b642a567bb494388e605b68bd5fc6dece5c6aea9 Mon Sep 17 00:00:00 2001 From: azivner Date: Tue, 16 Jan 2018 23:22:13 -0500 Subject: [PATCH] fix #5 --- public/javascripts/note_tree.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index 52df4b19b..85fbf08bf 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -772,12 +772,22 @@ const noteTree = (function() { if (target === 'after') { node.appendSibling(newNode).setActive(true); } - else { - node.addChildren(newNode).setActive(true); + else if (target === 'into') { + if (!node.getChildren() && node.isFolder()) { + await node.setExpanded(); + } + else { + node.addChildren(newNode); + } + + node.getLastChild().setActive(true); node.folder = true; node.renderTitle(); } + else { + throwError("Unrecognized target: " + target); + } showMessage("Created!"); }