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
more cleanup
azivnerc2ad14ba186f
diff --git a/public/javascripts/context_menu.js b/public/javascripts/context_menu.jsindex a5ecee0d1b..d573dabc99 100644--- a/public/javascripts/context_menu.js+++ b/public/javascripts/context_menu.js@@ -57,7 +57,7 @@ const contextMenu = (function() {if (ui.cmd === "insertNoteHere") {const parentKey = treeUtils.getParentKey(node);- const isProtected = treeUtils.getParentEncryption(node);+ const isProtected = treeUtils.getParentProtectedStatus(node);noteEditor.createNote(node, parentKey, 'after', isProtected);}diff --git a/public/javascripts/dialogs/settings.js b/public/javascripts/dialogs/settings.jsindex da1acd712c..0fb2bc4b87 100644--- a/public/javascripts/dialogs/settings.js+++ b/public/javascripts/dialogs/settings.js@@ -89,7 +89,7 @@ settings.addModule((function() {if (result.success) {alert("Password has been changed. Trilium will be reloaded after you press OK.");- // encryption password changed so current encryption session is invalid and needs to be cleared+ // password changed so current protected session is invalid and needs to be clearedprotected_session.resetProtectedSession();}else {diff --git a/public/javascripts/note_editor.js b/public/javascripts/note_editor.jsindex 36d8b9edb2..4f5902aba6 100644--- a/public/javascripts/note_editor.js+++ b/public/javascripts/note_editor.js@@ -7,8 +7,6 @@ const noteEditor = (function() {const protectButton = $("#protect-button");const unprotectButton = $("#unprotect-button");const noteDetailWrapperEl = $("#note-detail-wrapper");- const encryptionPasswordDialogEl = $("#protected-session-password-dialog");- const encryptionPasswordEl = $("#protected-session-password");let currentNote = null;@@ -206,14 +204,6 @@ const noteEditor = (function() {noteDetailWrapperEl.show();- // this may fal if the dialog has not been previously opened- try {- encryptionPasswordDialogEl.dialog('close');- }- catch(e) {}-- encryptionPasswordEl.val('');-noteTitleEl.val(currentNote.detail.note_title);noteChangeDisabled = true;diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.jsindex 2ea010d618..79866dfdf0 100644--- a/public/javascripts/note_tree.js+++ b/public/javascripts/note_tree.js@@ -58,9 +58,9 @@ const noteTree = (function() {const keybindings = {"insert": node => {const parentKey = treeUtils.getParentKey(node);- const encryption = treeUtils.getParentEncryption(node);+ const isProtected = treeUtils.getParentProtectedStatus(node);- noteEditor.createNote(node, parentKey, 'after', encryption);+ noteEditor.createNote(node, parentKey, 'after', isProtected);},"ctrl+insert": node => {noteEditor.createNote(node, node.key, 'into', node.data.is_protected);diff --git a/public/javascripts/protected_session.js b/public/javascripts/protected_session.jsindex 5e32e94ae7..67ddf0151b 100644--- a/public/javascripts/protected_session.js+++ b/public/javascripts/protected_session.js@@ -13,7 +13,7 @@ const protected_session = (function() {$.ajax({url: baseApiUrl + 'settings/all',type: 'GET',- error: () => showError("Error getting encryption settings.")+ error: () => showError("Error getting protected session settings.")}).then(settings => {protectedSessionTimeout = settings.protected_session_timeout;});@@ -69,6 +69,14 @@ const protected_session = (function() {noteTree.reload();if (protectedSessionDeferred !== null) {+ // this may fal if the dialog has not been previously opened+ try {+ dialogEl.dialog('close');+ }+ catch(e) {}++ passwordEl.val('');+protectedSessionDeferred.resolve();protectedSessionDeferred = null;diff --git a/public/javascripts/tree_utils.js b/public/javascripts/tree_utils.jsindex c63dc7a0b8..db927deb4a 100644--- a/public/javascripts/tree_utils.js+++ b/public/javascripts/tree_utils.js@@ -7,7 +7,7 @@ const treeUtils = (function() {return (node.getParent() === null || node.getParent().key === "root_1") ? "root" : node.getParent().key;}- function getParentEncryption(node) {+ function getParentProtectedStatus(node) {return node.getParent() === null ? 0 : node.getParent().data.is_protected;}@@ -64,7 +64,7 @@ const treeUtils = (function() {return {getParentKey,- getParentEncryption,+ getParentProtectedStatus,getNodeByKey,activateNode,getNoteTitle,