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);

View File

@@ -583,4 +583,12 @@ table.promoted-attributes-in-tooltip td, table.promoted-attributes-in-tooltip th
color: orange;
border: 0;
cursor: pointer;
}
.modalless {
top:10%;
left:50%;
bottom:auto;
right:auto;
margin-left:-300px;
}

View File

@@ -1,4 +1,4 @@
<div id="protected-session-password-dialog" class="modal fade mx-auto" tabindex="-1" role="dialog">
<div id="protected-session-password-dialog" class="modal mx-auto" data-backdrop="false" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">

View File

@@ -210,7 +210,6 @@
<script src="/libraries/jquery.min.js"></script>
<!-- bootstrap needs to be included before jQuery UI, otherwise close icon in the dialog will be missing -->
<link href="/libraries/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script src="/libraries/bootstrap/js/bootstrap.bundle.min.js"></script>
@@ -227,8 +226,6 @@
<script src="/libraries/autocomplete.jquery.min.js"></script>
<script src="/libraries/feather.min.js"></script>
<link href="/stylesheets/style.css" rel="stylesheet">
<script src="/javascripts/services/bootstrap.js" type="module"></script>