From 4d0bd29b4546174d97cf581250bbf0c97d731bd3 Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Tue, 10 Feb 2026 23:51:32 +0000 Subject: [PATCH] Clear placeholder content when comments iframe loads Remove non-iframe child nodes from the root element once the iframe signals it has initialised, allowing users to add loading placeholders that get cleaned up automatically. Fixes #1990 --- frontend/apps/remark42/app/embed.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/apps/remark42/app/embed.ts b/frontend/apps/remark42/app/embed.ts index adcda6ec..e444ac52 100644 --- a/frontend/apps/remark42/app/embed.ts +++ b/frontend/apps/remark42/app/embed.ts @@ -79,6 +79,11 @@ function createInstance(config: typeof window.remark_config) { } if (data.inited === true) { + // remove placeholder content added by the user before comments loaded + Array.from(root!.childNodes) + .filter((node) => node !== iframe) + .forEach((node) => node.remove()); + postHashToIframe(); postTitleToIframe(document.title); }