From 6e7e575a18848aee64b1913fd76bee0a3190fc60 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 10 Jun 2024 17:30:07 -0700 Subject: [PATCH] refac --- src/lib/components/common/CodeEditor.svelte | 2 +- src/lib/components/workspace/Tools.svelte | 8 +++++++- src/lib/components/workspace/Tools/CodeEditor.svelte | 10 +++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) 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 @@