unprotecting note after protecting it sometimes didn't work

fix protected note background
This commit is contained in:
azivner 2018-11-09 14:36:27 +01:00
parent c5113eb292
commit 71f333154d
3 changed files with 24 additions and 26 deletions

View File

@ -65,7 +65,8 @@ async function setupProtectedSession() {
$dialog.modal("hide"); $dialog.modal("hide");
noteDetailService.reload(); await noteDetailService.reload();
treeService.reload(); treeService.reload();
if (protectedSessionDeferred !== null) { if (protectedSessionDeferred !== null) {
@ -113,11 +114,15 @@ async function protectNoteAndSendToServer() {
treeService.setProtected(note.noteId, note.isProtected); treeService.setProtected(note.noteId, note.isProtected);
noteDetailService.setNoteBackgroundIfProtected(note); noteDetailService.setNoteBackgroundIfProtected(note);console.log(note);
} }
async function unprotectNoteAndSendToServer() { async function unprotectNoteAndSendToServer() {
if (!noteDetailService.getCurrentNote().isProtected) { const currentNote = noteDetailService.getCurrentNote();
if (!currentNote.isProtected) {
infoService.showAndLogError(`Note ${currentNote.noteId} is not protected`);
return; return;
} }
@ -130,14 +135,13 @@ async function unprotectNoteAndSendToServer() {
return; return;
} }
const note = noteDetailService.getCurrentNote(); currentNote.isProtected = false;
note.isProtected = false;
await noteDetailService.saveNote(note); await noteDetailService.saveNote(currentNote);
treeService.setProtected(note.noteId, note.isProtected); treeService.setProtected(currentNote.noteId, currentNote.isProtected);
noteDetailService.setNoteBackgroundIfProtected(note); noteDetailService.setNoteBackgroundIfProtected(currentNote);
} }
async function protectSubtree(noteId, protect) { async function protectSubtree(noteId, protect) {
@ -173,8 +177,6 @@ $unprotectButton.click(unprotectNoteAndSendToServer);
export default { export default {
ensureProtectedSession, ensureProtectedSession,
protectNoteAndSendToServer,
unprotectNoteAndSendToServer,
protectSubtree, protectSubtree,
ensureDialogIsClosed, ensureDialogIsClosed,
enterProtectedSession, enterProtectedSession,

View File

@ -1,14 +1,3 @@
/* We change h5 and h6 because by default (bootstrap) they are smaller than normal text */
h5 {
font-size: 16px;
font-weight: 500;
}
h6 {
font-size: 14px;
font-weight: 600;
}
body { body {
/* Fix for CKEditor block gutter icon "stretching" body and causing scrollbar to appear after pressing enter /* Fix for CKEditor block gutter icon "stretching" body and causing scrollbar to appear after pressing enter
on the last line of the editor. */ on the last line of the editor. */
@ -93,6 +82,15 @@ body {
display: none; display: none;
} }
#note-detail-text { font-size: 1.1em; }
#note-detail-text h1 { font-size: 2.0em; }
#note-detail-text h2 { font-size: 1.8em; }
#note-detail-text h3 { font-size: 1.6em; }
#note-detail-text h4 { font-size: 1.4em; }
#note-detail-text h5 { font-size: 1.2em; }
#note-detail-text h6 { font-size: 1.1em; }
#note-detail-text { #note-detail-text {
border: 0 !important; border: 0 !important;
box-shadow: none !important; box-shadow: none !important;
@ -102,8 +100,10 @@ body {
} }
#note-detail-wrapper.protected { #note-detail-wrapper.protected {
/* DON'T COLLAPSE THE RULES INTO SINGLE ONE, BACKGROUND WON'T DISPLAY */
background: url('/images/shield.svg') no-repeat;
background-size: contain; background-size: contain;
background: url('/images/shield.svg') no-repeat center; background-position: center;
} }
ul.fancytree-container { ul.fancytree-container {

View File

@ -219,10 +219,6 @@
<script src="/javascripts/services/bootstrap.js" type="module"></script> <script src="/javascripts/services/bootstrap.js" type="module"></script>
<link rel="stylesheet" href="/libraries/fork-awesome/css/fork-awesome.min.css">
<link rel="stylesheet" href="/libraries/line-awesome/css/line-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/libraries/jam/css/jam.min.css"> <link rel="stylesheet" type="text/css" href="/libraries/jam/css/jam.min.css">
<script type="text/javascript"> <script type="text/javascript">