diff --git a/src/lib/components/common/CodeEditor.svelte b/src/lib/components/common/CodeEditor.svelte index d505b16a1..4d2bfcd5a 100644 --- a/src/lib/components/common/CodeEditor.svelte +++ b/src/lib/components/common/CodeEditor.svelte @@ -26,7 +26,6 @@ export const formatPythonCodeHandler = async () => { if (codeEditor) { - console.log('formatPythonCodeHandler'); const res = await formatPythonCode(value).catch((error) => { toast.error(error); return null; @@ -111,11 +110,16 @@ // Add a keyboard shortcut to format the code when Ctrl/Cmd + S is pressed // Override the default browser save functionality - const handleSave = (e) => { + const handleSave = async (e) => { if ((e.ctrlKey || e.metaKey) && e.key === 's') { e.preventDefault(); - formatPythonCodeHandler(); - dispatch('save'); + const res = await formatPythonCodeHandler().catch((error) => { + return null; + }); + + if (res) { + dispatch('save'); + } } }; diff --git a/src/lib/components/workspace/Tools.svelte b/src/lib/components/workspace/Tools.svelte index 82f402203..faa05d7e7 100644 --- a/src/lib/components/workspace/Tools.svelte +++ b/src/lib/components/workspace/Tools.svelte @@ -7,6 +7,8 @@ let loading = false; + let name = ''; + let codeEditor; const submitHandler = async () => { @@ -22,18 +24,39 @@
-