From 4c5d6f1d6c6cb41bea27fc80e2d38c4afa7ec139 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 23 Feb 2023 00:04:53 +0100 Subject: [PATCH] fix: hash links --- website/src/repl/Repl.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/src/repl/Repl.jsx b/website/src/repl/Repl.jsx index 490166b4..d73adcae 100644 --- a/website/src/repl/Repl.jsx +++ b/website/src/repl/Repl.jsx @@ -131,6 +131,7 @@ export function Repl({ embedded = false }) { afterEval: ({ code }) => { setPending(false); setLatestCode(code); + window.location.hash = '#' + encodeURIComponent(btoa(code)); }, onToggle: (play) => !play && cleanupDraw(false), drawContext, @@ -145,7 +146,7 @@ export function Repl({ embedded = false }) { } Press play or hit ctrl+enter to run it!`, 'highlight', ); - setCode(latestCode || decoded || randomTune); + setCode(decoded || latestCode || randomTune); }); }, []);