mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
jump to note now has full list of notes
This commit is contained in:
parent
7b2c79b754
commit
eb20e1f31f
@ -22,6 +22,8 @@ const noteTree = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function prepareNoteTree() {
|
function prepareNoteTree() {
|
||||||
|
glob.allNoteIds = Object.keys(notesMap);
|
||||||
|
|
||||||
return prepareNoteTreeInner(parentToNotes['root']);
|
return prepareNoteTreeInner(parentToNotes['root']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,8 +33,6 @@ const noteTree = (function() {
|
|||||||
for (const noteId of noteIds) {
|
for (const noteId of noteIds) {
|
||||||
const note = notesMap[noteId];
|
const note = notesMap[noteId];
|
||||||
|
|
||||||
glob.allNoteIds.push(note.note_id);
|
|
||||||
|
|
||||||
note.title = note.note_title;
|
note.title = note.note_title;
|
||||||
|
|
||||||
if (note.is_protected) {
|
if (note.is_protected) {
|
||||||
@ -277,6 +277,10 @@ const noteTree = (function() {
|
|||||||
tree.clearFilter();
|
tree.clearFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getByNoteId(noteId) {
|
||||||
|
return notesMap[noteId];
|
||||||
|
}
|
||||||
|
|
||||||
$("button#reset-search-button").click(resetSearch);
|
$("button#reset-search-button").click(resetSearch);
|
||||||
|
|
||||||
$("input[name=search]").keyup(e => {
|
$("input[name=search]").keyup(e => {
|
||||||
@ -310,5 +314,6 @@ const noteTree = (function() {
|
|||||||
collapseTree,
|
collapseTree,
|
||||||
scrollToCurrentNote,
|
scrollToCurrentNote,
|
||||||
toggleSearch,
|
toggleSearch,
|
||||||
|
getByNoteId
|
||||||
};
|
};
|
||||||
})();
|
})();
|
@ -37,7 +37,7 @@ const treeUtils = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getFullName(noteId) {
|
function getFullName(noteId) {
|
||||||
let note = treeUtils.getNodeByKey(noteId);
|
let note = noteTree.getByNoteId(noteId);
|
||||||
|
|
||||||
if (note === null) {
|
if (note === null) {
|
||||||
return "[unknown]";
|
return "[unknown]";
|
||||||
@ -46,14 +46,11 @@ const treeUtils = (function() {
|
|||||||
const path = [];
|
const path = [];
|
||||||
|
|
||||||
while (note) {
|
while (note) {
|
||||||
path.push(note.title);
|
path.push(note.note_title);
|
||||||
|
|
||||||
note = note.getParent();
|
note = noteTree.getByNoteId(note.note_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove "root" element
|
|
||||||
path.pop();
|
|
||||||
|
|
||||||
return path.reverse().join(" > ");
|
return path.reverse().join(" > ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,27 +34,11 @@ function getAutocompleteItems(noteIds) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autocompleteItems.sort((a, b) => a.value < b.value ? -1 : 1);
|
||||||
|
|
||||||
return autocompleteItems;
|
return autocompleteItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
function uint8ToBase64(u8Arr) {
|
|
||||||
const CHUNK_SIZE = 0x8000; //arbitrary number
|
|
||||||
const length = u8Arr.length;
|
|
||||||
let index = 0;
|
|
||||||
let result = '';
|
|
||||||
let slice;
|
|
||||||
while (index < length) {
|
|
||||||
slice = u8Arr.subarray(index, Math.min(index + CHUNK_SIZE, length));
|
|
||||||
result += String.fromCharCode.apply(null, slice);
|
|
||||||
index += CHUNK_SIZE;
|
|
||||||
}
|
|
||||||
return btoa(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
function base64ToUint8Array(base64encoded) {
|
|
||||||
return new Uint8Array(atob(base64encoded).split("").map(c => c.charCodeAt(0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDateFromTS(timestamp) {
|
function getDateFromTS(timestamp) {
|
||||||
// Date accepts number of milliseconds since epoch so UTC timestamp works without any extra handling
|
// Date accepts number of milliseconds since epoch so UTC timestamp works without any extra handling
|
||||||
// see https://stackoverflow.com/questions/4631928/convert-utc-epoch-to-local-date-with-javascript
|
// see https://stackoverflow.com/questions/4631928/convert-utc-epoch-to-local-date-with-javascript
|
||||||
|
Loading…
x
Reference in New Issue
Block a user