code note in tooltip needs to be wrapped in <pre> to keep formatting, fixes #137

This commit is contained in:
azivner 2018-07-30 16:55:20 +02:00
parent 01c7e58d47
commit 365c37604b

View File

@ -15,7 +15,19 @@ function setupTooltip() {
if (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) {