mirror of
https://github.com/zadam/trilium.git
synced 2025-01-16 20:21:43 +08:00
make sure $rendered is always jquery object
This commit is contained in:
parent
8dfdd090f5
commit
b9b2cc8364
1 changed files with 3 additions and 16 deletions
|
@ -12,22 +12,11 @@ async function getRenderedContent(note) {
|
|||
if (type === 'text') {
|
||||
const fullNote = await server.get('notes/' + note.noteId);
|
||||
|
||||
const $content = $("<div>").html(fullNote.content);
|
||||
|
||||
if (utils.isHtmlEmpty(fullNote.content)) {
|
||||
$rendered = "";
|
||||
}
|
||||
else {
|
||||
$rendered = $content;
|
||||
}
|
||||
$rendered = $("<div>").html(fullNote.content);
|
||||
}
|
||||
else if (type === 'code') {
|
||||
const fullNote = await server.get('notes/' + note.noteId);
|
||||
|
||||
if (fullNote.content.trim() === "") {
|
||||
$rendered = "";
|
||||
}
|
||||
|
||||
$rendered = $("<pre>").text(fullNote.content);
|
||||
}
|
||||
else if (type === 'image') {
|
||||
|
@ -62,11 +51,9 @@ async function getRenderedContent(note) {
|
|||
.append($openButton);
|
||||
}
|
||||
else if (type === 'render') {
|
||||
const $el = $('<div>');
|
||||
$rendered = $('<div>');
|
||||
|
||||
await renderService.render(note, $el, this.ctx);
|
||||
|
||||
$rendered = $el;
|
||||
await renderService.render(note, $rendered, this.ctx);
|
||||
}
|
||||
else if (type === 'protected-session') {
|
||||
const $button = $(`<button class="btn btn-sm"><span class="bx bx-log-in"></span> Enter protected session</button>`)
|
||||
|
|
Loading…
Reference in a new issue