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:
commit
87c73bed50
@ -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
|
||||
|
@ -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();
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user