mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
code note in tooltip needs to be wrapped in <pre> to keep formatting, fixes #137
This commit is contained in:
parent
01c7e58d47
commit
365c37604b
@ -15,7 +15,19 @@ function setupTooltip() {
|
|||||||
if (notePath) {
|
if (notePath) {
|
||||||
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
|
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
|
||||||
|
|
||||||
noteDetailService.loadNote(noteId).then(note => callback(note.content));
|
noteDetailService.loadNote(noteId).then(note => {
|
||||||
|
if (!note.content.trim()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (note.type === 'text') {
|
||||||
|
callback(note.content);
|
||||||
|
}
|
||||||
|
else if (note.type === 'code') {console.log($("<pre>").text(note.content).html());
|
||||||
|
callback($("<pre>").text(note.content).prop('outerHTML'));
|
||||||
|
}
|
||||||
|
// other types of notes don't have tooltip preview
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
close: function (event, ui) {
|
close: function (event, ui) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user