Skip to content

Commit

Permalink
fix: fix some small issues and upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
MR-Addict committed Sep 14, 2024
1 parent 0e2bd5f commit 0c14c37
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
11 changes: 11 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"format": "prettier -c --write ."
},
"devDependencies": {
"@babel/standalone": "^7.25.6",
"@types/node": "^22.5.5",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export default function Editor() {
// listen ctrl + r
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
console.log(e.view?.window === window);

if (e.view?.window === window && e.ctrlKey && e.key.toLowerCase() === "r") {
e.preventDefault();
execuateCode();
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/contexts/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const defaultOutputs: OutputsType = {

const defaultEditorOptions: EditorType = {
theme: "light",
lang: "javascript",
code: defaultCodes.javascript,
defaultCode: defaultCodes.javascript,
lang: "python",
code: defaultCodes.python,
defaultCode: defaultCodes.python,
readonly: false
};

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/data/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const languages = ["python", "typescript", "javascript"] as const;

const defaultCodes = {
python: '# This is default python code\n\nprint("Hello world")',
typescript: '// This is default typescript code\n\nlet message: string = "Hello, world!";\nconsole.log(message);',
javascript: '// This is default javascript code\n\nlet message = "Hello, world!";\nconsole.log(message);'
python: '# Default python code\n\nprint("Hello, python")',
typescript: '// Default typescript code\n\nlet message: string = "Hello, typescript!";\nconsole.log(message);',
javascript: '// Default javascript code\n\nlet message = "Hello, javascript!";\nconsole.log(message);'
} as const;

export { languages, defaultCodes };
2 changes: 1 addition & 1 deletion frontend/src/workers/python-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
self.importScripts("https://cdn.jsdelivr.net/pyodide/v0.25.0/full/pyodide.js");
self.importScripts("https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js");

let pyodide = null;

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/workers/typescript-worker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
self.importScripts("https://unpkg.com/@babel/standalone@7.23.10/babel.min.js");
self.importScripts("https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/babel-standalone/7.25.6/babel.min.js");

const postmessage = (status, msg) => self.postMessage({ lang: "typescript", output: { status, data: msg } });

Expand Down

0 comments on commit 0c14c37

Please sign in to comment.