enter protected password is not modal now, closes #217

This commit is contained in:
azivner
2018-11-08 23:48:49 +01:00
parent 8d7a2546e1
commit 7b3c0243f3
6 changed files with 693 additions and 46 deletions

View File

@@ -40,6 +40,7 @@ function ensureProtectedSession(requireProtectedSession, modal) {
$noteDetailWrapper.hide();
}
$dialog.toggleClass("modalless", !modal);
$dialog.modal();
}
else {
@@ -156,7 +157,16 @@ $passwordForm.submit(() => {
return false;
});
$dialog.on("shown.bs.modal", e => $password.focus());
// this doesn't work, event is not triggered :/
$dialog.on("show.bs.modal", e => function() {
if ($(this).hasClass("modalless")) {
// return "stolen" focus to tree
treeService.getCurrentNode().setFocus();
}
else {
$password.focus();
}
});
$protectButton.click(protectNoteAndSendToServer);
$unprotectButton.click(unprotectNoteAndSendToServer);