cloning in context menu (copy & paste) and a lot of related refactoring and fixes

This commit is contained in:
azivner
2017-11-22 23:16:54 -05:00
parent c1fca4764b
commit acba72ec4c
12 changed files with 260 additions and 188 deletions

View File

@@ -79,6 +79,11 @@ const recentNotes = (function() {
return selectBoxEl.find("option:selected").val();
}
function getSelectedNoteId() {
const notePath = getSelectedNotePath();
return treeUtils.getNoteIdFromNotePath(notePath);
}
function setActiveNoteBasedOnRecentNotes() {
const notePath = getSelectedNotePath();
@@ -104,13 +109,13 @@ const recentNotes = (function() {
}
async function addCurrentAsChild() {
await treeUtils.addAsChild(getSelectedNotePath(), noteTree.getCurrentNotePath());
await treeChanges.cloneNoteTo(noteTree.getCurrentNoteId(), getSelectedNoteId());
dialogEl.dialog("close");
}
async function addRecentAsChild() {
await treeUtils.addAsChild(noteTree.getCurrentNotePath(), getSelectedNotePath());
await treeChanges.cloneNoteTo(getSelectedNoteId(), noteTree.getCurrentNoteId());
dialogEl.dialog("close");
}