fixing encrypt / decrypt subtree

This commit is contained in:
azivner 2017-11-22 20:46:42 -05:00
parent 705aff93ec
commit b96e434345
2 changed files with 5 additions and 6 deletions

View file

@ -45,9 +45,6 @@ const contextMenu = (function() {
treeEl.contextmenu("enableEntry", "pasteAfter", noteTree.getClipboardNoteTreeId() !== null);
treeEl.contextmenu("enableEntry", "pasteInto", noteTree.getClipboardNoteTreeId() !== null);
treeEl.contextmenu("enableEntry", "protectSubTree", protected_session.isProtectedSessionAvailable());
treeEl.contextmenu("enableEntry", "unprotectSubTree", protected_session.isProtectedSessionAvailable());
// Activate node on right-click
node.setActive();
// Disable tree keyboard handling
@ -65,13 +62,13 @@ const contextMenu = (function() {
noteEditor.createNote(node, parentNoteTreeId, 'after', isProtected);
}
else if (ui.cmd === "insertChildNote") {
noteEditor.createNote(node, node.key, 'into');
noteEditor.createNote(node, node.data.note_id, 'into');
}
else if (ui.cmd === "protectSubTree") {
protected_session.protectSubTree(node.key, true);
protected_session.protectSubTree(node.data.note_id, true);
}
else if (ui.cmd === "unprotectSubTree") {
protected_session.protectSubTree(node.key, false);
protected_session.protectSubTree(node.data.note_id, false);
}
else if (ui.cmd === "cut") {
cut(node);

View file

@ -152,6 +152,8 @@ const protected_session = (function() {
}
async function protectSubTree(noteId, protect) {
await ensureProtectedSession(true, true);
await $.ajax({
url: baseApiUrl + 'tree/' + noteId + "/protectSubTree/" + (protect ? 1 : 0),
type: 'PUT',