aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/static/main.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/static/main.js b/src/static/main.js
index 68d36ad..0f77b1e 100644
--- a/src/static/main.js
+++ b/src/static/main.js
@@ -38,6 +38,21 @@ document.body.addEventListener("htmx:afterRequest", (event) => {
}
});
+document.body.addEventListener("htmx:afterSwap", (event) => {
+ const target = event.detail?.target;
+ const requestElt = event.detail?.requestConfig?.elt;
+
+ if (!(target instanceof HTMLElement) || target.id !== "result") {
+ return;
+ }
+
+ if (!(requestElt instanceof HTMLElement) || requestElt.id !== "convert-form") {
+ return;
+ }
+
+ target.scrollIntoView({ behavior: "smooth", block: "start" });
+});
+
if (mdFileInput) {
mdFileInput.addEventListener("change", () => {
const file = mdFileInput.files?.[0];