mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
fix setting "protected" class and background on note tree
This commit is contained in:
parent
5ec866aa50
commit
31a4a201a8
@ -79,18 +79,11 @@ const noteEditor = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setNoteBackgroundIfProtected(note) {
|
function setNoteBackgroundIfProtected(note) {
|
||||||
if (note.detail.is_protected) {
|
const isProtected = !!note.detail.is_protected;
|
||||||
$("#note-detail-wrapper").addClass("protected");
|
|
||||||
protectButton.hide();
|
|
||||||
unprotectButton.show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#note-detail-wrapper").removeClass("protected");
|
|
||||||
protectButton.show();
|
|
||||||
unprotectButton.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
noteTree.setCurrentNoteTreeBasedOnProtectedStatus();
|
noteDetailWrapperEl.toggleClass("protected", isProtected);
|
||||||
|
protectButton.toggle(!isProtected);
|
||||||
|
unprotectButton.toggle(isProtected);
|
||||||
}
|
}
|
||||||
|
|
||||||
let isNewNoteCreated = false;
|
let isNewNoteCreated = false;
|
||||||
@ -129,6 +122,7 @@ const noteEditor = (function() {
|
|||||||
noteChangeDisabled = false;
|
noteChangeDisabled = false;
|
||||||
|
|
||||||
setNoteBackgroundIfProtected(currentNote);
|
setNoteBackgroundIfProtected(currentNote);
|
||||||
|
noteTree.setNoteTreeBackgroundBasedOnProtectedStatus(noteId);
|
||||||
|
|
||||||
showAppIfHidden();
|
showAppIfHidden();
|
||||||
}
|
}
|
||||||
|
@ -617,8 +617,14 @@ const noteTree = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCurrentNoteTreeBasedOnProtectedStatus() {
|
function setNoteTreeBackgroundBasedOnProtectedStatus(noteId) {
|
||||||
getCurrentClones().map(node => node.toggleClass("protected", !!node.data.is_protected));
|
getNodesByNoteId(noteId).map(node => node.toggleClass("protected", !!node.data.is_protected));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setProtected(noteId, isProtected) {
|
||||||
|
getNodesByNoteId(noteId).map(node => node.data.is_protected = isProtected);
|
||||||
|
|
||||||
|
setNoteTreeBackgroundBasedOnProtectedStatus(noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAutocompleteItems(parentNoteId, notePath, titlePath) {
|
function getAutocompleteItems(parentNoteId, notePath, titlePath) {
|
||||||
@ -776,7 +782,8 @@ const noteTree = (function() {
|
|||||||
reload,
|
reload,
|
||||||
collapseTree,
|
collapseTree,
|
||||||
scrollToCurrentNote,
|
scrollToCurrentNote,
|
||||||
setCurrentNoteTreeBasedOnProtectedStatus,
|
setNoteTreeBackgroundBasedOnProtectedStatus,
|
||||||
|
setProtected,
|
||||||
getCurrentNode,
|
getCurrentNode,
|
||||||
activateNode,
|
activateNode,
|
||||||
getCurrentNotePath,
|
getCurrentNotePath,
|
||||||
|
@ -115,6 +115,8 @@ const protected_session = (function() {
|
|||||||
|
|
||||||
await noteEditor.saveNoteToServer(note);
|
await noteEditor.saveNoteToServer(note);
|
||||||
|
|
||||||
|
noteTree.setProtected(note.detail.note_id, note.detail.is_protected);
|
||||||
|
|
||||||
noteEditor.setNoteBackgroundIfProtected(note);
|
noteEditor.setNoteBackgroundIfProtected(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +131,8 @@ const protected_session = (function() {
|
|||||||
|
|
||||||
await noteEditor.saveNoteToServer(note);
|
await noteEditor.saveNoteToServer(note);
|
||||||
|
|
||||||
|
noteTree.setProtected(note.detail.note_id, note.detail.is_protected);
|
||||||
|
|
||||||
noteEditor.setNoteBackgroundIfProtected(note);
|
noteEditor.setNoteBackgroundIfProtected(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,9 +171,10 @@
|
|||||||
<form id="protected-session-password-form">
|
<form id="protected-session-password-form">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="protected-session-password">To proceed with requested action you need to enter protected session by entering password:</label>
|
<label for="protected-session-password">To proceed with requested action you need to enter protected session by entering password:</label>
|
||||||
<input id="protected-session-password" style="width: 250px;" type="password">
|
<input id="protected-session-password" class="form-control" type="password">
|
||||||
<button class="btn btn-sm">Show</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button class="btn btn-sm">Enter protected session</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user