1
1
mirror of https://github.com/srid/ema.git synced 2024-11-25 20:12:20 +03:00

Merge remote-tracking branch 'origin/master' into multisite

This commit is contained in:
Sridhar Ratnakumar 2022-02-15 22:03:11 -05:00
commit 87c73bed50
2 changed files with 9 additions and 5 deletions

View File

@ -2,6 +2,7 @@
## Unreleased
- Handle URL anchors (#83)
- Fix bug in `Ex02_Basic.hs` (wasn't generating HTML files)
- Fix `runEmaPure` not generating routes
- Multisite

View File

@ -310,9 +310,9 @@ wsClientJS =
sendObservePath(document.location.pathname);
};
function switchRoute(path) {
console.log(`ema: Switching to $${path}`);
window.history.pushState({}, "", path);
function switchRoute(path, hash = "") {
console.log(`ema: Switching to $${path + hash}`);
window.history.pushState({}, "", path + hash);
sendObservePath(path);
}
@ -320,7 +320,7 @@ wsClientJS =
const origin = e.target.closest("a");
if (origin) {
if (window.location.host === origin.host && origin.getAttribute("target") != "_blank") {
switchRoute(origin.pathname);
switchRoute(origin.pathname, origin.hash);
e.preventDefault();
};
}
@ -370,7 +370,10 @@ wsClientJS =
// This is a new route switch; scroll up.
window.scrollTo({ top: 0});
routeVisible = document.location.pathname;
}
}
if (window.location.hash) {
window.location.hash = window.location.hash;
}
watchCurrentRoute();
};
};