Skip to content

Commit 23d1c53

Browse files
committed
BUGFIX: Resolve editor js/wasm outside playground.
1 parent 6664152 commit 23d1c53

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ You can experiment with GraphAlg in our [Playground](./playground), or use a [sy
6363

6464
For a detailed overview of the GraphAlg language, see the [language specification](./spec).
6565

66-
<script src="/playground/editor.bundle.js"></script>
66+
<script src="{{ '/playground/editor.bundle.js' | relative_url }}"></script>

playground/binding.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ export function loadPlaygroundWasm() {
2424
let bindings = new PlaygroundWasmBindings();
2525
playgroundWasmFactory({
2626
locateFile: function (path, prefix) {
27-
return prefix + playgroundWasm;
27+
// wasm file is served from the same folder as this script.
28+
const scriptPath = document.currentScript.src;
29+
const baseEnd = scriptPath.lastIndexOf('/');
30+
const basePath = scriptPath.substring(0, baseEnd + 1);
31+
return basePath + playgroundWasm;
2832
},
2933
}).then((instance) => {
3034
bindings.ga_new = instance.cwrap('ga_new', 'number', []);

tutorial/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,4 +600,4 @@ Where you go from here depends on your needs:
600600
In particular, you can find a full overview of all [operations](../spec/operations) available in the GraphAlg there.
601601
- Are you a system developer looking to integrate GraphAlg? See our guide for [new integrators](../integration/new_integration).
602602

603-
<script src="/playground/editor.bundle.js"></script>
603+
<script src="{{ '/playground/editor.bundle.js' | relative_url }}"></script>

0 commit comments

Comments
 (0)