diff --git a/bindings/wasm/examples/editor.js b/bindings/wasm/examples/editor.js index 123715e0c..64c066d5b 100644 --- a/bindings/wasm/examples/editor.js +++ b/bindings/wasm/examples/editor.js @@ -112,6 +112,8 @@ function switchTo(scriptName) { isExample = exampleFunctions.get(scriptName) != null; const code = isExample ? exampleFunctions.get(scriptName).substring(1) : getScript(scriptName) ?? ''; + window.location.hash = `#${scriptName}`; + window.location.search = ''; editor.setValue(code); } } @@ -129,8 +131,6 @@ function createDropdownItem(name) { button.onclick = function() { saveCurrent(); - window.location.hash = `#${label.textContent}`; - window.location.search = ''; switchTo(label.textContent); }; // Stop text input spaces from triggering the button @@ -217,7 +217,6 @@ function addEdit(button) { removeScript(label.textContent); if (currentFileElement.textContent == label.textContent) { switchTo('Intro'); - window.location.hash = '#Intro'; } const container = button.parentElement; container.parentElement.removeChild(container); @@ -332,6 +331,8 @@ require(['vs/editor/editor.main'], async function() { else { switchTo(name); } + } else { + switchTo(currentName); } if (manifoldInitialized) { diff --git a/bindings/wasm/examples/index.html b/bindings/wasm/examples/index.html index eaf74bf65..87b3434c3 100644 --- a/bindings/wasm/examples/index.html +++ b/bindings/wasm/examples/index.html @@ -73,7 +73,7 @@
Loading...