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!"); }