diff --git a/src/live-preview/handleStoryblokMessage.ts b/src/live-preview/handleStoryblokMessage.ts index 5599273a..6e92f31b 100644 --- a/src/live-preview/handleStoryblokMessage.ts +++ b/src/live-preview/handleStoryblokMessage.ts @@ -24,6 +24,8 @@ export async function handleStoryblokMessage(event: { // Get current focused element in Storyblok const focusedElem = document.querySelector('[data-blok-focused="true"]'); updateDOMWithNewBody(currentBody, newBody, focusedElem); + // Dispatch a custom event after the body update + document.dispatchEvent(new Event('storyblok-live-preview-updated')); }; const debounceDelay = 500; // Adjust the delay as needed clearTimeout(timeout);