Unverified Commit 95fb947c authored by Benjamin Wheeler's avatar Benjamin Wheeler Committed by GitHub

Merge pull request #2325 from benjiwheeler/hash-redirect

redirect hash urls to url pathnames
parents ac6a870a 79ae4dd5
...@@ -778,6 +778,23 @@ const ConnectedPreview = connect( ...@@ -778,6 +778,23 @@ const ConnectedPreview = connect(
mapDispatchToProps mapDispatchToProps
)(Preview); )(Preview);
// replace old Scratch 2.0-style hashtag URLs with updated format
if (window.location.hash) {
let pathname = window.location.pathname;
if (pathname.substr(-1) !== '/') {
pathname = `${pathname}/`;
}
if (window.location.hash === '#editor') {
history.replaceState({}, document.title,
`${pathname}editor${window.location.search}`);
}
if (window.location.hash === '#fullscreen') {
history.replaceState({}, document.title,
`${pathname}fullscreen${window.location.search}`);
}
}
// initialize GUI by calling its reducer functions depending on URL
GUI.setAppElement(document.getElementById('app')); GUI.setAppElement(document.getElementById('app'));
const initGuiState = guiInitialState => { const initGuiState = guiInitialState => {
const pathname = window.location.pathname.toLowerCase(); const pathname = window.location.pathname.toLowerCase();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment