diff --git a/src/lib/components/common/CodeEditor.svelte b/src/lib/components/common/CodeEditor.svelte index aeaa4095c..d505b16a1 100644 --- a/src/lib/components/common/CodeEditor.svelte +++ b/src/lib/components/common/CodeEditor.svelte @@ -24,7 +24,7 @@ let isDarkMode = false; let editorTheme = new Compartment(); - const formatPythonCodeHandler = async () => { + export const formatPythonCodeHandler = async () => { if (codeEditor) { console.log('formatPythonCodeHandler'); const res = await formatPythonCode(value).catch((error) => { diff --git a/src/lib/components/workspace/Tools.svelte b/src/lib/components/workspace/Tools.svelte index 4ed44628b..82f402203 100644 --- a/src/lib/components/workspace/Tools.svelte +++ b/src/lib/components/workspace/Tools.svelte @@ -7,9 +7,15 @@ let loading = false; + let codeEditor; + const submitHandler = async () => { loading = true; // Call the API to submit the code + + if (codeEditor) { + codeEditor.submitHandler(); + } }; @@ -17,7 +23,7 @@