Skip to content

Build your personal knowledge base with Trilium Notes

Remove "Content of this note cannot be displayed" in the book format, fixes #3301

zadam055bd77bd687
diff --git a/src/public/app/services/note_content_renderer.js b/src/public/app/services/note_content_renderer.js
index 749047a4bd..b315e88bfe 100644
--- a/src/public/app/services/note_content_renderer.js
+++ b/src/public/app/services/note_content_renderer.js
@@ -33,26 +33,7 @@ async function getRenderedContent(note, options = {}) {
}
}
else {
- $renderedContent.css("padding", "10px");
- $renderedContent.addClass("text-with-ellipsis");
-
- let childNoteIds = note.getChildNoteIds();
-
- if (childNoteIds.length > 10) {
- childNoteIds = childNoteIds.slice(0, 10);
- }
-
- // just load the first 10 child notes
- const childNotes = await froca.getNotes(childNoteIds);
-
- for (const childNote of childNotes) {
- $renderedContent.append(await linkService.createNoteLink(`${note.noteId}/${childNote.noteId}`, {
- showTooltip: false,
- showNoteIcon: true
- }));
-
- $renderedContent.append("<br>");
- }
+ await renderChildrenList($renderedContent, note);
}
}
else if (type === 'code') {
@@ -164,6 +145,9 @@ async function getRenderedContent(note, options = {}) {
$renderedContent.append($("<div>").text("Error parsing content. Please check console.error() for more details."));
}
}
+ else if (type === 'book') {
+ // nothing, book doesn't have its own content
+ }
else if (!options.tooltip && type === 'protected-session') {
const $button = $(`<button class="btn btn-sm"><span class="bx bx-log-in"></span> Enter protected session</button>`)
.on('click', protectedSessionService.enterProtectedSession);
@@ -187,6 +171,29 @@ async function getRenderedContent(note, options = {}) {
};
}
+async function renderChildrenList($renderedContent, note) {
+ $renderedContent.css("padding", "10px");
+ $renderedContent.addClass("text-with-ellipsis");
+
+ let childNoteIds = note.getChildNoteIds();
+
+ if (childNoteIds.length > 10) {
+ childNoteIds = childNoteIds.slice(0, 10);
+ }
+
+ // just load the first 10 child notes
+ const childNotes = await froca.getNotes(childNoteIds);
+
+ for (const childNote of childNotes) {
+ $renderedContent.append(await linkService.createNoteLink(`${note.noteId}/${childNote.noteId}`, {
+ showTooltip: false,
+ showNoteIcon: true
+ }));
+
+ $renderedContent.append("<br>");
+ }
+}
+
function trim(text, doTrim) {
if (!doTrim) {
return text;