From 3ffed77c584e6951912f699cceffa250b8cabd98 Mon Sep 17 00:00:00 2001 From: Moeki Kawakami Date: Thu, 17 Oct 2024 23:48:59 +0900 Subject: [PATCH] Merge with importmap tags --- lib/clapton/javascripts/dist/client.js | 7 +++++++ lib/clapton/javascripts/src/client.ts | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/clapton/javascripts/dist/client.js b/lib/clapton/javascripts/dist/client.js index 90045ac..c0e4d4f 100644 --- a/lib/clapton/javascripts/dist/client.js +++ b/lib/clapton/javascripts/dist/client.js @@ -1448,6 +1448,13 @@ document.addEventListener("DOMContentLoaded", async () => { const event = new Event('clapton:render'); document.dispatchEvent(event); }); +document.addEventListener("turbo:render", async () => { + await initializeComponents(); + initializeActions(); + initializeInputs(); + const event = new Event('clapton:render'); + document.dispatchEvent(event); +}); window.addEventListener('beforeunload', () => { sessionStorage.setItem('scrollPosition', window.scrollY.toString()); }); diff --git a/lib/clapton/javascripts/src/client.ts b/lib/clapton/javascripts/src/client.ts index 7e93890..9828673 100644 --- a/lib/clapton/javascripts/src/client.ts +++ b/lib/clapton/javascripts/src/client.ts @@ -46,6 +46,14 @@ document.addEventListener("DOMContentLoaded", async () => { document.dispatchEvent(event); }); +document.addEventListener("turbo:render", async () => { + await initializeComponents(); + initializeActions(); + initializeInputs(); + const event = new Event('clapton:render'); + document.dispatchEvent(event); +}); + window.addEventListener('beforeunload', () => { sessionStorage.setItem('scrollPosition', window.scrollY.toString()); });