mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
adding notes to recent list only after some time period (currently 1500ms)
This commit is contained in:
parent
9d80f56d81
commit
8a928f05f3
@ -26,7 +26,7 @@ $(document).bind('keypress', 'alt+q', function() {
|
|||||||
recentNotesSelectBox.find('option').remove();
|
recentNotesSelectBox.find('option').remove();
|
||||||
|
|
||||||
// remove the current note
|
// remove the current note
|
||||||
let recNotes = recentNotes.slice(1);
|
let recNotes = recentNotes.filter(note => note.noteId !== globalNote.detail.note_id);
|
||||||
|
|
||||||
$.each(recNotes, function(key, value) {
|
$.each(recNotes, function(key, value) {
|
||||||
let option = $("<option></option>")
|
let option = $("<option></option>")
|
||||||
|
@ -170,14 +170,23 @@ function loadNote(noteId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addRecentNote(noteId, noteTitle) {
|
function addRecentNote(noteId, noteTitle) {
|
||||||
|
const origDate = new Date();
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
// we include the note into recent list only if the user stayed on the note at least 5 seconds
|
||||||
|
if (noteId === globalNote.detail.note_id) {
|
||||||
// if it's already there, remove the note
|
// if it's already there, remove the note
|
||||||
recentNotes = recentNotes.filter(note => note.noteId !== noteId);
|
recentNotes = recentNotes.filter(note => note.noteId !== noteId);
|
||||||
|
|
||||||
|
// console.log("added after " + (new Date().getTime() - origDate.getTime()));
|
||||||
|
|
||||||
recentNotes.unshift({
|
recentNotes.unshift({
|
||||||
noteId: noteId,
|
noteId: noteId,
|
||||||
noteTitle: noteTitle
|
noteTitle: noteTitle
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
function encryptNote() {
|
function encryptNote() {
|
||||||
let password = prompt("Enter password for encryption");
|
let password = prompt("Enter password for encryption");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user