Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
unprotecting note after protecting it sometimes didn't work fix protected note background
azivner71f333154d62
diff --git a/src/public/javascripts/services/protected_session.js b/src/public/javascripts/services/protected_session.jsindex 0591854ae6..60407421a0 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.cssindex 94fbc1139f..53bac81b83 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 enteron 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.ejsindex 63ba53b0ae..13eb18143d 100644--- a/src/views/index.ejs+++ b/src/views/index.ejs@@ -219,10 +219,6 @@<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"><script type="text/javascript">