mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 09:16:45 +01:00
refactorings in relation map related to noteId handling and storage
This commit is contained in:
@@ -8,6 +8,7 @@ const $content = $("#note-revision-content");
|
||||
const $title = $("#note-revision-title");
|
||||
|
||||
let revisionItems = [];
|
||||
let note;
|
||||
|
||||
async function showCurrentNoteRevisions() {
|
||||
await showNoteRevisionsDialog(noteDetailService.getCurrentNoteId());
|
||||
@@ -21,6 +22,7 @@ async function showNoteRevisionsDialog(noteId, noteRevisionId) {
|
||||
$list.empty();
|
||||
$content.empty();
|
||||
|
||||
note = noteDetailService.getCurrentNote();
|
||||
revisionItems = await server.get('notes/' + noteId + '/revisions');
|
||||
|
||||
for (const item of revisionItems) {
|
||||
@@ -51,12 +53,15 @@ $list.on('change', () => {
|
||||
|
||||
$title.html(revisionItem.title);
|
||||
|
||||
if (revisionItem.type === 'text') {
|
||||
if (note.type === 'text') {
|
||||
$content.html(revisionItem.content);
|
||||
}
|
||||
else if (revisionItem.type === 'code') {
|
||||
else if (note.type === 'code') {
|
||||
$content.html($("<pre>").text(revisionItem.content));
|
||||
}
|
||||
else {
|
||||
$content.text("Preview isn't available for this note type.");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', "a[data-action='note-revision']", event => {
|
||||
|
||||
Reference in New Issue
Block a user