From 71f333154d6267728bcd1bf2ac32b1c28e5316e7 Mon Sep 17 00:00:00 2001 From: azivner Date: Fri, 9 Nov 2018 14:36:27 +0100 Subject: [PATCH] unprotecting note after protecting it sometimes didn't work fix protected note background --- .../javascripts/services/protected_session.js | 22 +++++++++-------- src/public/stylesheets/style.css | 24 +++++++++---------- src/views/index.ejs | 4 ---- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/public/javascripts/services/protected_session.js b/src/public/javascripts/services/protected_session.js index 0591854ae..60407421a 100644 --- a/src/public/javascripts/services/protected_session.js +++ b/src/public/javascripts/services/protected_session.js @@ -65,7 +65,8 @@ async function setupProtectedSession() { $dialog.modal("hide"); - noteDetailService.reload(); + await noteDetailService.reload(); + treeService.reload(); if (protectedSessionDeferred !== null) { @@ -113,11 +114,15 @@ async function protectNoteAndSendToServer() { treeService.setProtected(note.noteId, note.isProtected); - noteDetailService.setNoteBackgroundIfProtected(note); + noteDetailService.setNoteBackgroundIfProtected(note);console.log(note); } async function unprotectNoteAndSendToServer() { - if (!noteDetailService.getCurrentNote().isProtected) { + const currentNote = noteDetailService.getCurrentNote(); + + if (!currentNote.isProtected) { + infoService.showAndLogError(`Note ${currentNote.noteId} is not protected`); + return; } @@ -130,14 +135,13 @@ async function unprotectNoteAndSendToServer() { return; } - const note = noteDetailService.getCurrentNote(); - note.isProtected = false; + currentNote.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) { @@ -173,8 +177,6 @@ $unprotectButton.click(unprotectNoteAndSendToServer); export default { ensureProtectedSession, - protectNoteAndSendToServer, - unprotectNoteAndSendToServer, protectSubtree, ensureDialogIsClosed, enterProtectedSession, diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css index 94fbc1139..53bac81b8 100644 --- a/src/public/stylesheets/style.css +++ b/src/public/stylesheets/style.css @@ -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 { /* Fix for CKEditor block gutter icon "stretching" body and causing scrollbar to appear after pressing enter on the last line of the editor. */ @@ -93,6 +82,15 @@ body { 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 { border: 0 !important; box-shadow: none !important; @@ -102,8 +100,10 @@ body { } #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: url('/images/shield.svg') no-repeat center; + background-position: center; } ul.fancytree-container { diff --git a/src/views/index.ejs b/src/views/index.ejs index 63ba53b0a..13eb18143 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -219,10 +219,6 @@ - - - -