Skip to content

Commit 53e95df

Browse files
committed
Bug fix for #2557 Only rendering last item in inline fields in Live Preview
PR #2416 introduced code which only added the last item of a multi-item inline field, to the main view. Now we loop on all the temporary elements adding them back to the main cointainer.
1 parent 3031fbe commit 53e95df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ui/render.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ async function renderCompactMarkdownForInlineFieldLivePreview(
4242
await MarkdownRenderer.render(app, markdown, tmpContainer, sourcePath, component);
4343
let paragraph = tmpContainer.querySelector(":scope > p");
4444
if (tmpContainer.childNodes.length == 1 && paragraph) {
45-
container.appendChild(paragraph.childNodes.item(paragraph.childNodes.length - 1));
45+
while (paragraph.firstChild) {
46+
container.appendChild(paragraph.firstChild);
47+
}
4648
} else {
4749
container.replaceChildren(...tmpContainer.childNodes);
4850
}

0 commit comments

Comments
 (0)