Skip to content

Commit

Permalink
fix: code url not working
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed May 9, 2024
1 parent f5fe1bd commit 8fd6895
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Format: Major.Minor.Patch (D/M/Y)

## 0.1.1 (9/5/2024)
- fixed code url not loading

## 0.1.0 (9/5/2024)
The initial release!

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kaboom-playground",
"type": "module",
"version": "0.1.0",
"version": "0.1.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand Down
9 changes: 4 additions & 5 deletions src/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ const MonacoEditor = forwardRef<EditorRef, Props>((props, ref) => {
);
}

setDefaultCode(
decompressCode(codeUrl),
);
updateFile(getCurrentFile().name, decompressCode(codeUrl));
} catch {
setDefaultCode("kaboom()\n\ndebug.log(\"ohhi\");");
}
Expand All @@ -60,8 +58,9 @@ const MonacoEditor = forwardRef<EditorRef, Props>((props, ref) => {
editorRef.current = editor;
props.onMount?.(editorRef.current);

// Editor Shortcuts
editor.setValue(getCurrentFile().value);

// Editor Shortcuts
editor.addAction({
id: "run-game",
label: "Run Game",
Expand Down Expand Up @@ -97,7 +96,7 @@ const MonacoEditor = forwardRef<EditorRef, Props>((props, ref) => {
return (
<Editor
defaultLanguage="javascript"
defaultValue={props.file?.value || defaultCode!}
defaultValue={getCurrentFile().value}
beforeMount={handleEditorBeforeMount}
onMount={handleEditorMount}
onChange={handleEditorChange}
Expand Down

0 comments on commit 8fd6895

Please sign in to comment.