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

This commit is contained in:
zadam 2022-11-08 23:06:56 +01:00
parent 76f34e3eaf
commit 055bd77bd6

View File

@ -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;